Hi all,
I thought to make a StationType for a planetary standard orbit and then instanciate that StationType through Station tags, adding attributes to each Station to describe its individual properties.
I tested with adding the attributes="attributeName" to the Station tag itself and using the "t:attribute" seach on sysFindObject. It doesn't seem to work.
Would it be possible to use StaticData instead ? But I didn't find any example in Transcendence source XMLs, StaticData tags always seem to be attached to StationTypes or ShipClasses. So how can you code properties for a specific station ? Or maybe it's not possible and StationTypes must be used ?
EDIT #1 : as an afterthought... This issue may in fact be a part of the one discussed on the How to implement a shared table ? thread. Or not a part of, but closely related as the goal is to store data on objects.
EDIT #2 : I need to study more of the random part of objects generation. Then both issues may find easier solutions.
Attributes in Stations instead of StationTypes
- Mutos
- Militia Lieutenant
- Posts: 218
- Joined: Thu Aug 14, 2008 3:31 am
- Location: Near Paris, France
- Contact:
Hi all,
Some experimental results !
I tried to put a testData property in the Station tag and retrieve it with 3 functions : objGetData, objGetGlobalData and objGetObjRefData. To no avail.
What I did to store the data :
The stMarkerDockS Station Type is one of my own types, just a marker with docking ports to figure a parking orbit.
And to retrieve it :
I do that in the OnGlobalSystemCreated event and it lists all my parkingOrbits stations with all Nil values.
I hoped to see one of the line turn to non-Nil on the one station I modified, but to no avail...
I'll try the same in the StationType to see what it does, but it doesn't help for customizing a single station instance.
Some experimental results !
I tried to put a testData property in the Station tag and retrieve it with 3 functions : objGetData, objGetGlobalData and objGetObjRefData. To no avail.
What I did to store the data :
Code: Select all
<Station type="&stMarkerDockS;" name="Venus" testData="Test String" />
And to retrieve it :
Code: Select all
(setq listStations (sysFindObject sourceSystem "t:parkingOrbit"))
(enum listStations theStation
(block (testData)
(setq message (cat "System " (sysGetName) " : Data on " (objGetName theStation) " : "))
(dbgLog message)
(setq message (cat "System " (sysGetName) " : objGetData : " (objGetData theStation "testData")))
(dbgLog message)
(setq message (cat "System " (sysGetName) " : objGetGlobalData : " (objGetGlobalData theStation "testData")))
(dbgLog message)
(setq message (cat "System " (sysGetName) " : objGetObjRefData : " (objGetObjRefData theStation "testData")))
(dbgLog message)
)
)
I hoped to see one of the line turn to non-Nil on the one station I modified, but to no avail...
I'll try the same in the StationType to see what it does, but it doesn't help for customizing a single station instance.
- digdug
- Fleet Admiral
- Posts: 2620
- Joined: Mon Oct 29, 2007 9:23 pm
- Location: Decoding hieroglyphics on Tan-Ru-Dorem
if I can understand correctly what are you doing, you want to put arbitrary data on the a station when created (that's why you are tinkering with the <Station> tag)
I think that the only easy way is to create the station with sysCreateStation and then put any data you want into that particular station, because of course if you put staticdata in the <StationType> it will be available to all the stations of that type.
Of course the staticdata can be as complicated as you want with script code and you can run it using the eval function.
I think that the only easy way is to create the station with sysCreateStation and then put any data you want into that particular station, because of course if you put staticdata in the <StationType> it will be available to all the stations of that type.
Of course the staticdata can be as complicated as you want with script code and you can run it using the eval function.
- Mutos
- Militia Lieutenant
- Posts: 218
- Joined: Thu Aug 14, 2008 3:31 am
- Location: Near Paris, France
- Contact:
Hi all, hi digdug,
Yes that's the goal. To be able to create a generic station type with standard data filled in and customize it with different data, for instance particular prices or availability on items for a trading system. I would like to avoid creating a custom StationType for each time I have to customize a data on a station...
More generally, I'm trying to know all the ways in which I can store description data in my stellar systems in the XML and retrieve them at runtime from scripts. There are many ways to do that for now and I have no clear view of what can be done and what can't and what way to use or not in each situation and why.
The question is not about what can be stored as with lists and eval it's indeed everything you want, but it's rather where to store it and how to retrieve...
But maybe with scripts in the stellar system's <OnCreate> event...
Yes that's the goal. To be able to create a generic station type with standard data filled in and customize it with different data, for instance particular prices or availability on items for a trading system. I would like to avoid creating a custom StationType for each time I have to customize a data on a station...
More generally, I'm trying to know all the ways in which I can store description data in my stellar systems in the XML and retrieve them at runtime from scripts. There are many ways to do that for now and I have no clear view of what can be done and what can't and what way to use or not in each situation and why.
The question is not about what can be stored as with lists and eval it's indeed everything you want, but it's rather where to store it and how to retrieve...
But maybe with scripts in the stellar system's <OnCreate> event...
I think the easiest way to do this is to simply in the stations <OnCreate> event say (objSetData gSource "fooname" foovalue) for whatever values you wish to store. This makes your data easily changable, and certainly not any more difficult to access.
- digdug
- Fleet Admiral
- Posts: 2620
- Joined: Mon Oct 29, 2007 9:23 pm
- Location: Decoding hieroglyphics on Tan-Ru-Dorem
prepare a single stationType with all the staticdatas you need like:
then you can run the script you want using:
the name string of the staticdata can be dynamically generated in another script, take a look at the string functions on xelerus, they are a bunch of functions for manipulating strings.
Code: Select all
<StaticData>
<Data1>
script 1 here
</Data1>
<Data2>
script 2 here
</Data2>
</StaticData>
Code: Select all
(eval (itmGetStaticData StationType "Data1"))
- Mutos
- Militia Lieutenant
- Posts: 218
- Joined: Thu Aug 14, 2008 3:31 am
- Location: Near Paris, France
- Contact:
Hi F50, hi digbug, hi all,
F50 : I was thinking about that, I'll test an OnCreate event on a single station.
digdug : OK for that also, it's kind of the same thing I currently do in Global tags.
F50 : I was thinking about that, I'll test an OnCreate event on a single station.
digdug : OK for that also, it's kind of the same thing I currently do in Global tags.