First of all http://xelerus.de/index.php?s=functions&function=246 has a bad example. The example uses staGetGlobalData not staSetGlobalData.
Furthermore, could I use this to change a station's immutabillity? What about changing the frequency of a station? How?
Does this function apply to one space object or all of them? How would do the other?
objSetGlobalData (which doesn't have an example on xelarus) seems interesting too if I could know how to use it.
staSetGlobalData
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
fixed the staSetGlobalData, thanks
global data (and regular data) can store anything you want it to but most things are not stored that way and if they are not stored that way they can not be gotten that way.
From objGetGlobalData "All space objects in the same class share the same global data." This makes seance for staSetGlobalData because you can't even put in a specific station all you can put in is a UNID.
any other questions?
global data (and regular data) can store anything you want it to but most things are not stored that way and if they are not stored that way they can not be gotten that way.
From objGetGlobalData "All space objects in the same class share the same global data." This makes seance for staSetGlobalData because you can't even put in a specific station all you can put in is a UNID.
any other questions?
Crying is not a proper retort!
- Periculi
- Fleet Officer
- Posts: 1282
- Joined: Sat Oct 13, 2007 7:48 pm
- Location: Necroposting in a forum near you
hmm... you can get stations to supply a unique reference to themselves:
View Post in Context here.
But if the next version is offering objGetObjByID then that would be the way to go.
I think that this method from George would do the trick for finding a specific station.george moromisato wrote: 5. Today there is the function (objGetID) which returns a numeric ID for any object that is unique and that persists across games. Unfortunately, today there is no way to get back from an objID to an actual object pointer. In the next version there will be a function called (objGetObjByID) which will return the object pointer from an objID. In that version you should be able to do what you want.
For now, I recommend the following:
a. Let's say that gSource is a station object pointer (e.g., some random armor dealer in the system).
b. First we store the objID of that station in the player ship:
(objSetData gPlayerShip "TheStation" (objGetID gSource))
c. Next we need the armor dealer station to remember its own objID (in future versions this will not be necessary):
(objSetData gSource (cat "ID" (objGetID gSource)) True)
d. When you want to get the station pointer back, you can use:
(sysFindObject gPlayerShip (cat "TD:" (objGetData gPlayerShip "TheStation") ";"))
This will either return Nil (in which case, the station is not in the current system) or it will return a list with the object pointer.
Hope this helps, but if not, feel free to ask clarifying questions.
View Post in Context here.
But if the next version is offering objGetObjByID then that would be the way to go.