Just figured I'd warn any other scripters out there.
One thought - I wonder if this limit is a GECK editor limit, or something required by the engine... Maybe I can use an external tool to force it to the lengths I need.
scn InfinimenuOptionsTokenSCPTInt iMessageInt iButtonBegin OnAdd Set iMessage to -1 DisablePlayerControls 1 1 0 0 1 0 0EndBegin GameMode If (iMessage > 0) Set iButton to GetButtonPressed If (iButton == -1) Return Else Set iMessage to (iMessage * -1) If (iMessage == -1) If (iButton == 0) ElseIf (iButton == 1) ElseIf (iButton == 2) ElseIf (iButton == 3) ElseIf (iButton == 4) ElseIf (iButton == 5) ElseIf (iButton == 6) ElseIf (iButton == 8) ; More Set iMessage to -2 ElseIf (iButton == 9) ; Done EnablePlayerControls 1 1 0 0 1 0 0 RemoveMe EndIf ElseIf (iMessage == -2) If (iButton == 0) ElseIf (iButton == 1) ElseIf (iButton == 2) ElseIf (iButton == 3) ElseIf (iButton == 4) ElseIf (iButton == 5) ElseIf (iButton == 6) ElseIf (iButton == 7) ElseIf (iButton == 8) ; More Set iMessage to -3 ElseIf (iButton == 9) ; Back Set iMessage to -1 EndIf ElseIf (iMessage == -3) If (iButton == 0) ElseIf (iButton == 1) ElseIf (iButton == 2) ElseIf (iButton == 3) ElseIf (iButton == 4) ElseIf (iButton == 5) ElseIf (iButton == 6) ElseIf (iButton == 7) ElseIf (iButton == 8) ; More Set iMessage to -4 ElseIf (iButton == 9) ; Back Set iMessage to -2 EndIf ElseIf (iMessage == -4) If (iButton == 0) ElseIf (iButton == 1) ElseIf (iButton == 2) ElseIf (iButton == 3) ElseIf (iButton == 4) ElseIf (iButton == 5) ElseIf (iButton == 6) ElseIf (iButton == 7) ElseIf (iButton == 8) ; More Set iMessage to -5 ElseIf (iButton == 9) ; Back Set iMessage to -3 EndIf ElseIf (iMessage == -5) If (iButton == 0) ElseIf (iButton == 1) ElseIf (iButton == 2) ElseIf (iButton == 3) ElseIf (iButton == 4) ElseIf (iButton == 5) ElseIf (iButton == 6) ElseIf (iButton == 7) ElseIf (iButton == 8) ; More Set iMessage to -6 ElseIf (iButton == 9) ; Back Set iMessage to -4 EndIf ElseIf (iMessage == -6) If (iButton == 0) ElseIf (iButton == 1) ElseIf (iButton == 2) ElseIf (iButton == 3) ElseIf (iButton == 4) ElseIf (iButton == 5) ElseIf (iButton == 6) ElseIf (iButton == 7) ElseIf (iButton == 8) ; More Set iMessage to -7 ElseIf (iButton == 9) ; Back Set iMessage to -5 EndIf ElseIf (iMessage == -7) If (iButton == 0) ElseIf (iButton == 1) ElseIf (iButton == 2) ElseIf (iButton == 3) ElseIf (iButton == 4) ElseIf (iButton == 5) ElseIf (iButton == 6) ElseIf (iButton == 7) ElseIf (iButton == 8) ; More Set iMessage to -8 ElseIf (iButton == 9) ; Back Set iMessage to -6 EndIf ElseIf (iMessage == -8) If (iButton == 0) ElseIf (iButton == 1) ElseIf (iButton == 2) ElseIf (iButton == 3) ElseIf (iButton == 4) ElseIf (iButton == 5) ElseIf (iButton == 6) ElseIf (iButton == 7) ElseIf (iButton == 8) ; More Set iMessage to -9 ElseIf (iButton == 9) ; Back Set iMessage to -7 EndIf ElseIf (iMessage == -9) If (iButton == 0) ElseIf (iButton == 1) ElseIf (iButton == 2) ElseIf (iButton == 3) ElseIf (iButton == 4) ElseIf (iButton == 5) ElseIf (iButton == 6) ElseIf (iButton == 7) ElseIf (iButton == 8) ; More Set iMessage to -10 ElseIf (iButton == 9) ; Back Set iMessage to -8 EndIf ElseIf (iMessage == -10) If (iButton == 0) ElseIf (iButton == 1) ElseIf (iButton == 2) ElseIf (iButton == 3) ElseIf (iButton == 4) ElseIf (iButton == 5) ElseIf (iButton == 6) ElseIf (iButton == 7) ElseIf (iButton == 8) ; Back Set iMessage to -9 ElseIf (iButton == 9) ; Done EnablePlayerControls 1 1 0 0 1 0 0 RemoveMe EndIf EndIf EndIf Else;If (iMessage < 0) Set iMessage to (iMessage * -1) If (iMessage == 1) ShowMessage Options01MESG ElseIf (iMessage == 2) ShowMessage Options02MESG ElseIf (iMessage == 3) ShowMessage Options03MESG ElseIf (iMessage == 4) ShowMessage Options04MESG ElseIf (iMessage == 5) ShowMessage Options05MESG ElseIf (iMessage == 6) ShowMessage Options06MESG ElseIf (iMessage == 7) ShowMessage Options07MESG ElseIf (iMessage == 8) ShowMessage Options08MESG ElseIf (iMessage == 9) ShowMessage Options09MESG ElseIf (iMessage == 10) ShowMessage Options10MESG EndIf EndIfEnd
scn a450StatCheckint townSize ; Numerical calculation of town sizeint isMsg ; 0 = no message, 1 = message showingint btnPress ; Used to getPressedButton for last messageint whichMsg ; corresponds to "m###" in messages, indicates which messsage is upint lastMsg ; corresponds to "m###" messages like whichMsg, however this is used when a message is going to be called that might have multiple destinations for "return"int freeRes ; calculated each pass as a simple total-used valueint freeRooms ; The number of rooms free (max 5, min 0)int firstFreeRoom ; the number of the first free room. Recall that rooms may be deleted, so you can't count on this being the last in the chain. Is 0 if no rooms free (shouldn't be allowed to occur)int tempRfnd ; temporary variable, used to calculate cost refundsint tempRoom ; temporary variable, used to track which room type we're dealing withint whichRoom ; temporary variable, used to track which room slot we're dealing withint activateSomething; if set to 1, will check the other activations below (universal variable added to keep gameMode short)int activateTownsize ; if set to 1, will trigger the initial townSize menu (and set this to 0)int activateTimeout ; if set to 1, will trigger the construction sound and an imagespace modifier to delay the player; 2 does the same with a demolition sound, 3 the same with (undetermined) disable/damage sound; The following indicate that an action needs to be performed on a building.; 0 = no action needed; 1 = Build up one level; 2 = Demolish down one level; 3 = Damage building (level remains the same but becomes nonfunctional until repair cost paid); 4 = Disable building (as "damaged," but unfixable save by specific triggers); 6, 7, 8 = Upgrade to this sixth-tier building; 9 = Repair building; 10 = un-disable buildingint activateBuild01int activateBuild02int activateBuild03int activateBuild04int activateBuild05int activateBuild06int activateBuild07int activateBuild08int activateBuild09int activateBuild10int activateBuild11int activateBuild12; The following are used to pass information to messages - specifically, they're used to describe if the user has items/resources necessary.int passHasItems1int passHasRes1int passHasItems2int passHasRes2int passHasItems3int passHasRes3float timer ; used for timing functionsBegin OnActivate if isMsg != 0 ; There's already a message up! return endif if activateSomething > 0 ; GameMode must be handled before this can be safely selected! Should only occur if the player activates very quickly after closing return endif set freeRes to (a450ResTot - a450ResUsed) if freeRes < 0 set freeRes to 0 ; Don't show negative resources. It's just confusing. endif if a450EventsWaiting > 0 ; We have events to deal with! set isMsg to 1 set whichMsg to 101 showMessage a450m101Events a450ResUsed a450ResTot freeRes a450Defense ; Events waiting message, standard stats endif ; If no events are waiting, we'll need to calculate town size and show a proper window ; this is NOT handled here because menus need to be able to "return to main menu" set activateTownsize to 1 set activateSomething to 1EndBegin GameMode if activateSomething > 0 ; activate means no menu is open (I think - watch this one) ; This is basically a shortcut so I don't have to do these two every time I set activateSomething set isMsg to 0 set whichMsg to 0 ; One of these variables will be true if activateTimeout == 1 ; Construction if timer == 0 ; Uninitialized ;start set timer to 1 DisablePlayerControls playSound a450ConstructionSound iMod FadeToBlack5sISFX return else set timer to timer + getSecondsPassed if timer > 6 ;end set activateSomething to 0 set activateTimeout to 0 set timer to 0 EnablePlayerControls endif return endif elseif activateTimeout == 2 ; Demolish if timer == 0 ; Uninitialized ;start set timer to 1 DisablePlayerControls playSound a450ConstructionSound iMod FadeToBlack5sISFX return else set timer to timer + getSecondsPassed if timer > 6 ;end set activateSomething to 0 set activateTimeout to 0 set timer to 0 EnablePlayerControls endif return endif elseif activateTimeout == 3 ; Disable/damaged if timer == 0 ; Uninitialized ;start set timer to 1 DisablePlayerControls playSound a450ConstructionSound iMod FadeToBlack5sISFX return else set timer to timer + getSecondsPassed if timer > 6 ;end set activateSomething to 0 set activateTimeout to 0 set timer to 0 EnablePlayerControls endif return endif endif set activateSomething to 0 ;Recalculate the first free room if a450Slot1Type == 0 set firstFreeRoom to 1 elseif a450Slot2Type == 0 set firstFreeRoom to 2 elseif a450Slot3Type == 0 set firstFreeRoom to 3 elseif a450Slot4Type == 0 set firstFreeRoom to 4 elseif a450Slot5Type == 0 set firstFreeRoom to 5 else set firstFreeRoom to 0 endif if activateTownSize == 1 set activateTownSize to 0 set activateSomething to 0 set isMsg to 1 ; Show main menu! ; Town size calculations: +1 per resource upgrade, +1 per un-empty room, +1 per building level up to 5, +1 for final tier upgrade set townSize to a450SizeMod ; INSERT RESOURCE UPGRADE CALCULATIONS HERE ; We have to do this for every single possible room - all twelve, due to how they're stored. if a450Room01State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room01State <= 5 set townSize to townSize + a450Room01State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room02State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room02State <= 5 set townSize to townSize + a450Room02State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room03State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room03State <= 5 set townSize to townSize + a450Room03State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room04State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room04State <= 5 set townSize to townSize + a450Room04State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room05State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room05State <= 5 set townSize to townSize + a450Room05State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room06State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room06state <= 5 set townSize to townSize + a450Room06State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room07State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room07State <= 5 set townSize to townSize + a450Room07State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room08State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room08State <= 5 set townSize to townSize + a450Room08State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room09State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room09State <= 5 set townSize to townSize + a450Room09State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room10State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room10State <= 5 set townSize to townSize + a450Room10State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room11State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room11State <= 5 set townSize to townSize + a450Room11State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif if a450Room12State > 0 set townSize to townSize + 1 ; +1 Size for having a building if a450Room12State <= 5 set townSize to townSize + a450Room12State ; +level for building levels up to 5 else set townSize to townSize + 6 ; +5 for level 5 building and +1 for side-upgrade endif endif ; townSize calculations done. Show message based on town Size. if townSize <= 4 ; Ruin set whichMsg to 001 ShowMessage a450m001StatSize1 a450ResUsed a450ResTot freeRes a450Defense elseif townSize <= 9 ; Hamlet set whichMsg to 002 ShowMessage a450m002StatSize2 a450ResUsed a450ResTot freeRes a450Defense elseif townSize <=19 ; Village set whichMsg to 003 ShowMessage a450m003StatSize3 a450ResUsed a450ResTot freeRes a450Defense elseif townSize <=29 ; Town set whichMsg to 004 ShowMessage a450m004StatSize4 a450ResUsed a450ResTot freeRes a450Defense elseif townSize <=39 ; City set whichMsg to 005 ShowMessage a450m005StatSize5 a450ResUsed a450ResTot freeRes a450Defense else ; Hub! set whichMsg to 006 ShowMessage a450m006StatSize6 a450ResUsed a450ResTot freeRes a450Defense endif return endif ; The following code handles all building upgrades/downgrades/etc. ; Resources must be subtracted from the player. HOWEVER, it is assumed that the player has these resources (checks occur in menus) if activateBuild01 != 0 set activateSomething to 0 if activateBuild01 != 3 && activateBuild01 != 4 && activateBuild01 != 9 && activateBuild01 != 10 ; If we're not disabling, damaging, or repairing a building, we're going to first need to disable the objects currently in place. ; INSERT OBJECT DISABLING CODE HERE endif if activateBuild01 == 1 ; 1 = Build up one level ; Process for upgrading: pay price (caps/items), pay resources, set proper variables, update room variables (INITIAL BUILD ONLY), enable and move visible objects, enable proper activateTimeout, activate building level effects if a450Room01State == 0 ; Initial Build ; Pay caps set tempRfnd to 500 player.removeItem F tempRfnd ; Pay items ; Pay RESOURCES set a450ResUsed to a450ResUsed + 2 ; Variables set a450Room01State to (a450Room01State + 1) ; SlotType if firstFreeRoom == 1 set a450Slot1Type to 1 set a450Room01Place to 1 elseif firstFreeRoom == 2 set a450Slot2Type to 1 set a450Room01Place to 2 elseif firstFreeRoom == 3 set a450Slot3Type to 1 set a450Room01Place to 3 elseif firstFreeRoom == 4 set a450Slot4Type to 1 set a450Room01Place to 4 else set a450Slot5Type to 1 set a450Room01Place to 5 endif ; EnableObjects ; INSERT ENABLE OBJECTS CODE HERE ; Trigger proper activateTimeout set activateSomething to 1 set activateTimeout to 1 ; Activate Building effects set a450Defense to a450Defense + 2 elseif a450Room01State == 1 ; Upgrade ; Pay caps set tempRfnd to 1000 player.removeItem F tempRfnd ; Pay items ; Pay RESOURCES set a450ResUsed to a450ResUsed + 1 ; Variables set a450Room01State to (a450Room01State + 1) ; EnableObjects ; INSERT ENABLE OBJECTS CODE HERE ; Trigger proper activateTimeout set activateSomething to 1 set activateTimeout to 1 ; Activate Building effects set a450Room01Eff to a450Room01Eff + 1 elseif a450Room01State == 2 ; Upgrade ; Pay caps set tempRfnd to 2000 player.removeItem F tempRfnd if a450BuildCostMult < 1 ; Build cost refund set tempRfnd to (tempRfnd * (1.0-a450BuildCostMult)) player.addItem F tempRfnd endif ; Pay items ; Pay RESOURCES set a450ResUsed to a450ResUsed + 1 ; Variables set a450Room01State to (a450Room01State + 1) ; EnableObjects ; INSERT ENABLE OBJECTS CODE HERE ; Trigger proper activateTimeout set activateSomething to 1 set activateTimeout to 1 ; Activate Building effects set a450Defense to a450Defense + 2 elseif a450Room01State == 3 ; Upgrade ; Pay caps set tempRfnd to 3000 player.removeItem F tempRfnd ; Pay items ; Pay RESOURCES set a450ResUsed to a450ResUsed + 2 ; Variables set a450Room01State to (a450Room01State + 1) ; EnableObjects ; INSERT ENABLE OBJECTS CODE HERE ; Trigger proper activateTimeout set activateSomething to 1 set activateTimeout to 1 ; Activate Building effects set a450Room01Eff to a450Room01Eff + 2 elseif a450Room01State == 4 ; Upgrade ; Pay caps set tempRfnd to 4000 player.removeItem F tempRfnd ; Pay items ; Pay RESOURCES set a450ResUsed to a450ResUsed + 1 ; Variables set a450Room01State to (a450Room01State + 1) ; EnableObjects ; INSERT ENABLE OBJECTS CODE HERE ; Trigger proper activateTimeout set activateSomething to 1 set activateTimeout to 1 ; Activate Building effects set a450Defense to a450Defense + 2 endif ; 5+ handled below elseif activateBuild01 == 2 ; 2 = Demolish down one level elseif activateBuild01 == 3 ; 3 = Damage building (level remains the same but becomes nonfunctional until repair cost paid) elseif activateBuild01 == 4 ; 4 = Disable building (as "damaged," but unfixable save by specific triggers) elseif activateBuild01 == 9 ; Repair building elseif activateBuild01 == 6 ; Final upgrade - Spec Ops Training ; Pay caps set tempRfnd to 5000 player.removeItem F tempRfnd ; Pay items ; Pay RESOURCES set a450ResUsed to a450ResUsed + 3 ; Variables set a450Room01State to 6 ; EnableObjects ; INSERT ENABLE OBJECTS CODE HERE ; Trigger proper activateTimeout set activateSomething to 1 set activateTimeout to 1 ; Activate Building effects set a450Room01Eff to a450Room01Eff - 3 ; All level six upgrades lose their efficiency bonus from levels 2 and 4 ; Do we have an Arsenal and is it in good condition? if a450Room02State > 0 && a450Room02Cur == 0 ; Arsenal present. Determine current Barracks EFF+ and add it again. Future checks/updates will be handled automatically by the Arsenal upgrade/downgrade code if (a450Room02State == 1) || (a450Room02State == 2) set a450Room01EFF to a450Room01EFF + 1 elseif (a450Room02State == 3) || (a450Room02State == 4) set a450Room01EFF to a450Room01EFF + 2 elseif (a450Room02State == 5) set a450Room01EFF to a450Room01EFF + 3 elseif (a450Room02State == 6) ; Militia Headquarters - no bonus! elseif (a450Room02State == 7) ; War Room set a450Room01EFF to a450Room01EFF + 4 elseif (a450Room02State == 8) ; Armory set a450Room01EFF to a450Room01EFF + 3 endif endif elseif activateBuild01 == 7 ; Final upgrade - Quarters ; Pay caps set tempRfnd to 6000 player.removeItem F tempRfnd ; Pay items ; Pay RESOURCES set a450ResUsed to a450ResUsed + 1 ; Variables set a450Room01State to 7 ; EnableObjects ; INSERT ENABLE OBJECTS CODE HERE ; Trigger proper activateTimeout set activateSomething to 1 set activateTimeout to 1 ; Activate Building effects set a450Room01Eff to a450Room01Eff - 3 ; All level six upgrades lose their efficiency bonus from levels 2 and 4 ; Arsenal changes unnecessary; same as barracks elseif activateBuild01 == 8 ; Final upgrade -Dojo ; Pay caps set tempRfnd to 5000 player.removeItem F tempRfnd ; Pay items ; Pay RESOURCES set a450ResUsed to a450ResUsed + 2 ; Variables set a450Room01State to 8 ; EnableObjects ; INSERT ENABLE OBJECTS CODE HERE ; Trigger proper activateTimeout set activateSomething to 1 set activateTimeout to 1 ; Activate Building effects set a450Room01Eff to a450Room01Eff - 3 ; All level six upgrades lose their efficiency bonus from levels 2 and 4 ; Do we have an Arsenal and is it in good condition? if a450Room02State > 0 && a450Room02Cur == 0 ; Arsenal present. Determine current Barracks EFF+ and subtract it. Future checks/updates will be handled automatically by the Arsenal upgrade/downgrade code if (a450Room02State == 1) || (a450Room02State == 2) set a450Room01EFF to a450Room01EFF - 1 elseif (a450Room02State == 3) || (a450Room02State == 4) set a450Room01EFF to a450Room01EFF - 2 elseif (a450Room02State == 5) set a450Room01EFF to a450Room01EFF - 3 elseif (a450Room02State == 6) ; Militia Headquarters - no bonus! elseif (a450Room02State == 7) ; War Room set a450Room01EFF to a450Room01EFF - 4 elseif (a450Room02State == 8) ; Armory set a450Room01EFF to a450Room01EFF - 3 endif endif endif set activateBuild01 to 0 ; ---------------------------------------- endif return ; Lets wait for the next frame, even if there's an isMsg to handle. endif ; end of activateSomething check if isMsg == 0 ; No message up! Just quit to decrease frame drag return endif set btnPress to GetButtonPressed if btnPress == -1 ; A message is up, but we've received no input. No reason to continue. return endif ;Recalculate free RESOURCES set freeRes to (a450ResTot - a450ResUsed) if freeRes < 0 set freeRes to 0 ; Don't show negative resources. It's just confusing. endif ;Recalculate # of free rooms in case we need it set freeRooms to 5 if a450Slot1Type > 0 set freeRooms to freeRooms - 1 endif if a450Slot2Type > 0 set freeRooms to freeRooms - 1 endif if a450Slot3Type > 0 set freeRooms to freeRooms - 1 endif if a450Slot4Type > 0 set freeRooms to freeRooms - 1 endif if a450Slot5Type > 0 set freeRooms to freeRooms - 1 endif ;Recalculate the first free room if a450Slot1Type == 0 set firstFreeRoom to 1 elseif a450Slot2Type == 0 set firstFreeRoom to 2 elseif a450Slot3Type == 0 set firstFreeRoom to 3 elseif a450Slot4Type == 0 set firstFreeRoom to 4 elseif a450Slot5Type == 0 set firstFreeRoom to 5 else set firstFreeRoom to 0 endif ; If we get here, we know a button has been pressed in a menu. if whichMsg >= 001 && whichMsg <= 005 ; The main menu is up, displaying a size-specific message (which we don't care about). ; Possible options: ; 0 = Build New Room ; 1 = Inspect Current Rooms ; 2 = Build/Inspect Resource Structures ; 3 = Build/Inspect Defensive Structures ; 4 = Build/Inspect Miscellaneous Structures ; 5 = Goodbye if btnPress == 0 set whichMsg to 300 showMessage a450m300BuildRoom freeRooms elseif btnPress == 1 set whichMsg to 200 showMessage a450m200InspectRoom elseif btnPress == 2 ; INSERT RESOURCE MENU HERE set whichMsg to 0 set isMsg to 0 return elseif btnPress == 3 ; INSERT DEFENSIVE MENU HERE set whichMsg to 0 set isMsg to 0 return elseif btnPress == 4 ; INSERT MISC MENU HERE set whichMsg to 0 set isMsg to 0 return elseif btnPress == 5 set whichMsg to 0 set isMsg to 0 return else ; Error state! endif elseif whichMsg == 300 ; Build new room menu. Options are: ; 0 = military ; 1 = industry ; 2 = Support ; 3 = Commerce ; 4 = Information ; 5 = return to main menu ; 6 = Goodbye if btnPress == 0 set whichMsg to 381 showMessage a450m381BuildMilitary a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 1 set whichMsg to 382 showMessage a450m382BuildIndustry a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 2 set whichMsg to 383 showMessage a450m383BuildSupport a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 3 set whichMsg to 384 showMessage a450m384BuildCommerce a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 4 set whichMsg to 385 showMessage a450m385BuildInformation a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 5 ; Return to proper town menu... set activateTownSize to 1 set activateSomething to 1 return elseif btnPress == 6 set whichMsg to 0 set isMsg to 0 return endif ; 381-385 are category build menus ; All follow the response format: ; Alternating (2 or 3 choices) even being build and odd being (already built) ; final two options are return and goodbye elseif whichMsg == 381 ; 381 is build military menu, options are barracks/arsenal if btnPress == 1 || btnPress == 3 ; failed options, re-show message showMessage a450m381BuildMilitary a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 0 ; Barracks! ; Item check: if Player.GetItemCount F >= 500 set passHasItems1 to 1 else set passHasItems1 to 0 endif ; Resources check: if freeRes >= 2 set passHasRes1 to 1 else set passHasRes1 to 0 endif set whichMsg to 301 showMessage a450m301BuildBarracks a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 2 set whichMsg to 302 showMessage a450m302BuildArsenal a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 4 set whichMsg to 300 showMessage a450m300BuildRoom freeRooms elseif btnPress == 5 set whichMsg to 0 set isMsg to 0 return endif elseif whichMsg == 382 ; 382 is build industry menu, options are 3worskhop/9lab if btnPress == 1 || btnPress == 3 ; failed options, re-show message showMessage a450m382BuildIndustry a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 0 set whichMsg to 303 showMessage a450m303BuildWorkshop a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 2 set whichMsg to 309 showMessage a450m309BuildLaboratory a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 4 set whichMsg to 300 showMessage a450m300BuildRoom freeRooms elseif btnPress == 5 set whichMsg to 0 set isMsg to 0 return endif elseif whichMsg == 383 ; 383 is build support menu, options are 4lounge/6infirmary/12galley if btnPress == 1 || btnPress == 3 || btnPress == 5 ; failed options, re-show message showMessage a450m383BuildSupport a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 0 set whichMsg to 304 showMessage a450m304BuildLounge a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 2 set whichMsg to 306 showMessage a450m306BuildInfirmary a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 4 set whichMsg to 312 showMessage a450m312BuildGalley a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 6 set whichMsg to 300 showMessage a450m300BuildRoom freeRooms elseif btnPress == 7 set whichMsg to 0 set isMsg to 0 return endif elseif whichMsg == 384 ; 384 is commerce support menu, options are 7shop/8bar/10bank if btnPress == 1 || btnPress == 3 || btnPress == 5 ; failed options, re-show message showMessage a450m384BuildCommerce a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 0 set whichMsg to 307 showMessage a450m307BuildShop a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 2 set whichMsg to 308 showMessage a450m308BuildBar a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 4 set whichMsg to 310 showMessage a450m310BuildBank a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 6 set whichMsg to 300 showMessage a450m300BuildRoom freeRooms elseif btnPress == 7 set whichMsg to 0 set isMsg to 0 return endif elseif whichMsg == 385 ; 385 is build information menu, options are 5library/11guild if btnPress == 1 || btnPress == 3 ; failed options, re-show message showMessage a450m385BuildInformation a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 0 set whichMsg to 305 showMessage a450m305BuildLibrary a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 2 set whichMsg to 311 showMessage a450m311BuildGuild a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 4 set whichMsg to 300 showMessage a450m300BuildRoom freeRooms elseif btnPress == 5 set whichMsg to 0 set isMsg to 0 return endif ; Beginning the final building-specific build menus. ; These are all very simple, 3-option affairs. ; 0 = Being Construction ; 1, 2 = Fail ; 3 = Return ; 4 = Exit elseif whichMsg == 301 ; Barracks if btnPress == 0 set activateBuild01 to 1 set activateSomething to 1 elseif btnPress == 1 || btnPress == 2 set whichMsg to 301 showMessage a450m301BuildBarracks a450ResUsed a450ResTot freeRes a450Defense firstFreeRoom elseif btnPress == 3 set whichMsg to 381 showMessage a450m381BuildMilitary a450ResUsed a450ResTot freeRes a450Defense elseif btnPress == 4 set whichMsg to 0 set isMsg to 0 return endif elseif whichMsg == 200 ; Inspect room menu. Options are 0 = room1 -> 4 = room 5, 5 = return, 6 = goodbye if btnPress < 5 if btnPress == 0 set whichRoom to 1 set tempRoom to a450Slot1Type elseif btnPress == 1 set whichRoom to 2 set tempRoom to a450Slot2Type elseif btnPress == 2 set whichRoom to 3 set tempRoom to a450Slot3Type elseif btnPress == 3 set whichRoom to 4 set tempRoom to a450Slot4Type elseif btnPress == 4 set whichRoom to 5 set tempRoom to a450Slot5Type endif if tempRoom == 1 ; Inspect Room menu, Barracks if a450Room01Cur == -1 ; Room damaged ; Can we afford repairs? if (a450Room01State == 1 && Player.GetItemCount F >= 250) || (a450Room01State == 2 && Player.GetItemCount F >= 500) || (a450Room01State == 3 && Player.GetItemCount F >= 1000) || (a450Room01State == 4 && Player.GetItemCount F >= 1500) || (a450Room01State == 5 && Player.GetItemCount F >= 2000) || (a450Room01State > 5 && Player.GetItemCount F >= 3000) set passHasItems1 to 1 else set passHasItems1 to 0 endif set whichMsg to 261 showMessage a450m261InspectDamBarracks freeRes a450Room01Place a450Room01EFF a450Room01State elseif a450Room01Cur > 0 ; Room disabled set whichMsg to 241 showMessage a450m241InspectDisBarracks freeRes a450Room01Place a450Room01EFF a450Room01State elseif a450Room01State <= 4 ; Between rank 1 and 4, inclusive ; ADD ITEM CHECKS TO THESE STATEMENTS LATER ; Based on current level, check to make sure we can afford upgrade to next rank, and prepare this information for the upcoming menu if a450Room01State == 1 if Player.GetItemCount F > 1000 set passHasItems1 to 1 else set passHasItems1 to 0 endif if freeRes >= 1 set passHasRes1 to 1 else set passHasRes1 to 0 endif elseif a450Room01State == 2 if Player.GetItemCount F > 2000 set passHasItems1 to 1 else set passHasItems1 to 0 endif if freeRes >= 1 set passHasRes1 to 1 else set passHasRes1 to 0 endif elseif a450Room01State == 3 if Player.GetItemCount F > 3000 set passHasItems1 to 1 else set passHasItems1 to 0 endif if freeRes >= 2 set passHasRes1 to 1 else set passHasRes1 to 0 endif else ; Assume == 4 if Player.GetItemCount F > 4000 set passHasItems1 to 1 else set passHasItems1 to 0 endif if freeRes >= 1 set passHasRes1 to 1 else set passHasRes1 to 0 endif endif set whichMsg to 201 showMessage a450m201InspectBarracks freeRes a450Room01Place a450Room01EFF a450Room01State elseif a450Room01State == 5 set whichMsg to 221 showMessage a450m221InspectL5Barracks freeRes a450Room01Place a450Room01EFF elseif a450Room01State == 6 set whichMsg to 401 showMessage a450m401InspectBarracks6 freeRes a450Room01Place a450Room01EFF elseif a450Room01State == 7 set whichMsg to 402 showMessage a450m402InspectBarracks7 freeRes a450Room01Place a450Room01EFF elseif a450Room01State == 8 set whichMsg to 403 showMessage a450m403InspectBarracks8 freeRes a450Room01Place a450Room01EFF endif endif elseif btnPress == 5 ; Return to proper town menu... set activateTownSize to 1 set activateSomething to 1 return elseif btnPress == 6 ; Goodbye set whichMsg to 0 set isMsg to 0 return endif ; All regular room inspections follow the same 5-option pattern ; 0 = upgrade ; 1, 2 = failed option (redisplay menu) ; 3 = downgrade ; 4 = demolish (same as downgrade, just only visible at rank 1) ; 5 = return ; 6 = goodbye elseif whichMsg == 201 ; Inspect Barracks, level 1-4 if btnPress == 0 set activateSomething to 1 set activateBuild01 to 1 elseif btnPress == 1 || btnPress == 2 ; Failed options showMessage a450m201InspectBarracks freeRes a450Room01Place a450Room01EFF a450Room01State elseif btnPress == 3 || btnPress == 4 ; Downgrade/Demolish set activateSomething to 1 set activateBuild01 to 2 elseif btnPress == 5 ; Return set whichMsg to 200 showMessage a450m200InspectRoom elseif btnPress == 6 ; Goodbye set whichMsg to 0 set isMsg to 0 return endif elseif whichMsg == 221 ; Inspect Barracks, level 5 ; 0, 1, 2 = info pane for upgrades value 6, 7, 8 ; 3 = Downgrade to level 4 ; 4 = return ; 5 = Goodbye if btnPress == 0 ; Building option 6 ; Spec Ops if Player.GetItemCount F > 5000 set passHasItems1 to 1 else set passHasItems1 to 0 endif if freeRes >= 3 set passHasRes1 to 1 else set passHasRes1 to 0 endif set whichMsg to 401 showMessage a450m401InspectBarracks6 freeRes a450Room01Place a450Room01EFF elseif btnPress == 1 ; Building option 7 ; Quarters if Player.GetItemCount F > 6000 set passHasItems1 to 1 else set passHasItems1 to 0 endif if freeRes >= 1 set passHasRes1 to 1 else set passHasRes1 to 0 endif set whichMsg to 402 showMessage a450m402InspectBarracks7 freeRes a450Room01Place a450Room01EFF elseif btnPress == 2 ; Building option 8 ; Dojo if Player.GetItemCount F > 5000 set passHasItems1 to 1 else set passHasItems1 to 0 endif if freeRes >= 2 set passHasRes1 to 1 else set passHasRes1 to 0 endif set whichMsg to 403 showMessage a450m403InspectBarracks8 freeRes a450Room01Place a450Room01EFF elseif btnPress == 3 set activateSomething to 1 set activateBuild01 to 2 elseif btnPress == 4 ; Return set whichMsg to 200 showMessage a450m200InspectRoom elseif btnPress == 5 ; Goodbye set whichMsg to 0 set isMsg to 0 endif ; 401 -> 436(?) are combination menus that pop up if EITHER a player is considering upgrading to a tier six building OR he/she has already done so and is re-specting the building ; 0 = Build this lvl 6 upgrade ; 1, 2 = fail options, return to same menu ; 3 = Downgrade to level 4 (lvl 6 upgrade unbuilt) ; 4 = Downgrade to level 5 (lvl 6 upgrade built) ; 5 = Return, lvl 5 version (return to inspectl5 version) ; 6 = Return, lvl 6 version (return to main inspect menu) ; 7 = Goodbye elseif whichMsg == 401 if btnPress == 0 ; Build lvl 6 upgrade set activateSomething to 1 set activateBuild01 to 6 elseif btnPress == 1 || btnPress == 2 ; Reset menu set whichMsg to 401 showMessage a450m401InspectBarracks6 freeRes a450Room01Place a450Room01EFF elseif btnPress == 3 || btnPress == 4 ; Demolish set activateSomething to 1 set activateBuild01 to 2 elseif btnPress == 5 ; Return lvl 5 set whichMsg to 221 showMessage a450m221InspectL5Barracks freeRes a450Room01Place a450Room01EFF elseif btnPress == 6 ; Return lvl 6 set whichMsg to 200 showMessage a450m200InspectRoom elseif btnPress == 7 ; Goodbye set whichMsg to 0 set isMsg to 0 endif elseif whichMsg == 402 if btnPress == 0 ; Build lvl 6 upgrade set activateSomething to 1 set activateBuild01 to 7 elseif btnPress == 1 || btnPress == 2 ; Reset menu set whichMsg to 402 showMessage a450m402InspectBarracks7 freeRes a450Room01Place a450Room01EFF elseif btnPress == 3 || btnPress == 4 ; Demolish set activateSomething to 1 set activateBuild01 to 2 elseif btnPress == 5 ; Return lvl 5 set whichMsg to 221 showMessage a450m221InspectL5Barracks freeRes a450Room01Place a450Room01EFF elseif btnPress == 6 ; Return lvl 6 set whichMsg to 200 showMessage a450m200InspectRoom elseif btnPress == 7 ; Goodbye set whichMsg to 0 set isMsg to 0 endif elseif whichMsg == 403 if btnPress == 0 ; Build lvl 6 upgrade set activateSomething to 1 set activateBuild01 to 8 elseif btnPress == 1 || btnPress == 2 ; Reset menu set whichMsg to 403 showMessage a450m403InspectBarracks8 freeRes a450Room01Place a450Room01EFF elseif btnPress == 3 || btnPress == 4 ; Demolish set activateSomething to 1 set activateBuild01 to 2 elseif btnPress == 5 ; Return lvl 5 set whichMsg to 221 showMessage a450m221InspectL5Barracks freeRes a450Room01Place a450Room01EFF elseif btnPress == 6 ; Return lvl 6 set whichMsg to 200 showMessage a450m200InspectRoom elseif btnPress == 7 ; Goodbye set whichMsg to 0 set isMsg to 0 endif else ; Error state - unhandled menu! Just treat it like a "goodbye" set whichMsg to 0 set isMsg to 0 endifEndBegin onLoad ; DEBUG CODE set a450Room01Eff to 5 set a450Room01Place to 1 set a450Room01State to 5 set a450ResTot to 20 set a450Slot1Type to 1End