Question of the Week

Freeform discussion about anything related to modding Transcendence.
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Anyways, to stimulate some activity on the forums and clear up some ambiguities I (and maybe may others) have about code, I will ask some questions about some vaguely documented parts of Transcendence.

On dockscreens:
What kinds of dockscreens are there? What are they used for?
What are the necessary components of a dockscreen? (Like ListEntries need a name, ImageDesc, and something else)
What is the advantage of using a global dockscreen?
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

Is there any good way to pass variables in and out of a dockscreen called from inside a script using (scrShowScreen)?
Literally is the new Figuratively
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

Atarlost wrote:Is there any good way to pass variables in and out of a dockscreen called from inside a script using (scrShowScreen)?
do you mean :

Code: Select all

; Aliases for backwards compatibility ------------------------------
			(setq comShowBuyScreen scrShowBuyScreen)
			(setq comShowSellScreen scrShowSellScreen)
			(setq intMassString strMassString)
			(setq intTranslate objTranslate)
?
I really do not know what you mean by variables : I have hunted the player's cargo, shield and weapon level, combat level....
I think the database has about 99% of most of what we would need : not exactly in the form we want to use them, but I think find many examples to interesting things.
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Atarlost wrote:Is there any good way to pass variables in and out of a dockscreen called from inside a script using (scrShowScreen)?
I'm glad you brought this up (and thanks, RPC, for kicking it off). I'd like to come up with a good method. Today, as you know, the game uses global variables to pass info to a dock screen--something that won't scale very well.

For dockscreens that are designed to be reusable, I've been slowly moving to a pattern of wrapping the call to scrShowScreen in another function which sets the global variables--that way, when the time comes, we can change it.

Meanwhile, maybe we can brainstorm on some better methods. Some ideas:

1. For dock screens with an UNID, you can always use (typSetGlobalData ...) and (typGetGlobalData ...). This is just as much of a hack, but at least it is scoped to the dock screen instead of the global variable pool.

2. My preferred method is to pass an extra argument to scrShowScreen and have that be accessible from inside the dock screen. The arg could be accessible via a new function (scrGetArgs, or something). [One arg is enough since you can always pass a structure.]

Does anyone have other ideas?
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

A list of key value pairs in one singular global variable maybe?

At the moment I need to pass a list of atoms into and back out of a custom dockscreen.
Literally is the new Figuratively
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

@Atarlost: I don't know it this will work, but try placing the list of atoms as data on a SpaceObject (using ObjSetData), then use the dockscreen to call them up again when needed.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

In DSF i use a state object that is available to the screens until they exit. That is, i can set a variable in the state, change screen, and retrieve the same variable again (by key). When the player exits a screen completely the state is cleared. We could change that so that a state object could be accessed before and after entering and exiting a screen?
Get your own Galactic Omni Device
Get it now. It's free!!
Image
Mike
Anarchist
Anarchist
Posts: 2
Joined: Sun Jan 15, 2012 3:40 am

"1. For dock screens with an UNID, you can always use (typSetGlobalData ...) and (typGetGlobalData ...). This is just as much of a hack, but at least it is scoped to the dock screen instead of the global variable pool.

2. My preferred method is to pass an extra argument to scrShowScreen and have that be accessible from inside the dock screen. The arg could be accessible via a new function (scrGetArgs, or something). [One arg is enough since you can always pass a structure.]"

I think I did the quote thing the wrong way but...

Passing Structs = good plan.
Indexing ALL the things would be an alternative, if it weren't impractical, less robust and just plain painful to do. ...segfaults are evil...
User avatar
Prophet
Militia Captain
Militia Captain
Posts: 826
Joined: Tue Nov 18, 2008 6:09 pm

What kinds of dockscreens are there? What are they used for?
  • Text - The standard DS.
    ItemPicker - Used for buy/sell can also use a custom list of 'items'
    Canvas - shows pics primarily. underused IMHO
What are the necessary components of a dockscreen? (Like ListEntries need a name, ImageDesc, and something else)
Your question focuses on an itempicker screen which requires an image, Title, description and can take more arguments as needed.
What is the advantage of using a global dockscreen?
A global dockscreen is not tied to any spaceobject or item and can be called from anywhere, even pure script. You could have multiple stations/items call the same global screen.



As for scoping variables, I like the method DSF uses for handling (variables are valid during the entire 'session') and would love that funtionality to be incorporated into the engine.
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!
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Thanks Prophet. So is the canvas DS the one used in the neurohacking minigame?
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

RPC wrote:So is the canvas DS the one used in the neurohacking minigame?
Yes.

We also have a CustomPicker screen type... My personal favorite and the one G.O.D uses almost exclusively :)
Get your own Galactic Omni Device
Get it now. It's free!!
Image
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Ok, this will be a huge task, (unless it's already documented) but can I get a tutorial for making each dockscreen? If would also be placed in the wiki for future reference.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Man... i should really really do this... there are just so many games to play, so many projects to play with and so much work to be done... :/ I hope i will find the time and the inspiration. You might be interested in the DSF documentation. It has a little bit of info about screens in general. If there were more people than me using it I guess it would be worth it expanding the DSF docs... :)
Get your own Galactic Omni Device
Get it now. It's free!!
Image
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Yeah, you should do the tutorial alterecco.
Also closures isn't on the DSF documentation. D:
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
Ttech
Fleet Admiral
Fleet Admiral
Posts: 2767
Joined: Tue Nov 06, 2007 12:03 am
Location: Traveling in the TARDIS
Contact:

RPC wrote:Yeah, you should do the tutorial alterecco.
Also closures isn't on the DSF documentation. D:

I don't think closures are specifically dock screen framework though.
Image
Image
Post Reply