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?
Question of the Week
-
- Fleet Admiral
- Posts: 2876
- Joined: Thu Feb 03, 2011 5:21 am
- Location: Hmm... I'm confused. Anybody have a starmap to the Core?
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
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.
Get on Discord for mod help and general chat
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.
-
- Fleet Officer
- Posts: 1533
- Joined: Tue Mar 22, 2011 8:43 pm
- Location: Alaska
- Contact:
do you mean :Atarlost wrote:Is there any good way to pass variables in and out of a dockscreen called from inside a script using (scrShowScreen)?
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..
I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
-
- Developer
- Posts: 2997
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
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.Atarlost wrote:Is there any good way to pass variables in and out of a dockscreen called from inside a script using (scrShowScreen)?
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?
-
- 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
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.
Get on Discord for mod help and general chat
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.
- alterecco
- 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?
"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...
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...
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
Your question focuses on an itempicker screen which requires an image, Title, description and can take more arguments as needed.What are the necessary components of a dockscreen? (Like ListEntries need a name, ImageDesc, and something else)
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.What is the advantage of using a global dockscreen?
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!
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!
-
- 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
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.
Get on Discord for mod help and general chat
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.
-
- 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
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.
Get on Discord for mod help and general chat
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.
- alterecco
- 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... :)
-
- 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:
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
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.
Get on Discord for mod help and general chat
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.