I have a device idea that needs a dockscreen and I don't know dockscreens.
I want a dockscreen to be spawned by an <onInstall> event that will provide an itempicker and then run some script on the picked item.
Ideally this would be inserted into the station dockscreen with parent of the install screen as its parent.
dockscreen help request
- alterecco
- Fleet Officer
- Posts: 1658
- Joined: Wed Jan 14, 2009 3:08 am
- Location: Previously enslaved by the Iocrym
This has not been tested, but it should work
Code: Select all
<DockScreen UNID="&dsOnInstall;"
name= "On Install Screen"
type= "itemPicker"
backgroundID= "&rsItemListScreen;"
>
<ListOptions
dataFrom="player"
list="*"
/>
<Panes>
<Default>
<Actions>
<Action name="Select Item" default="1" key="S">
(block (itm)
(setq itm (scrGetItem gScreen))
;; do whatever you want with itm here
)
</Action>
<Action name="Back" key="B">
(block Nil
;; run any clean up code you need here
(scrShowScreen gScreen gPrevScreen gPrevPane)
)
</Action>
</Actions>
</Default>
</Panes>
</DockScreen>
<!-- Somewhere inside the Item -->
<Events>
<OnInstall>
(block Nil
(scrShowScreen gScreen &dsOnInstall; "Default")
)
</OnInstall>
</Events>
Alterecco and I apparently came up with nearly identical results, however there was an unforseen problem because dsInstallDevice tries to call a screen at the same time that the onInstall was calling the screen so I managed a workaround.
Code: Select all
<DockScreen UNID="&dsOnInstall;"
name= "On Install Screen"
type= "itemPicker"
backgroundID= "&rsItemListScreen;"
>
<ListOptions
dataFrom="player"
list="*"
/>
<Panes>
<Default>
<Actions>
<Action name="Select Item" default="1" key="S">
(block (itm)
(setq itm (scrGetItem gScreen))
;; do whatever you want with itm here
)
</Action>
<Action name="Back" key="B">
(block Nil
;; run any clean up code you need here
;; NOTE: gPrevScreen and gPrevPane have been hacked so the substitued var names are used
(scrShowScreen gScreen gOldScreen gOldPane)
)
</Action>
</Actions>
</Default>
</Panes>
</DockScreen>
<!-- Somewhere inside the Item -->
<Events>
<OnInstall>
(block Nil
;; save the intended destination screen under different variables
(setq gOldScreen gPrevScreen)
(setq gOldPane gPrevPane)
;; hack the vanilla screen to get the redirect to work properly
(setq gPrevScreen &dsOnInstall;)
(setq gPrevPane "Default")
)
</OnInstall>
</Events>
Coming soon: The Syrtian War adventure mod!
A Turret defense genre mod exploring the worst era in Earth's history.
Can you defend the Earth from the Syrtian invaders?
Stay tuned for updates!
A Turret defense genre mod exploring the worst era in Earth's history.
Can you defend the Earth from the Syrtian invaders?
Stay tuned for updates!