Script Engine Changes

The place to discuss scripting and game modifications for X³: Farnham's Legacy

Moderators: Moderators for English X Forum, Scripting / Modding Moderators, Moderators for the X3:FL Forums

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22230
Joined: Sun, 14. Nov 04, 23:26
x4

Re: Script Engine Changes

Post by Cycrow » Sat, 26. Aug 23, 00:03

Deniskos wrote:
Tue, 4. Jul 23, 09:29
The script command

Code: Select all

<t id="2429">%1%0get all tasks with script on stack=%2</t>
returns task numbers one greater.
Does this mean that 1 must be subtracted from the returned value, or is this a bug in the code?
This is how it works internally, as its stored in a table, and tables cant have a key of 0.

i may look at adjusting it so when it returned the array it will fix it

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22230
Joined: Sun, 14. Nov 04, 23:26
x4

Re: Script Engine Changes

Post by Cycrow » Sat, 26. Aug 23, 00:07

Deniskos wrote:
Thu, 13. Jul 23, 07:27
What flags does this command use?

Code: Select all

<t id="2972">%0set override name flags: %1</t>
This uses the same flags as the jobs file.
there is currently no constants for them

Code: Select all

#define OBJ_NAME_SHOWRACE			0x01
#define OBJ_NAME_SHOWCORP			0x02
#define OBJ_NAME_SHOWOBJ			0x04
#define OBJ_NAME_SHOWVAR			0x08
#define OBJ_NAME_SHOWGREEK		0x10
#define OBJ_NAME_SHOWSIZE			0x20
#define OBJ_NAME_SHOWJOB			0x40

FriendlyFirePhoenix
Posts: 90
Joined: Tue, 14. Feb 17, 10:06
x3ap

Re: Script Engine Changes

Post by FriendlyFirePhoenix » Sun, 27. Aug 23, 12:12

Hi Cycrow,

I've finally got around to updating my mod to take advantage of your double firing of SIGNAL_CREATED. It's working great for everything except drones.

If the drone is spawned via your cheat script or by an AI ship ejecting it SIGNAL_CREATED fires only once before its race has been assigned. Of course, drones spawned by jobs fire SIGNAL_CREATED twice.

I can work around this so I'm not necessarily asking for a change, but I thought I'd flag it in case it was an oversight.

Incidentally while testing this I found it very difficult to get the AI transports to actually eject their drones when attacked. Only about 1 in 5 would do it. Most were killed from my gunfire without ever releasing them. I made sure to scan the ships to make sure they had drones. This is right at the start of the Argon Patriot start in a lowly Argon Elite so maybe they think they don't need them. But yeah, worth mentioning.
I made a couple of X3 mods | Colour By Race | True Relations

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Sun, 27. Aug 23, 18:21

Code: Select all

global comm map: set: class=[ObjectClass], race=[Race], script='ScriptName', commcheck=[Boolean]
Can I call this command multiple times in a loop with the same parameters, or do I only need to do it once?
I also realized that this command does not work on docked ships. Although in the communication menu of the dock where they are docked they are available for contacting.
And anyway, thank you Cycrow for this new communication feature in the game :x3:

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Tue, 29. Aug 23, 17:18

Is it possible to make the "answers" event fire with a delay necessary for the player to read the text from the "question" ?


PS
Although I can do this myself in scripts, don't bother with it.
Last edited by Deniskos on Sat, 30. Sep 23, 18:20, edited 2 times in total.

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Sat, 30. Sep 23, 18:12

When working with a script command

Code: Select all

global comm map: set: class=[ObjectClass], race=[Race], script='ScriptName', commcheck=[Boolean]
I noticed this glitch:
Let's say there is an executable mission cycle in which this command is called
Let's say a player is saved and loaded from the last save and the previously defined global comm map stops working until you initialize it again, is this normal?
Does it need to be called constantly in a loop? and if not, can you do a command like

Code: Select all

get global comm map: script='ScriptName'
?
I think I already asked about this, but never got around to answering it.


PS
Placed a standing call

Code: Select all

global comm map: set:
in a loop, it seems to work fine.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22230
Joined: Sun, 14. Nov 04, 23:26
x4

Re: Script Engine Changes

Post by Cycrow » Sat, 30. Sep 23, 19:23

you shouldn't need to call it in a loop. Just call in once per load should be enough. It should just need to be called from a setup script, similar to the command console command map

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22230
Joined: Sun, 14. Nov 04, 23:26
x4

Re: Script Engine Changes

Post by Cycrow » Sun, 22. Oct 23, 23:32

Deniskos wrote:
Tue, 29. Aug 23, 17:18
Is it possible to make the "answers" event fire with a delay necessary for the player to read the text from the "question" ?


PS
Although I can do this myself in scripts, don't bother with it.
In 1.3.11 you will be able to specify a delay in the question array.
so when you return an array with a odd number of entries, the final one will be used as a delay in ms

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Wed, 25. Oct 23, 07:44

There is such a script command to add information about a passenger

Code: Select all

<t id="1703">%0set passenger info: id=%1 pageid=%2 textid=%3 info=%4</t>
Is there a command to delete passenger information?

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Sat, 6. Apr 24, 20:49

Is it possible to update TFacSizes.txt in the game?

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22230
Joined: Sun, 14. Nov 04, 23:26
x4

Re: Script Engine Changes

Post by Cycrow » Sat, 6. Apr 24, 21:54

Do you mean dynamically during runtime ?

If so, you could call the script again to read the file. It's 100% done via script

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Sun, 7. Apr 24, 04:32

I can read it. I need to recreate it with the addition of new factories.
Cycrow wrote:
Sat, 6. Apr 24, 21:54
It's 100% done via script
What script is responsible for this?

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22230
Joined: Sun, 14. Nov 04, 23:26
x4

Re: Script Engine Changes

Post by Cycrow » Sun, 7. Apr 24, 12:57

you can just add more entries to the files.

the script is lib.X2I.HephCorp.getbuildconstant.

it reads the file and stores them into a global variable. You can just run the script again to read any changes, or you can manually adjust the global variable table as well

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Sun, 7. Apr 24, 15:39

I don't need to read it, I need to create it :?
Nevermind ..

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24965
Joined: Sun, 2. Apr 06, 16:38
x4

Re: Script Engine Changes

Post by X2-Illuminatus » Mon, 8. Apr 24, 22:15

Deniskos wrote:
Sat, 6. Apr 24, 20:49
Is it possible to update TFacSizes.txt in the game?
The original script uses the station sizes from Saetan's object size database. The tools to create that database can be downloaded here (script files) and here (object files). The script uses a modified inactive Terran gate (gate subtype 15) to detect collisions with objects in all three coordinates. Saetan changed the gate to a flat surface. (That's what the object files are for.) The last time I used that script to create an object size database was for X3AP.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Tue, 9. Apr 24, 05:27

OK, thank you. I'll try to figure it out.

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Sat, 13. Apr 24, 08:04

Cycrow wrote:1.3.11:
- Improved display of custom mneu hyperlinked info text
How can I turn this off?
What is this for?
This broke all my menus
Show
Image
Everything worked well without this improvement :wink:

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22230
Joined: Sun, 14. Nov 04, 23:26
x4

Re: Script Engine Changes

Post by Cycrow » Sat, 13. Apr 24, 11:33

can you send me the script for that menu, and ill see if i can fix it.

the main thing it did was to allow hyperlinks to split between multiple lines. So if you have a hyperlinked text, previously if the text end up on different lines, only the first part would be hyperlinked. This also allowed coloured text to continue on the next line as well

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Sat, 13. Apr 24, 14:15

Yes, sure. Here you are.
Show

Code: Select all

  $TMain=get global variable: name='Combo.Main'
  $TMenu=$TMain['MainMenuSettings']
  $TUISettings=$TMain['UISettings']
  $TCMSettings=$TMain['CMSettings']
  $TEISettings=$TMain['EISettings']
  $MenuHeight=$TMenu['MenuHeight']
  if$AState == [MEvent.Start]
    $Tab=$TMenu['TabMenu']
    ifis datatype[ $Tab ] == DATATYPE_NULL
      $Tab=$TMenu['TabMenuDefault']
      $TMenu['TabMenu'] = $Tab
    end
    
    gosub sub.BuildMenu
    
    set menu option: $Menu, set default tab=$Tab
    return $Input
    
  else if$AState == 'AddAsteroid'
    $Text=read text: page=[Page.Menus] id=2410028
    $Input=create input: id='EI.AddAsteroid.Menu', user input=Var/Asteroid, refobj=null, description=$Text, without sector=[FALSE], filterclass=null, racemask=null, flags=null, default=null
    return $Input
    
  else if$AState == 'RemoveAsteroid'
    gosub sub.BuildAsteroidMenu
    return $Input
    
  else if$AState == [MEvent.Update]
    $MenuID=$AValue[0]
    $TAsteroids=$TEISettings['Combo.EI.AllowedAsteroids']
    $Sectors=get keys: table=$TAsteroids
    $SectorsSize=size of array $Sectors
    while$SectorsSize
      dec $SectorsSize=
      $Sector=$Sectors[$SectorsSize]
      $AsteroidsArray=$TAsteroids[$Sector]
      $AsteroidsArraySize=size of array $AsteroidsArray
      while$AsteroidsArraySize
        dec $AsteroidsArraySize=
        $Asteroid=$AsteroidsArray[$AsteroidsArraySize]
        skip if$Asteroid -> exists
          remove element from array $AsteroidsArray at index $AsteroidsArraySize
      end
      
      $AsteroidsArray=$TAsteroids[$Sector]
      skip ifsize of array $AsteroidsArray
        remove key $Sector from table $TAsteroids
    end
    
    if$MenuID == 'ComboMainMenu'
      gosub sub.BuildMenu
      return $Menu
      
    else if$MenuID == 'EI.RemoveAsteroid.Menu'
      gosub sub.BuildAsteroidMenu
      return $Menu
    end
    
  else if$AState == [MEvent.Group]
    $MenuID=$AValue[0]
    $SelectedID=$AValue[1]
    $Value=$AValue[2]
    $TMenu[$SelectedID] = $Value
    if$Value
      play sample 1208
    else
      play sample 1209
    end
    
    gosub sub.BuildMenu
    return $Menu
    
  else if$AState == [MEvent.Switch]
    $MenuID=$AValue[0]
    $SelectedID=$AValue[1]
    $Value=$AValue[2]
    $UIArray=get global variable: name='Combo.UI.Colours'
    if$MenuID == 'ComboMainMenu'
      $UIItemArray=create new array, size=8, elements='Combo.UI.Colour', 'Combo.UI.ColourScheme', 'Combo.UI.HeadingTitle', 'Combo.UI.SectorMap', 'Combo.UI.SectorMapT', 'Combo.UI.GalaxyMap', 'Combo.UI.GalaxyMapT', 'Combo.UI.RemoveSB'
      iffind $SelectedID in array: $UIItemArray
        $TUISettings[$SelectedID] = $Value
        gosub sub.SetUIValue
        gosub sub.BuildMenu
        return $Menu
      end
      
      $RacesString=$TCMSettings['Combo.CM.RacesStrings']
      iffind $SelectedID in array: $RacesString
        $Races=get race array
        $Size=size of array $Races
        while$Size
          dec $Size=
          $Race=$Races[$Size]
          $RaceString=sprintf: fmt='%s', $Race, null, null, null, null
          if$RaceString == $SelectedID
            $SelectedID=$Race
            break
          end
        end
        
        $TCMSettings[$SelectedID] = $Value
        gosub sub.SetCMValue
        gosub sub.BuildMenu
        return $Menu
      end
      
      if$SelectedID == 'Combo.CM.ColourMap'
        $TCMSettings[$SelectedID] = $Value
        gosub sub.SetCMValue
        gosub sub.BuildMenu
        return $Menu
        
      else if$SelectedID == 'Combo.CM.Default'
        $DefaultTable=$TCMSettings[$SelectedID]
        $Keys=get keys: table=$DefaultTable
        $Size=size of array $Keys
        while$Size
          dec $Size=
          $Key=$Keys[$Size]
          $Value=$DefaultTable[$Key]
          $TCMSettings[$Key] = $Value
        end
        
        gosub sub.SetCMValue
        gosub sub.BuildMenu
        return $Menu
      end
      
      $EIItemArray=create new array, arguments='Combo.EI.DisallowAbandonedExport', 'Combo.EI.DisallowAsteroidExport', 'Combo.EI.DebugImport', null, null
      iffind $SelectedID in array: $EIItemArray
        $TEISettings[$SelectedID] = $Value
        gosub sub.BuildMenu
        return $Menu
      end
      
      $ItemArray=create new array, arguments='Combo.Bounce', null, null, null, null
      iffind $SelectedID in array: $ItemArray
        $TMenu[$SelectedID] = $Value
        set global variable: name=$SelectedID value=$Value
        gosub sub.BuildMenu
        return $Menu
      end
      
      $Array=split string: $SelectedID separator=':'
      ifis datatype[ $Array ] == DATATYPE_ARRAY
        $SelectedID=$Array[0]
        $Page=$Array[1]
        $Page=string $Page to integer
        $ID=$Array[2]
        $ID=string $ID to integer
        $Array=read text: page=$Page id=$ID
        $Array=split string: $Array separator='|'
        $ArraySize=size of array $Array
        while$ArraySize
          dec $ArraySize=
          $HotKeyData=$Array[$ArraySize]
          $HotKeyData=split string: $HotKeyData separator=':'
          iffind $SelectedID in array: $HotKeyData
            $HotKeyScript=$HotKeyData[1]
            $HotKeyText=$HotKeyData[3]
            $HotKeyText=string $HotKeyText to integer
            if$Value
              $HotKey=register hotkey: page=[Page.Menus] id=$HotKeyText, to call script name $HotKeyScript
              $TMenu[$SelectedID] = $HotKey
            else
              $HotKey=$TMenu[$SelectedID]
              unregister hotkey $HotKey
              $TMenu[$SelectedID] = 0
            end
            
            gosub sub.BuildMenu
            return $Menu
            break
          end
        end
      end
      
      if$SelectedID == 'Combo.ExtMapUpdateTimer' OR $SelectedID == 'Combo.ExtMapUpdate' OR $SelectedID == 'Combo.QuickDialogues' OR $SelectedID == 'Combo.BasicSalaryReport'
        if$SelectedID == 'Combo.ExtMapUpdate'
          $GlobalVars=get global variable: name='al.dsrc.Combo.EGM'
          if$Value
            $GlobalVars[1] = [TRUE]
          else
            $GlobalVars[1] = [FALSE]
          end
        end
        
        $TMain[$SelectedID] = $Value
        gosub sub.BuildMenu
        return $Menu
      end
      
    else if$MenuID == 'EI.RemoveAsteroid.Menu'
      $RAsteroids=$TEISettings['Combo.EI.RemoveAsteroids']
      $Asteroid=convert serialised string to object: string=$SelectedID
      iffind $Asteroid in array: $RAsteroids
        $Index=get index of $Asteroid in array $RAsteroids offset=-1 + 1
        remove element from array $RAsteroids at index $Index
      else
        append $Asteroid to array $RAsteroids
      end
      
      $Input=create input return value: update menu=$Menu
      return $Input
    end
    
  else if$AState == [MEvent.TabChanged]
    $Value=$AValue[1]
    $TMenu['TabMenu'] = $Value
    gosub sub.BuildMenu
    return $Menu
    
  else if$AState == [MEvent.Select]
    $Value=$AValue[1]
    if$Value == 'Export'
@     STARTnull -> call script dsrc.EmpireCopy.Export : 
      do if is menu open
        kill menus
      
    else if$Value == 'Import'
@     STARTnull -> call script dsrc.EmpireCopy.Import : 
      do if is menu open
        kill menus
      
    else if$Value == 'FindShip'
      =[PLAYERSHIP] ->open named menu script: script='dsrc.Combo.FindShipMenu', value=null
    else if$Value == 'EGMUpdateRun'
@     STARTnull -> call script dsrc.EGM.CollectData : 
    else if$Value == 'dsrc.Argon.BBS' OR $Value == 'dsrc.Teladi.BBS' OR $Value == 'dsrc.Goner.BBS'
    else
      $StringArray=split string: $Value separator=';'
      $String=$StringArray[0]
      ifdoes script name exist: $String
        if$String == 'dsrc.FDN.MenuHotKey' OR $String == 'dsrc.AdvNav.HotKey' OR $String == 'dsrc.AdvJump.HotKey' OR $String == 'dsrc.QDrive.Config' OR $String == 'dsrc.PM.MenuHotKey'
          =null -> call named script: script=$String, null, null, null, null, null
        else
          =[PLAYERSHIP] ->open named menu script: script=$String, value=null
        end
        
      else
        $ValueArray=split string: $String separator='.'
        $Help=$ValueArray[1]
        ifis datatype[ $Help ] == DATATYPE_STRING
          $Input=create input: id=$String encyclopedia page, help=$Help
          return $Input
        end
      end
    end
    
  else if$AState == [MEvent.Selection]
    $MenuID=$AValue[0]
    $SelectedID=$AValue[1]
    $Value=$AValue[2]
    $FindHotkey=[FALSE]
    $Array=split string: $Value separator=':'
    $Size=size of array $Array
    if$Size > 1
      $SelectedID=$Array[0]
      $Page=$Array[1]
      $Page=string $Page to integer
      $ID=$Array[2]
      $ID=string $ID to integer
      $Array=read text: page=$Page id=$ID
      $Array=split string: $Array separator='|'
      $ArraySize=size of array $Array
      while$ArraySize
        dec $ArraySize=
        $HotKeyData=$Array[$ArraySize]
        $HotKeyData=split string: $HotKeyData separator=':'
        iffind $SelectedID in array: $HotKeyData
          $HotKeyText=$HotKeyData[4]
          $HotKeyText=string $HotKeyText to integer
          $Text=read text: page=[Page.Menus] id=$HotKeyText
          $TMenu['HotKeyInfo'] = $Text
          $FindHotkey=[TRUE]
          break
        end
      end
    end
    
    $Array=split string: $Value separator=';'
    $Size=size of array $Array
    if$Size > 1
      $TextID=$Array[1]
      $TextID=string $TextID to integer
      $TMenu['HotKeyInfo'] = $TextID
      $FindHotkey=[TRUE]
    end
    
    if$Value == 'dsrc.Argon.BBS' OR $Value == 'dsrc.Teladi.BBS' OR $Value == 'dsrc.Goner.BBS'
      $TMenu['HotKeyInfo'] = $Value
      $FindHotkey=[TRUE]
    end
    
    skip if$FindHotkey
      $TMenu['HotKeyInfo'] = null
    
    $Input=create input return value: update menu=$Menu
    return $Input
    
  else if$AState == [MEvent.Hotkey]
    $MenuID=$AValue[0]
    $SelectedID=$AValue[1]
    $Value=$AValue[2]
    if$SelectedID == 'RunHotKey'
      $Array=split string: $Value separator=':'
      $HID=$Array[0]
      $HPageID=$Array[1]
      $HPageID=string $HPageID to integer
      $HTextID=$Array[2]
      $HTextID=string $HTextID to integer
      $Text=read text: page=$HPageID id=$HTextID
      $Array=split string: $Text separator='|'
      $Size=size of array $Array
      while$Size
        dec $Size=
        $Items=$Array[$Size]
        $IArray=split string: $Items separator=':'
        $Item=$IArray[0]
        if$Item == $HID
          $Script=$IArray[1]
          ifdoes script name exist: $Script
            $Text=read text: page=2410 id=800
            $AllowScripts=split string: $Text separator='|'
            do iffind $Script in array: $AllowScripts
              =null -> call named script: script=$Script, null, null, null, null, null
          end
        end
      end
      
      gosub sub.BuildMenu
      return $Menu
    end
    
  else if$AState == [MEvent.Returned]
    $CurrentMenuID=$AValue[0]
    $PreviousMenuID=$AValue[1]
    $Value=$AValue[2]
    if$CurrentMenuID == 'ComboMainMenu'
      if$PreviousMenuID == 'EI.AddAsteroid.Menu'
        ifis datatype[ $Value ] == DATATYPE_OBJECT
          $TAsteroids=$TEISettings['Combo.EI.AllowedAsteroids']
          $Sector=$Value -> get sector
          $AsteroidsArray=$TAsteroids[$Sector]
          if notis datatype[ $AsteroidsArray ] == DATATYPE_ARRAY
            $AsteroidsArray=array alloc: size=0
            $TAsteroids[$Sector] = $AsteroidsArray
          end
          
          skip iffind $Value in array: $AsteroidsArray
            append $Value to array $AsteroidsArray
        end
        
        gosub sub.BuildMenu
        return $Menu
        
      else if$PreviousMenuID == 'EI.RemoveAsteroid.Menu'
        $RAsteroids=$TEISettings['Combo.EI.RemoveAsteroids']
        $TAsteroids=$TEISettings['Combo.EI.AllowedAsteroids']
        $Sectors=get keys: table=$TAsteroids
        $SectorsSize=size of array $Sectors
        while$SectorsSize
          dec $SectorsSize=
          $Sector=$Sectors[$SectorsSize]
          $AsteroidsArray=$TAsteroids[$Sector]
          $AsteroidsArraySize=size of array $AsteroidsArray
          while$AsteroidsArraySize
            dec $AsteroidsArraySize=
            $Asteroid=$AsteroidsArray[$AsteroidsArraySize]
            do iffind $Asteroid in array: $RAsteroids
              remove element from array $AsteroidsArray at index $AsteroidsArraySize
          end
          
          $AsteroidsArray=$TAsteroids[$Sector]
          skip ifsize of array $AsteroidsArray
            remove key $Sector from table $TAsteroids
        end
        
        resize array $RAsteroids to 0
        gosub sub.BuildMenu
        return $Menu
      end
    end
    
  else if$AState == [MEvent.Finished]
    $TMenu['HotKeyInfo'] = null
    $TMain=get global variable: name='Combo.Military'
    $TMenu=$TMain['MLCCMenuSettings']
    $Command=$TMenu['MLCC.Main.Menu.Command']
    if$Command == 'Intercept'
@     STARTnull -> call script dsrc.MLCC.Intercept : 
    else if$Command == 'Retreat'
@     STARTnull -> call script dsrc.MLCC.Retreat : 
    else if$Command == 'Restock'
@     STARTnull -> call script dsrc.MLCC.Restock : 
    end
    
    $TMenu['MLCC.Main.Menu.Command'] = null
  end
  return null
  
  
  sub.BuildMenu:
  $Menu=create custom menu array
  set menu option: $Menu, icon=[Icon.Property]
  set menu option: $Menu, widthtype=[MenuWidth.Huge]
  set menu option: $Menu, remove main header=[TRUE]
  set menu option: $Menu, global hotkey=[Key.Identity], id='RunHotKey'
  set menu option: $Menu, override infoline size=8
  $MenuHeight=$MenuHeight + 8
  $Text=read text: page=[Page.Menus] id=2410003
  add tab to menu: $Menu, text=$Text
  $Tab=$TMenu['TabMenu']
  if$Tab == 0
    $TUISettings=$TMain['UISettings']
    $Text=read text: page=[Page.Menus] id=2410008
    add info line heading to menu: $Menu, heading=$Text
    $ModName=read text: page=2410 id=2002
    $Text=create text for custom menu, left='', right=$ModName
    add custom menu info line to array $Menu: text=$Text
    $MenuName=read text: page=[Page.Menus] id=2410009
    $MenuVersion=$TMain['Combo.MainScriptVersion']
    $Text=sprintf: fmt='%s v%s', $MenuName, $MenuVersion, null, null, null
    $Text=create text for custom menu, left='', right=$Text
    add custom menu info line to array $Menu: text=$Text
    $Text=read text: page=[Page.Menus] id=2410003
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $Text=read text: page=2410 id=6
    $Values.YesNo=split string: $Text separator='|'
    $Text=read text: page=2410 id=7
    $Values.UIColors=split string: $Text separator='|'
    $Text=read text: page=2410 id=8
    $Values.UITransparency=split string: $Text separator='|'
    $Default=$TUISettings['Combo.UI.Colour']
    $Text=read text: page=[Page.Menus] id=2410010
    add value selection to menu: $Menu, text=$Text, value array=$Values.YesNo, default=$Default, return id='Combo.UI.Colour', width=null allowtabs=[TRUE]
    inc $MenuHeight=
    if$Default
      add section to custom menu: $Menu
      inc $MenuHeight=
      $Default=$TUISettings['Combo.UI.ColourScheme']
      $Text=read text: page=[Page.Menus] id=2410011
      add value selection to menu: $Menu, text=$Text, value array=$Values.UIColors, default=$Default, return id='Combo.UI.ColourScheme', width=null allowtabs=[TRUE]
      inc $MenuHeight=
      add section to custom menu: $Menu
      inc $MenuHeight=
      $Default=$TUISettings['Combo.UI.HeadingTitle']
      $Text=read text: page=[Page.Menus] id=2410012
      add value selection to menu: $Menu, text=$Text, value array=$Values.UIColors, default=$Default, return id='Combo.UI.HeadingTitle', width=null allowtabs=[TRUE]
      inc $MenuHeight=
      add section to custom menu: $Menu
      inc $MenuHeight=
      $Default=$TUISettings['Combo.UI.SectorMap']
      $Text=read text: page=[Page.Menus] id=2410013
      add value selection to menu: $Menu, text=$Text, value array=$Values.UIColors, default=$Default, return id='Combo.UI.SectorMap', width=null allowtabs=[TRUE]
      inc $MenuHeight=
      $Default=$TUISettings['Combo.UI.SectorMapT']
      $Text=read text: page=[Page.Menus] id=2410014
      add value selection to menu: $Menu, text=$Text, value array=$Values.UITransparency, default=$Default, return id='Combo.UI.SectorMapT', width=null allowtabs=[TRUE]
      inc $MenuHeight=
      add section to custom menu: $Menu
      inc $MenuHeight=
      $Default=$TUISettings['Combo.UI.GalaxyMap']
      $Text=read text: page=[Page.Menus] id=2410015
      add value selection to menu: $Menu, text=$Text, value array=$Values.UIColors, default=$Default, return id='Combo.UI.GalaxyMap', width=null allowtabs=[TRUE]
      inc $MenuHeight=
      $Default=$TUISettings['Combo.UI.GalaxyMapT']
      $Text=read text: page=[Page.Menus] id=2410014
      add value selection to menu: $Menu, text=$Text, value array=$Values.UITransparency, default=$Default, return id='Combo.UI.GalaxyMapT', width=null allowtabs=[TRUE]
      inc $MenuHeight=
      add section to custom menu: $Menu
      inc $MenuHeight=
      $Default=$TUISettings['Combo.UI.RemoveSB']
      $Text=read text: page=[Page.Menus] id=2410085
      add value selection to menu: $Menu, text=$Text, value array=$Values.YesNo, default=$Default, return id='Combo.UI.RemoveSB', width=null allowtabs=[TRUE]
      inc $MenuHeight=
    end
  end
  
  $Text=read text: page=[Page.Menus] id=2410004
  add tab to menu: $Menu, text=$Text
  if$Tab == 1
    $Text=read text: page=2410 id=14
    $Values.ColourNames=split string: $Text separator='|'
    $TCMSettings=$TMain['CMSettings']
    $Text=read text: page=[Page.Menus] id=2410008
    add info line heading to menu: $Menu, heading=$Text
    $ModName=read text: page=2410 id=2002
    $Text=create text for custom menu, left='', right=$ModName
    add custom menu info line to array $Menu: text=$Text
    $MenuName=read text: page=[Page.Menus] id=2410016
    $MenuVersion=$TMain['Combo.MainScriptVersion']
    $Text=sprintf: fmt='%s v%s', $MenuName, $MenuVersion, null, null, null
    $Text=create text for custom menu, left='', right=$Text
    add custom menu info line to array $Menu: text=$Text
    $Text=read text: page=[Page.Menus] id=2410004
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $Text=read text: page=2410 id=6
    $Values.YesNo=split string: $Text separator='|'
    $Default=$TCMSettings['Combo.CM.ColourMap']
    $Text=read text: page=[Page.Menus] id=2410017
    add value selection to menu: $Menu, text=$Text, value array=$Values.YesNo, default=$Default, return id='Combo.CM.ColourMap', width=null allowtabs=[TRUE]
    inc $MenuHeight=
    if$Default
      add non selectable menu item: $Menu, text=''
      inc $MenuHeight=
      $Races=get race array
      $Races=sort array $Races
      $Races=reverse array $Races
      $Size=size of array $Races
      while$Size
        dec $Size=
        $Race=$Races[$Size]
        $Default=$TCMSettings[$Race]
        $RaceString=sprintf: fmt='%s', $Race, null, null, null, null
        add value selection to menu: $Menu, text=$RaceString, value array=$Values.ColourNames, default=$Default, return id=$RaceString, width=null allowtabs=[TRUE]
        inc $MenuHeight=
      end
      
      add non selectable menu item: $Menu, text=''
      inc $MenuHeight=
      $Text=read text: page=[Page.Menus] id=2410018
      $Resset=create new array, arguments=$Text, $Text, null, null, null
      $Default=$TCMSettings['Combo.CM.Default']
      $Text=read text: page=[Page.Menus] id=2410019
      add value selection to menu: $Menu, text=$Text, value array=$Resset, default=$Default, return id='Combo.CM.Default', width=null allowtabs=[TRUE]
      inc $MenuHeight=
    end
    
    $Text=read text: page=[Page.Menus] id=2410058
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410076
    $ValueArray=read text: page=[Page.Menus] id=2410078
    $ValueArray=split string: $ValueArray separator='|'
    $Default=$TMain['Combo.ExtMapUpdate']
    add value selection to menu: $Menu, text=$Text, value array=$ValueArray, default=$Default, return id='Combo.ExtMapUpdate', width=null allowtabs=[TRUE]
    inc $MenuHeight=
    if$Default
      $Text=read text: page=[Page.Menus] id=2410059
      $ValueArray=read text: page=[Page.Menus] id=2410070
      $ValueArray=split string: $ValueArray separator='|'
      $Default=$TMain['Combo.ExtMapUpdateTimer']
      add value selection to menu: $Menu, text=$Text, value array=$ValueArray, default=$Default, return id='Combo.ExtMapUpdateTimer', width=null allowtabs=[TRUE]
      inc $MenuHeight=
    end
    
    add section to custom menu: $Menu
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410074
    $Width=get menu width: widthtype=[MenuWidth.Huge]
    $Position=$Width / 2
    $Len=get length of string $Text
    $Lang=get current text language ID
    do if$Lang == 7
      $Len=$Len * 2
    
    $Position=$Position - $Len
    $TextColumns=array alloc: size=0
    if$TMain['Combo.ExtMapUpdateRun']
      $TextCol=create custom menu column string, position=$Position length=null right=[FALSE] colour=[MenuColour.Disabled] text=$Text
      append $TextCol to array $TextColumns
      add non selectable menu item: $Menu, text=$TextColumns
    else
      $TextCol=create custom menu column string, position=$Position length=null right=[FALSE] colour=[MenuColour.Green] text=$Text
      append $TextCol to array $TextColumns
      $Return=create menu return value: callback, value='EGMUpdateRun'
      add custom menu item to array $Menu: text=$TextColumns returnvalue=$Return
    end
    
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410088
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410089
    $TextColumns=array alloc: size=0
    $TextCol=create custom menu column string, position=1 length=null right=[FALSE] colour=[MenuColour.White] text=$Text
    append $TextCol to array $TextColumns
    $Return=create menu return value: callback, value='FindShip'
    add custom menu item to array $Menu: text=$TextColumns returnvalue=$Return
    inc $MenuHeight=
  end
  
  $Text=read text: page=[Page.Menus] id=2410005
  add tab to menu: $Menu, text=$Text
  $MenuHeightInfo=2
  if$Tab == 2
    $TEISettings=$TMain['EISettings']
    $TAsteroids=$TEISettings['Combo.EI.AllowedAsteroids']
    $Sectors=get keys: table=$TAsteroids
    $SectorsSize=size of array $Sectors
    $Text=read text: page=[Page.Menus] id=2410008
    add info line heading to menu: $Menu, heading=$Text
    inc $MenuHeightInfo=
    inc $MenuHeightInfo=
    $ModName=read text: page=2410 id=2002
    $Text=create text for custom menu, left='', right=$ModName
    add custom menu info line to array $Menu: text=$Text
    inc $MenuHeightInfo=
    inc $MenuHeightInfo=
    $MenuName=read text: page=[Page.Menus] id=2410020
    $MenuVersion=$TMain['Combo.MainScriptVersion']
    $Text=sprintf: fmt='%s v%s', $MenuName, $MenuVersion, null, null, null
    $Text=create text for custom menu, left='', right=$Text
    add custom menu info line to array $Menu: text=$Text
    inc $MenuHeightInfo=
    inc $MenuHeightInfo=
    $Text=read text: page=[Page.Menus] id=2410021
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $Text=read text: page=2410 id=6
    $Values.YesNo=split string: $Text separator='|'
    $Text=read text: page=[Page.Menus] id=2410022
    $Default=$TEISettings['Combo.EI.DisallowAbandonedExport']
    add value selection to menu: $Menu, text=$Text, value array=$Values.YesNo, default=$Default, return id='Combo.EI.DisallowAbandonedExport', width=null allowtabs=[TRUE]
    inc $MenuHeight=
    add section to custom menu: $Menu
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410023
    $Default=$TEISettings['Combo.EI.DisallowAsteroidExport']
    add value selection to menu: $Menu, text=$Text, value array=$Values.YesNo, default=$Default, return id='Combo.EI.DisallowAsteroidExport', width=null allowtabs=[TRUE]
    inc $MenuHeight=
    if$Default
      $Text=read text: page=[Page.Menus] id=2410024
      add custom menu item to array $Menu: text=$Text nextinput='AddAsteroid' value=null
      inc $MenuHeight=
      if$SectorsSize
        $Text=read text: page=[Page.Menus] id=2410025
        add custom menu item to array $Menu: text=$Text nextinput='RemoveAsteroid' value=null
        inc $MenuHeight=
      end
    end
    
    add section to custom menu: $Menu
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410026
    $TextColumns=array alloc: size=0
    $TextCol=create custom menu column string, position=340 length=0 right=[FALSE] colour=null text=$Text
    append $TextCol to array $TextColumns
    $Return=create menu return value: callback, value='Export'
    add custom menu item to array $Menu: text=$TextColumns returnvalue=$Return
    inc $MenuHeight=
    $Info=[FALSE]
    $Sectors=sort array $Sectors
    $Sectors=reverse array $Sectors
    do if$SectorsSize >= 5
      $MenuHeight=$MenuHeight + 3
    
    while$SectorsSize
      dec $SectorsSize=
      $Sector=$Sectors[$SectorsSize]
      $AsteroidsArray=$TAsteroids[$Sector]
      $AsteroidsArraySize=size of array $AsteroidsArray
      skip if$AsteroidsArraySize
        continue
      
      $Text=sprintf: fmt='%s', $Sector, null, null, null, null
      add info line heading to menu: $Menu, heading=$Text
      inc $MenuHeightInfo=
      inc $MenuHeightInfo=
      inc $MenuHeight=
      inc $MenuHeight=
      while$AsteroidsArraySize
        dec $AsteroidsArraySize=
        $Asteroid=$AsteroidsArray[$AsteroidsArraySize]
        $TextColumns=array alloc: size=0
        $Icon=$Asteroid ->create custom menu string object icon
        $TextCol=create custom menu column string, position=1 length=0 right=[FALSE] colour=null text=$Icon
        append $TextCol to array $TextColumns
        $TextCol=create custom menu column string, position=18 length=0 right=[FALSE] colour=null text=$Asteroid
        append $TextCol to array $TextColumns
        if$Asteroid -> is asteroid scanned
          $Mineral=$Asteroid -> get resource waretype of asteroid
          $Yield=$Asteroid -> get asteroid yield
          $Text=sprintf: pageid=[Page.Menus] textid=2410027, $Mineral, $Yield, null, null, null
          $TextCol=create custom menu column string, position=-1 length=0 right=[FALSE] colour=null text=$Text
          append $TextCol to array $TextColumns
        end
        
        add custom menu info line to array $Menu: text=$TextColumns
        inc $MenuHeight=
        inc $MenuHeightInfo=
        $Info=[TRUE]
      end
    end
    
    $Text=read text: page=2410 id=3
    $Values.OffOn=split string: $Text separator='|'
    $Text=read text: page=[Page.Menus] id=2410029
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410030
    $Default=$TEISettings['Combo.EI.DebugImport']
    add value selection to menu: $Menu, text=$Text, value array=$Values.OffOn, default=$Default, return id='Combo.EI.DebugImport', width=null allowtabs=[TRUE]
    inc $MenuHeight=
    add section to custom menu: $Menu
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410031
    $TextColumns=array alloc: size=0
    $TextCol=create custom menu column string, position=340 length=0 right=[FALSE] colour=null text=$Text
    append $TextCol to array $TextColumns
    $Return=create menu return value: callback, value='Import'
    add custom menu item to array $Menu: text=$TextColumns returnvalue=$Return
    inc $MenuHeight=
    set menu option: $Menu, override infoline size=$MenuHeightInfo
  end
  
  $Text=read text: page=[Page.Menus] id=2410006
  add tab to menu: $Menu, text=$Text
  if$Tab == 3
    $Text=read text: page=[Page.Menus] id=2410008
    add info line heading to menu: $Menu, heading=$Text
    $ModName=read text: page=2410 id=2002
    $Text=create text for custom menu, left='', right=$ModName
    add custom menu info line to array $Menu: text=$Text
    $MenuVersion=$TMain['Combo.MainScriptVersion']
    $Text=sprintf: fmt='v%s', $MenuVersion, null, null, null, null
    $Text=sprintf: pageid=2410 textid=5, $Text, null, null, null, null
    $Text=create text for custom menu, left='', right=$Text
    add custom menu info line to array $Menu: text=$Text
    $TextID=$TMenu['HotKeyInfo']
    if notis datatype[ $TextID ] == DATATYPE_NULL
      add info line section to menu: $Menu
      add custom menu hyperlinked info: menu=$Menu, page id=[Page.Menus], text id=$TextID
    end
    
    $Text=read text: page=[Page.Menus] id=2410050
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410043
    $Open=$TMenu['MilitaryGroup']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='MilitaryGroup', indent=20
    inc $MenuHeight=
    $PluginsCount=read text: page=2413 id=100
    $PluginsCount=string $PluginsCount to integer
    if$PluginsCount > 0
      $EndCount=100 + $PluginsCount
      $PluginsArray=read text: page id=2413, from 101 to $EndCount to array, include empty=[FALSE]
      $PluginsArray=reverse array $PluginsArray
      $Size=size of array $PluginsArray
      while$Size
        dec $Size=
        $PluginText=$PluginsArray[$Size]
        $PluginText=split string: $PluginText separator='|'
        $Plugin=$PluginText[0]
        $Text=$PluginText[1]
        $Return=create menu return value: callback, value=$Plugin
        add custom menu item to array $Menu: text=$Text returnvalue=$Return
        do if$Open
          inc $MenuHeight=
      end
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
      
    else
      $Text=read text: page=[Page.Menus] id=2410051
      add non selectable menu item: $Menu, text=$Text
      do if$Open
        inc $MenuHeight=
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
    end
    
    add end grouping to menu: $Menu
  * ==========================================================================
    $Text=read text: page=[Page.Menus] id=2410044
    $Open=$TMenu['EconomicGroup']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='EconomicGroup', indent=20
    inc $MenuHeight=
    $PluginsCount=read text: page=2416 id=100
    $PluginsCount=string $PluginsCount to integer
    if$PluginsCount > 0
      $EndCount=100 + $PluginsCount
      $PluginsArray=read text: page id=2416, from 101 to $EndCount to array, include empty=[FALSE]
      $PluginsArray=reverse array $PluginsArray
      $Size=size of array $PluginsArray
      while$Size
        dec $Size=
        $PluginText=$PluginsArray[$Size]
        $PluginText=split string: $PluginText separator='|'
        $Plugin=$PluginText[0]
        $Text=$PluginText[1]
        $Return=create menu return value: callback, value=$Plugin
        add custom menu item to array $Menu: text=$Text returnvalue=$Return
        do if$Open
          inc $MenuHeight=
      end
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
      
    else
      $Text=read text: page=[Page.Menus] id=2410051
      add non selectable menu item: $Menu, text=$Text
      do if$Open
        inc $MenuHeight=
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
    end
    
    add end grouping to menu: $Menu
  * ==========================================================================
    $Text=read text: page=[Page.Menus] id=2410045
    $Open=$TMenu['NavigationGroup']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='NavigationGroup', indent=20
    inc $MenuHeight=
    $PluginsCount=read text: page=2411 id=100
    $PluginsCount=string $PluginsCount to integer
    if$PluginsCount > 0
      $EndCount=100 + $PluginsCount
      $PluginsArray=read text: page id=2411, from 101 to $EndCount to array, include empty=[FALSE]
      $PluginsArray=reverse array $PluginsArray
      $Size=size of array $PluginsArray
      while$Size
        dec $Size=
        $PluginText=$PluginsArray[$Size]
        $PluginText=split string: $PluginText separator='|'
        $Plugin=$PluginText[0]
        $Text=$PluginText[1]
        $Return=create menu return value: callback, value=$Plugin
        add custom menu item to array $Menu: text=$Text returnvalue=$Return
        do if$Open
          inc $MenuHeight=
      end
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
      
    else
      $Text=read text: page=[Page.Menus] id=2410051
      add non selectable menu item: $Menu, text=$Text
      do if$Open
        inc $MenuHeight=
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
    end
    
    add end grouping to menu: $Menu
  * ==========================================================================
    $Text=read text: page=[Page.Menus] id=2410046
    $Open=$TMenu['ManufacturingGroup']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='ManufacturingGroup', indent=20
    inc $MenuHeight=
    $PluginsCount=read text: page=2414 id=100
    $PluginsCount=string $PluginsCount to integer
    if$PluginsCount > 0
      $EndCount=100 + $PluginsCount
      $PluginsArray=read text: page id=2414, from 101 to $EndCount to array, include empty=[FALSE]
      $PluginsArray=reverse array $PluginsArray
      $Size=size of array $PluginsArray
      while$Size
        dec $Size=
        $PluginText=$PluginsArray[$Size]
        $PluginText=split string: $PluginText separator='|'
        $Plugin=$PluginText[0]
        $Text=$PluginText[1]
        $Return=create menu return value: callback, value=$Plugin
        add custom menu item to array $Menu: text=$Text returnvalue=$Return
        do if$Open
          inc $MenuHeight=
      end
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
      
    else
      $Text=read text: page=[Page.Menus] id=2410051
      add non selectable menu item: $Menu, text=$Text
      do if$Open
        inc $MenuHeight=
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
    end
    
    add end grouping to menu: $Menu
  * ==========================================================================
    $Text=read text: page=[Page.Menus] id=2410047
    $Open=$TMenu['PirateGroup']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='PirateGroup', indent=20
    inc $MenuHeight=
    $PluginsCount=read text: page=2415 id=100
    $PluginsCount=string $PluginsCount to integer
    if$PluginsCount > 0
      $EndCount=100 + $PluginsCount
      $PluginsArray=read text: page id=2415, from 101 to $EndCount to array, include empty=[FALSE]
      $PluginsArray=reverse array $PluginsArray
      $Size=size of array $PluginsArray
      while$Size
        dec $Size=
        $PluginText=$PluginsArray[$Size]
        $PluginText=split string: $PluginText separator='|'
        $Plugin=$PluginText[0]
        $Text=$PluginText[1]
        $Return=create menu return value: callback, value=$Plugin
        add custom menu item to array $Menu: text=$Text returnvalue=$Return
        do if$Open
          inc $MenuHeight=
      end
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
      
    else
      $Text=read text: page=[Page.Menus] id=2410051
      add non selectable menu item: $Menu, text=$Text
      do if$Open
        inc $MenuHeight=
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
    end
    
    add end grouping to menu: $Menu
  * ==========================================================================
    $Text=read text: page=[Page.Menus] id=2410048
    $Open=$TMenu['ArtificialLifeGroup']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='ArtificialLifeGroup', indent=20
    inc $MenuHeight=
    $PluginsCount=read text: page=2412 id=100
    $PluginsCount=string $PluginsCount to integer
    if$PluginsCount > 0
      $EndCount=100 + $PluginsCount
      $PluginsArray=read text: page id=2412, from 101 to $EndCount to array, include empty=[FALSE]
      $PluginsArray=reverse array $PluginsArray
      $Size=size of array $PluginsArray
      while$Size
        dec $Size=
        $PluginText=$PluginsArray[$Size]
        $PluginText=split string: $PluginText separator='|'
        $Plugin=$PluginText[0]
        $Text=$PluginText[1]
        $Return=create menu return value: callback, value=$Plugin
        add custom menu item to array $Menu: text=$Text returnvalue=$Return
        do if$Open
          inc $MenuHeight=
      end
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
      
    else
      $Text=read text: page=[Page.Menus] id=2410051
      add non selectable menu item: $Menu, text=$Text
      do if$Open
        inc $MenuHeight=
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
    end
    
    add end grouping to menu: $Menu
  * ==========================================================================
    $Text=read text: page=[Page.Menus] id=2410049
    $Open=$TMenu['StoryLinesGroup']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='StoryLinesGroup', indent=20
    inc $MenuHeight=
    $PluginsCount=read text: page=2417 id=100
    $PluginsCount=string $PluginsCount to integer
    if$PluginsCount > 0
      $EndCount=100 + $PluginsCount
      $PluginsArray=read text: page id=2417, from 101 to $EndCount to array, include empty=[FALSE]
      $PluginsArray=reverse array $PluginsArray
      $Size=size of array $PluginsArray
      while$Size
        dec $Size=
        $PluginText=$PluginsArray[$Size]
        $PluginText=split string: $PluginText separator='|'
        $Plugin=$PluginText[0]
        $Text=$PluginText[1]
        $Return=create menu return value: callback, value=$Plugin
        add custom menu item to array $Menu: text=$Text returnvalue=$Return
        do if$Open
          inc $MenuHeight=
      end
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
      
    else
      $Text=read text: page=[Page.Menus] id=2410051
      add non selectable menu item: $Menu, text=$Text
      do if$Open
        inc $MenuHeight=
      
      add non selectable menu item: $Menu, text=''
      do if$Open
        inc $MenuHeight=
    end
    
    add end grouping to menu: $Menu
  end
  
  $Text=read text: page=[Page.Menus] id=2410007
  add tab to menu: $Menu, text=$Text
  if$Tab == 4
    set menu option: $Menu, override infoline size=12
    $MenuHeight=$MenuHeight + 6
    $TMenu=$TMain['MainMenuSettings']
    $Text=read text: page=2410 id=6
    $Values.YesNo=split string: $Text separator='|'
    $Text=read text: page=2410 id=3
    $Values.OffOn=split string: $Text separator='|'
    $Text=read text: page=[Page.Menus] id=2410008
    add info line heading to menu: $Menu, heading=$Text
    $ModName=read text: page=2410 id=2002
    $Text=create text for custom menu, left='', right=$ModName
    add custom menu info line to array $Menu: text=$Text
    $MenuVersion=$TMain['Combo.MainScriptVersion']
    $Text=sprintf: fmt='v%s', $MenuVersion, null, null, null, null
    $Text=sprintf: pageid=2410 textid=5, $Text, null, null, null, null
    $Text=create text for custom menu, left='', right=$Text
    add custom menu info line to array $Menu: text=$Text
    $TextInfo=$TMenu['HotKeyInfo']
    if notis datatype[ $TextInfo ] == DATATYPE_NULL
      if$TextInfo == 'dsrc.Argon.BBS' OR $TextInfo == 'dsrc.Teladi.BBS' OR $TextInfo == 'dsrc.Goner.BBS'
        $TMainECS=get global variable: name='Combo.Storylines'
        $ECSSetup=$TMainECS['ESC.Setup']
        $ECSConfigs=$ECSSetup[2]
        $ECSConfigs=sort array $ECSConfigs
        $ECSConfigs=reverse array $ECSConfigs
        $ECSConfigsSize=size of array $ECSConfigs
        while$ECSConfigsSize
          dec $ECSConfigsSize=
          $Config=$ECSConfigs[$ECSConfigsSize]
          $Text=$Config[0]
          do if$Text == $TextInfo
            break
        end
        
        add info line section to menu: $Menu
        $TextColumns=array alloc: size=2
        $Text=read text: page=[Page.Menus] id=2410063
        $TextCol=create custom menu column string, position=1 length=null right=[FALSE] colour=[MenuColour.White] text=$Text
        $TextColumns[0] = $TextCol
        $Text=$Config[0]
        skip if$Text
          $Text=read text: page=[Page.Menus] id=2410051
        
        $TextCol=create custom menu column string, position=200 length=null right=[FALSE] colour=[MenuColour.Green] text=$Text
        $TextColumns[1] = $TextCol
        add custom menu info line to array $Menu: text=$TextColumns
        $TextColumns=array alloc: size=2
        $Text=read text: page=[Page.Menus] id=2410064
        $TextCol=create custom menu column string, position=1 length=null right=[FALSE] colour=[MenuColour.White] text=$Text
        $TextColumns[0] = $TextCol
        $Text=$Config[1]
        skip if$Text
          $Text=read text: page=[Page.Menus] id=2410051
        
        $TextCol=create custom menu column string, position=200 length=null right=[FALSE] colour=[MenuColour.Green] text=$Text
        $TextColumns[1] = $TextCol
        add custom menu info line to array $Menu: text=$TextColumns
        $TextColumns=array alloc: size=2
        $Text=read text: page=[Page.Menus] id=2410065
        $TextCol=create custom menu column string, position=1 length=null right=[FALSE] colour=[MenuColour.White] text=$Text
        $TextColumns[0] = $TextCol
        $Text=$Config[2]
        skip if$Text
          $Text=read text: page=[Page.Menus] id=2410051
        
        $TextCol=create custom menu column string, position=200 length=null right=[FALSE] colour=[MenuColour.Green] text=$Text
        $TextColumns[1] = $TextCol
        add custom menu info line to array $Menu: text=$TextColumns
        $TextColumns=array alloc: size=2
        $Text=read text: page=[Page.Menus] id=2410066
        $TextCol=create custom menu column string, position=1 length=null right=[FALSE] colour=[MenuColour.White] text=$Text
        $TextColumns[0] = $TextCol
        $Text=$Config[3]
        skip if$Text
          $Text=read text: page=[Page.Menus] id=2410051
        
        $TextCol=create custom menu column string, position=200 length=null right=[FALSE] colour=[MenuColour.Green] text=$Text
        $TextColumns[1] = $TextCol
        add custom menu info line to array $Menu: text=$TextColumns
        $TextColumns=array alloc: size=2
        $Text=read text: page=[Page.Menus] id=2410067
        $TextCol=create custom menu column string, position=1 length=null right=[FALSE] colour=[MenuColour.White] text=$Text
        $TextColumns[0] = $TextCol
        $Text=$Config[4]
        skip if$Text
          $Text=read text: page=[Page.Menus] id=2410051
        
        $TextCol=create custom menu column string, position=200 length=null right=[FALSE] colour=[MenuColour.Green] text=$Text
        $TextColumns[1] = $TextCol
        add custom menu info line to array $Menu: text=$TextColumns
        $TextColumns=array alloc: size=2
        $Text=read text: page=[Page.Menus] id=2410068
        $TextCol=create custom menu column string, position=1 length=null right=[FALSE] colour=[MenuColour.White] text=$Text
        $TextColumns[0] = $TextCol
        $Text=$Config[5]
        skip if$Text
          $Text=read text: page=[Page.Menus] id=2410051
        
        $TextCol=create custom menu column string, position=200 length=null right=[FALSE] colour=[MenuColour.Green] text=$Text
        $TextColumns[1] = $TextCol
        add custom menu info line to array $Menu: text=$TextColumns
      else
        add info line section to menu: $Menu
        add custom menu info line to array $Menu: text=$TextInfo
      end
    end
    
    $Text=read text: page=[Page.Menus] id=2410032
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $HotkeyArray=create new array, arguments=[TRUE], 2410, 50, null, null
    gosub sub.HotKeyAdd
    
    add non selectable menu item: $Menu, text=''
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410043
    $Open=$TMenu['MilitaryGroup.HotKeys']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='MilitaryGroup.HotKeys', indent=20
    inc $MenuHeight=
    if$Open
      $Text=read text: page=[Page.Menus] id=2410053
      $OpenGroup=$TMenu['MilitaryGroup.SSDNHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='MilitaryGroup.SSDNHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 9911, 500, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410055
      $OpenGroup=$TMenu['MilitaryGroup.MLCCHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='MilitaryGroup.MLCCHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 8072, 2000, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410114
      $OpenGroup=$TMenu['MilitaryGroup.BombardierHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='MilitaryGroup.BombardierHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 8796, 100, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
    end
    
    add end grouping to menu: $Menu
    $Text=read text: page=[Page.Menus] id=2410044
    $Open=$TMenu['EconomicGroup.HotKeys']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='EconomicGroup.HotKeys', indent=20
    inc $MenuHeight=
    if$Open
      $Text=read text: page=[Page.Menus] id=2410077
      $OpenGroup=$TMenu['EconomicGroup.UBHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='EconomicGroup.UBHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 9750, 100, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410106
      $OpenGroup=$TMenu['EconomicGroup.ProspektorHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='EconomicGroup.ProspektorHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 8006, 2000, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410107
      $OpenGroup=$TMenu['EconomicGroup.TravelServiceHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='EconomicGroup.TravelServiceHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 8032, 300, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410108
      $OpenGroup=$TMenu['EconomicGroup.EconomicsTraderHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='EconomicGroup.EconomicsTraderHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 8005, 4000, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410109
      $OpenGroup=$TMenu['EconomicGroup.ComAgentHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='EconomicGroup.ComAgentHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 8000, 300, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
    end
    
    add end grouping to menu: $Menu
    $Text=read text: page=[Page.Menus] id=2410045
    $Open=$TMenu['NavigationGroup.HotKeys']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='NavigationGroup.HotKeys', indent=20
    inc $MenuHeight=
    if$Open
      $Text=read text: page=[Page.Menus] id=2410071
      $OpenGroup=$TMenu['NavigationGroup.EPHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='NavigationGroup.EPHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 2411, 500, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410084
      $OpenGroup=$TMenu['NavigationGroup.SGBHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='NavigationGroup.SGBHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 241104, 100, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410052
      $OpenGroup=$TMenu['NavigationGroup.AdvNavHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='NavigationGroup.AdvNavHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 241101, 100, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410054
      $OpenGroup=$TMenu['NavigationGroup.AdvJumpHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='NavigationGroup.AdvJumpHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 241102, 100, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410056
      $OpenGroup=$TMenu['NavigationGroup.QuantumDriveHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='NavigationGroup.QuantumDriveHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 241100, 100, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410057
      $OpenGroup=$TMenu['NavigationGroup.TravelDriveHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='NavigationGroup.TravelDriveHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 8007, 200, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410102
      $OpenGroup=$TMenu['NavigationGroup.SLSHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='NavigationGroup.SLSHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 8026, 2000, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
    end
    
    add end grouping to menu: $Menu
    $Text=read text: page=[Page.Menus] id=2410046
    $Open=$TMenu['ManufacturingGroup.HotKeys']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='ManufacturingGroup.HotKeys', indent=20
    inc $MenuHeight=
    if$Open
      $Text=read text: page=[Page.Menus] id=2410072
      $OpenGroup=$TMenu['ManufacturingGroup.FDNHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='ManufacturingGroup.FDNHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 9910, 500, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410075
      $OpenGroup=$TMenu['ManufacturingGroup.BTHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='ManufacturingGroup.BTHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 2500, 100, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410101
      $OpenGroup=$TMenu['ManufacturingGroup.PMHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='ManufacturingGroup.PMHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 9913, 500, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
    end
    
    add end grouping to menu: $Menu
    $Text=read text: page=[Page.Menus] id=2410048
    $Open=$TMenu['ArtificialLifeGroup.HotKeys']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='ArtificialLifeGroup.HotKeys', indent=20
    inc $MenuHeight=
    if$Open
      $Text=read text: page=[Page.Menus] id=2410105
      $OpenGroup=$TMenu['ArtificialLifeGroup.PTHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='ArtificialLifeGroup.PTHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 8015, 100, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
      $Text=read text: page=[Page.Menus] id=2410111
      $OpenGroup=$TMenu['ArtificialLifeGroup.MPHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='ArtificialLifeGroup.MPHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 8010, 500, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
    end
    
    add end grouping to menu: $Menu
    $Text=read text: page=[Page.Menus] id=2410049
    $Open=$TMenu['StoryLinesGroup.HotKeys']
    add new grouping to menu: $Menu, text=$Text, open=$Open, id='StoryLinesGroup.HotKeys', indent=20
    inc $MenuHeight=
    if$Open
      $Text=read text: page=[Page.Menus] id=2410100
      $OpenGroup=$TMenu['StoryLinesGroup.DroidHotKeys']
      add new grouping to menu: $Menu, text=$Text, open=$OpenGroup, id='StoryLinesGroup.DroidHotKeys', indent=20
      inc $MenuHeight=
      $HotkeyArray=create new array, arguments=$OpenGroup, 5013, 2000, null, null
      gosub sub.HotKeyAdd
      
      add non selectable menu item: $Menu, text=''
      do if$OpenGroup
        inc $MenuHeight=
      
      add end grouping to menu: $Menu
    end
    
    add end grouping to menu: $Menu
    $Text=read text: page=[Page.Menus] id=2410035
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $Default=$TMenu['Combo.Bounce']
    $Text=read text: page=[Page.Menus] id=2410036
    add value selection to menu: $Menu, text=$Text, value array=$Values.OffOn, default=$Default, return id='Combo.Bounce', width=null allowtabs=[TRUE]
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410060
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    inc $MenuHeight=
    $TMainECS=get global variable: name='Combo.Storylines'
    $ECSSetup=$TMainECS['ESC.Setup']
    $ECSConfigs=$ECSSetup[2]
    $ECSConfigs=sort array $ECSConfigs
    $ECSConfigs=reverse array $ECSConfigs
    $ECSConfigsSize=size of array $ECSConfigs
    while$ECSConfigsSize
      dec $ECSConfigsSize=
      $TextColumns=array alloc: size=2
      $Config=$ECSConfigs[$ECSConfigsSize]
      $Text=$Config[6]
      $TextCol=create custom menu column string, position=1 length=null right=[FALSE] colour=[MenuColour.White] text=$Text
      $TextColumns[0] = $TextCol
      $Text=$Config[0]
      $Discovered=get global variable: name=$Text
      if$Discovered
        $Text=read text: page=[Page.Menus] id=2410062
        $TextCol=create custom menu column string, position=200 length=null right=[FALSE] colour=[MenuColour.Green] text=$Text
      else
        $Text=read text: page=[Page.Menus] id=2410061
        $TextCol=create custom menu column string, position=200 length=null right=[FALSE] colour=[MenuColour.Red] text=$Text
      end
      
      $TextColumns[1] = $TextCol
      $Value=$Config[0]
      $Return=create menu return value: callback, value=$Value
      add custom menu item to array $Menu: text=$TextColumns returnvalue=$Return
      inc $MenuHeight=
    end
    
    $Text=read text: page=[Page.Menus] id=2410086
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $Default=$TMain['Combo.QuickDialogues']
    $Text=read text: page=[Page.Menus] id=2410087
    add value selection to menu: $Menu, text=$Text, value array=$Values.OffOn, default=$Default, return id='Combo.QuickDialogues', width=null allowtabs=[TRUE]
    inc $MenuHeight=
    $Text=read text: page=[Page.Menus] id=2410103
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    $Default=$TMain['Combo.BasicSalaryReport']
    $Text=read text: page=[Page.Menus] id=2410104
    add value selection to menu: $Menu, text=$Text, value array=$Values.OffOn, default=$Default, return id='Combo.BasicSalaryReport', width=null allowtabs=[TRUE]
    inc $MenuHeight=
  end
  
  do if$Info
    $MenuHeight=$MenuHeight + 2
  
  $Callback=[Callback.Switch] | [Callback.TabChanged] | [Callback.Group] | [Callback.Selection]
  $Text=read text: page=[Page.Menus] id=2410002
  set menu option: $Menu, maximum menu height=$MenuHeight lines
  $Input=create input: id='ComboMainMenu', dynamic info menu=$Menu, title=$Text, description=' ', callback=$Callback, update=3000ms, maxoptions=20
  endsub
  return null
  
  sub.SetUIValue:
  $TUISettings=$TMain['UISettings']
  $UIArray=get global variable: name='Combo.UI.Colours'
  $UIIndex=$TUISettings['Combo.UI.SectorMapT']
  $Text=read text: page=2410 id=8
  $UITextArray=split string: $Text separator='|'
  $A=$UITextArray[$UIIndex]
  $A=string $A to integer
  $UIIndex=$TUISettings['Combo.UI.SectorMap']
  $Text=read text: page=2410 id=9
  $UIMainTextArray=split string: $Text separator='|'
  $UITextArray=$UIMainTextArray[$UIIndex]
  $UIText=split string: $UITextArray separator=':'
  $UI=$UIText[0]
  $RGB=split string: $UI separator=','
  $R=$RGB[0]
  $R=string $R to integer
  $G=$RGB[1]
  $G=string $G to integer
  $B=$RGB[2]
  $B=string $B to integer
  $ColourCode=get colour code: red=$R green=$G blue=$B transparency=$A
  $UIArray[0] = $ColourCode
  $UI=$UIText[1]
  $RGB=split string: $UI separator=','
  $R=$RGB[0]
  $R=string $R to integer
  $G=$RGB[1]
  $G=string $G to integer
  $B=$RGB[2]
  $B=string $B to integer
  $ColourCode=get colour code: red=$R green=$G blue=$B transparency=$A
  $UIArray[1] = $ColourCode
  $UIIndex=$TUISettings['Combo.UI.ColourScheme']
  $Text=read text: page=2410 id=10
  $UIMainTextArray=split string: $Text separator='|'
  $UIText=$UIMainTextArray[$UIIndex]
  $UIArray[2] = $UIText
  $UIIndex=$TUISettings['Combo.UI.HeadingTitle']
  $Text=read text: page=2410 id=11
  $UIMainTextArray=split string: $Text separator='|'
  $UITextArray=$UIMainTextArray[$UIIndex]
  $RGB=split string: $UITextArray separator=','
  $R=$RGB[0]
  $R=string $R to integer
  $G=$RGB[1]
  $G=string $G to integer
  $B=$RGB[2]
  $B=string $B to integer
  $ColourCode=get colour code: red=$R green=$G blue=$B transparency=1
  $UIArray[3] = $ColourCode
  $UIIndex=$TUISettings['Combo.UI.GalaxyMapT']
  $Text=read text: page=2410 id=8
  $UITextArray=split string: $Text separator='|'
  $A=$UITextArray[$UIIndex]
  $A=string $A to integer
  $UIIndex=$TUISettings['Combo.UI.GalaxyMap']
  $Text=read text: page=2410 id=12
  $UIMainTextArray=split string: $Text separator='|'
  $UIText=$UIMainTextArray[$UIIndex]
  $RGB=split string: $UIText separator=','
  $R=$RGB[0]
  $R=string $R to integer
  $G=$RGB[1]
  $G=string $G to integer
  $B=$RGB[2]
  $B=string $B to integer
  $ColourCode=get colour code: red=$R green=$G blue=$B transparency=$A
  $UIArray[4] = $ColourCode
  $Value=$TUISettings['Combo.UI.Colour']
  set global variable: name='Combo.UI.Colour' value=$Value
  skip if$Value
    $UIArray[2] = 'Standard'
  
  $Value=$TUISettings['Combo.UI.RemoveSB']
  set global variable: name='Combo.UI.RemoveSB' value=$Value
  if$SelectedID == 'Combo.UI.HeadingTitle'
@   STARTnull -> call script dsrc.Combo.RestartMenu : 
    do if is menu open
      kill menus
  end
  endsub
  return null
  
  sub.SetCMValue:
  $TCMSettings=$TMain['CMSettings']
  $Text=read text: page=2410 id=13
  $Values.ColourCodes=split string: $Text separator='|'
  $DCS=$TCMSettings['Combo.CM.ColourMap']
  set global variable: name='Combo.DCS' value=$DCS
  $XMax=get max sectors in x direction
  $YMax=get max sectors in y direction
  $X=0
  while$X <= $XMax
    $Y=0
    while$Y <= $YMax
      $Sector=get sector from universe index: x=$X, y=$Y
      if not$Sector -> exists
        inc $Y=
        continue
      end
      
      $Race=$Sector -> get owner race
      $Index=$TCMSettings[$Race]
      $ColourCode=$Values.ColourCodes[$Index]
      $ColourCode=string $ColourCode to integer
      if$DCS
        $Sector -> set sector colour: $ColourCode
      else
        $Sector -> set sector colour: null
      end
      
      inc $Y=
    end
    
    inc $X=
  end
  endsub
  return null
  
  sub.BuildAsteroidMenu:
  $Menu=create custom menu array
  set menu option: $Menu, icon=[Icon.Property]
  set menu option: $Menu, widthtype=[MenuWidth.Standard]
  set menu option: $Menu, remove main header=[TRUE]
  $TEISettings=$TMain['EISettings']
  $TAsteroids=$TEISettings['Combo.EI.AllowedAsteroids']
  $RAsteroids=$TEISettings['Combo.EI.RemoveAsteroids']
  $Text=read text: page=2410 id=6
  $Values.YesNo=split string: $Text separator='|'
  $Sectors=get keys: table=$TAsteroids
  $Sectors=sort array $Sectors
  $Sectors=reverse array $Sectors
  $SectorsSize=size of array $Sectors
  while$SectorsSize
    dec $SectorsSize=
    $Sector=$Sectors[$SectorsSize]
    $AsteroidsArray=$TAsteroids[$Sector]
    $AsteroidsArraySize=size of array $AsteroidsArray
    skip if$AsteroidsArraySize
      continue
    
    $Text=sprintf: fmt='%s', $Sector, null, null, null, null
    add custom menu heading to array $Menu: title=$Text
    inc $MenuHeight=
    inc $MenuHeight=
    while$AsteroidsArraySize
      dec $AsteroidsArraySize=
      $Asteroid=$AsteroidsArray[$AsteroidsArraySize]
      $TextColumns=array alloc: size=0
      $Icon=$Asteroid ->create custom menu string object icon
      $TextCol=create custom menu column string, position=1 length=0 right=[FALSE] colour=null text=$Icon
      append $TextCol to array $TextColumns
      $TextCol=create custom menu column string, position=18 length=0 right=[FALSE] colour=null text=$Asteroid
      append $TextCol to array $TextColumns
      if$Asteroid -> is asteroid scanned
        $Yield=$Asteroid -> get asteroid yield
        $Text=sprintf: fmt='[%s]', $Yield, null, null, null, null
        $TextCol=create custom menu column string, position=-120 length=0 right=[FALSE] colour=null text=$Text
        append $TextCol to array $TextColumns
      end
      
      $Serialis=$Asteroid -> serialise object
      $Default=find $Asteroid in array: $RAsteroids
      add value selection to menu: $Menu, text=$TextColumns, value array=$Values.YesNo, default=$Default, return id=$Serialis, width=null allowtabs=[TRUE]
      inc $MenuHeight=
    end
  end
  
  $Callback=[Callback.Switch] | [Callback.TabChanged]
  $Text=read text: page=[Page.Menus] id=2410005
  set menu option: $Menu, maximum menu height=$MenuHeight lines
  $Input=create input: id='EI.RemoveAsteroid.Menu', dynamic menu=$Menu, title=$Text, description=' ', callback=$Callback, update=1000ms
  endsub
  return null
  
  sub.HotKeyAdd:
  $HotKeyOpen=$HotkeyArray[0]
  $Page=$HotkeyArray[1]
  $ID=$HotkeyArray[2]
  $Array=read text: page=$Page id=$ID
  $Array=split string: $Array separator='|'
  $Array=reverse array $Array
  $ArraySize=size of array $Array
  while$ArraySize
    dec $ArraySize=
    $HotKeyData=$Array[$ArraySize]
    do if$HotKeyData == 'null'
      continue
    
    $HotKeyData=split string: $HotKeyData separator=':'
    $HotKey=$HotKeyData[0]
    
    if$HotKey == 'Combo.FS.HotKey'
      $CurrentLanguage=get current text language ID
      skip if$CurrentLanguage == 7
        continue
    end
    
    $HotKeyTextID=$HotKeyData[2]
    $HotKeyTextID=string $HotKeyTextID to integer
    $HotkeyArray=create new array, arguments=$HotKey, $Page, $ID, null, null
    $HotKeyText=combine string array: $HotkeyArray, separator=':'
    $Default=$TMenu[$HotKey]
    ifis datatype[ $Default ] == DATATYPE_NULL
      $Default=0
    else
      skip if$Default == 0
        $Default=1
    end
    
    $Text=read text: page=$Page id=$HotKeyTextID
    add value selection to menu: $Menu, text=$Text, value array=$Values.YesNo, default=$Default, return id=$HotKeyText, width=null allowtabs=[TRUE]
    do if$HotKeyOpen
      inc $MenuHeight=
  end
  endsub
  return null

Deniskos
Posts: 154
Joined: Wed, 11. Jun 08, 21:40
x4

Re: Script Engine Changes

Post by Deniskos » Sat, 13. Apr 24, 14:19

Can you do something like :)

Code: Select all

set menu option: disable improvement for lazy people.. la, la, la

Post Reply

Return to “X³: Farnham's Legacy - Scripts and Modding”