Code: Select all
<DockScreen UNID="&dsAlphaStrikeConfigurator;"
name= "Alpha Strike Configurator"
type= "itemPicker"
backgroundID= "&rsItemListScreen;"
>
<ListOptions
dataFrom= "player"
list= "wI~l -AlphaStrike; -Launcher;"
>
;(scrSetListFilter gScreen (itmGetData "alpha_linked"))
</ListOptions>
<Panes>
<Default>
<Initialize>
(block (weaponlist weaponindex alphastrike1 alphastrike2 alphastrike3 alphastrike4 alphastrike5)
;recover the weapons
(setq alphastrike1 (objGetData gSource "alphastrike1"))
(setq alphastrike2 (objGetData gSource "alphastrike2"))
(setq alphastrike3 (objGetData gSource "alphastrike3"))
(setq alphastrike4 (objGetData gSource "alphastrike4"))
(setq alphastrike5 (objGetData gSource "alphastrike5"))
(scrSetDesc gScreen (cat "Welcome to the Alpha Strike Configurator!\nSlot 1 is " (itmGetName alphastrike1 1) "\nSlot 2 is " (itmGetName alphastrike2 1) "\nSlot 3 is " (itmGetName alphastrike3 1) "\nSlot 4 is " (itmGetName alphastrike4 1) "\nSlot 5 is " (itmGetName alphastrike5 1)))
;we also deactivate the actions by checking the item data
(if (itmGetData (scrGetItem gScreen) "alpha_linked")
(block Nil
(scrEnableAction gScreen 0 Nil)
(scrEnableAction gScreen 1 Nil)
(scrEnableAction gScreen 2 Nil)
(scrEnableAction gScreen 3 Nil)
(scrEnableAction gScreen 4 Nil)
))
)
</Initialize>
<Actions>
<Action name="Set Slot 1" key="1">
(block (PickedItem)
(setq PickedItem (scrGetItem gScreen))
;(objSetData gSource "alphastrike1" PickedItem)
(objSetData gSource "alphastrike1_name" (alpha_tokenizeInWords (itmgetname PickedItem 0)))
(alpha_setLinkData PickedItem 1)
)
</Action>
<Action name="Set Slot 2" key="2">
(block (PickedItem)
(setq PickedItem (scrGetItem gScreen))
;(objSetData gSource "alphastrike2" PickedItem)
(objSetData gSource "alphastrike2_name" (alpha_tokenizeInWords (itmgetname PickedItem 0)))
(alpha_setLinkData PickedItem 2)
)
</Action>
<Action name="Set Slot 3" key="3">
(block (PickedItem)
(setq PickedItem (scrGetItem gScreen))
;(objSetData gSource "alphastrike3" PickedItem)
(objSetData gSource "alphastrike3_name" (alpha_tokenizeInWords (itmgetname PickedItem 0)))
(alpha_setLinkData PickedItem 3)
)
</Action>
<Action name="Set Slot 4" key="4">
(block (PickedItem)
(setq PickedItem (scrGetItem gScreen))
;(objSetData gSource "alphastrike4" PickedItem)
(objSetData gSource "alphastrike4_name" (alpha_tokenizeInWords (itmgetname PickedItem 0)))
(alpha_setLinkData PickedItem 4)
)
</Action>
<Action name="Set Slot 5" key="5">
(block (PickedItem)
(setq PickedItem (scrGetItem gScreen))
;(objSetData gSource "alphastrike5" PickedItem)
(objSetData gSource "alphastrike5_name" (alpha_tokenizeInWords (itmgetname PickedItem 0)))
(alpha_setLinkData PickedItem 5)
)
</Action>
<Action name="Disconnect Weapon Links" key="D">
(block Nil
;delete the links
(objSetData gSource "alphastrike1" Nil)
(objSetData gSource "alphastrike2" Nil)
(objSetData gSource "alphastrike3" Nil)
(objSetData gSource "alphastrike4" Nil)
(objSetData gSource "alphastrike5" Nil)
;we also reset the timers
(objSetData gSource "shottimer1" Nil)
(objSetData gSource "shottimer2" Nil)
(objSetData gSource "shottimer3" Nil)
(objSetData gSource "shottimer4" Nil)
(objSetData gSource "shottimer5" Nil)
;we also reset the name lists
(objSetData gSource "alphastrike1_name" Nil)
(objSetData gSource "alphastrike2_name" Nil)
(objSetData gSource "alphastrike3_name" Nil)
(objSetData gSource "alphastrike4_name" Nil)
(objSetData gSource "alphastrike5_name" Nil)
;also remove attributes of the weapons
(enum (objGetItems gSource "wI") tempWeapon
(alpha_removeLinkData tempWeapon)
)
)
</Action>
<Action name="Exit" cancel="1" key="X">
<Exit/>
</Action>
</Actions>
</Default>
</Panes>
</DockScreen>
ok, at first I wanted to filter out the weapons with itemdata using scrSetListFilter, however it didn't work (read as: I have no clue how to use it)
So the second approach was to use Prophet's idea and use scrEnableAction to disable the weapon that is already linked (and has the data)
This works very well, besides a minor problem that I don't know how to resolve: If you replace the linkage (let's say slot 1) with another weapon, the item data is not removed from the first, and I don't know how to do it without screwing the weapons up in case the player installs multiple weapons of the same type.
For the rest it works.
Now I "just" have to make some script code that can interpret the configurations outputted by typGetDataField to recreate any configuration.
Everything else is already done including firing the sounds and using up the power of the reactor with objSetDeviceActivationDelay.