This thread is for you to ask and answer questions about small amounts of code. Please do not ask how to how to make your mod. Those kind of questions go in the extensions reference help me thread.
For example here is a question I have myself.
(setq vary (sysVectorPolarOffset center angle radius))
Is there a way to derive center and radius from vary?
Help me script edition
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
Crying is not a proper retort!
I was wondering, what's this piece of code , and how do you edit it.
Code: Select all
(setq stationList (sysFindObject gSource "T:aresMajor;A"))
- Periculi
- Fleet Officer
- Posts: 1282
- Joined: Sat Oct 13, 2007 7:48 pm
- Location: Necroposting in a forum near you
Fatboy, I think I can handle that one:
First of all, it's creating a List. The (setq declares a variable called stationList and gives it the value that is being returned from (sysFindObject)
(setq string "Hello world") is a simple variable that is holding an obvious string.
(setq myList (list A B C)) is a variable holding a list.
(setq stationList (sysFindObject ...)) is also a variable holding a list.
Now to explain that function- (sysFindObject [spaceObject] "[criteria]") is a built in function to perform searches in a star system.
Please check the functions section on Xelerus for more information about (sysFindObject) (just clicky!)
[spaceObject] is the object that the list is from. Usually gSource for the calling object works, although is it is in an item the player is meant to use you can also use gPlayership.
"[criteria]" takes a preset list of search parameters and also modifiers, data types, and even attributes.
What (sysFindObject returns is always a list. In that usage, it is finding all the stations (T) in the system with the modifier "aresMajor" in them that are active (A). The modifiers are located in the station elements.
sysFindObject returns space objects, not items. Once you have a list of spaceObjects (stations, ships, planets) you can target specific objects on the list.
You can alter the modifiers to anything that is in the game or even to your own custom modifier, you can alter the key type (T,A) to anything you will find on the list describing the function over at xelerus.
Ignore that _changed on the function name on Xelerus- that is the way we show that something has been updated.
First of all, it's creating a List. The (setq declares a variable called stationList and gives it the value that is being returned from (sysFindObject)
(setq string "Hello world") is a simple variable that is holding an obvious string.
(setq myList (list A B C)) is a variable holding a list.
(setq stationList (sysFindObject ...)) is also a variable holding a list.
Now to explain that function- (sysFindObject [spaceObject] "[criteria]") is a built in function to perform searches in a star system.
Please check the functions section on Xelerus for more information about (sysFindObject) (just clicky!)
[spaceObject] is the object that the list is from. Usually gSource for the calling object works, although is it is in an item the player is meant to use you can also use gPlayership.
"[criteria]" takes a preset list of search parameters and also modifiers, data types, and even attributes.
What (sysFindObject returns is always a list. In that usage, it is finding all the stations (T) in the system with the modifier "aresMajor" in them that are active (A). The modifiers are located in the station elements.
sysFindObject returns space objects, not items. Once you have a list of spaceObjects (stations, ships, planets) you can target specific objects on the list.
You can alter the modifiers to anything that is in the game or even to your own custom modifier, you can alter the key type (T,A) to anything you will find on the list describing the function over at xelerus.
Ignore that _changed on the function name on Xelerus- that is the way we show that something has been updated.
So this would find all the commonwealth Fleet stations?
Code: Select all
(setq stationlist (sysFindObject gSource "T:commonwealthFleet;"))
- Periculi
- Fleet Officer
- Posts: 1282
- Joined: Sat Oct 13, 2007 7:48 pm
- Location: Necroposting in a forum near you
CSCTaskForce is a ship. With these attributes:
I think you would need to alter the criteria to find that, yes?
More like (sysFindObject gSource "s:commonFleet") for that I think.
Commonwealth Fortress is a station with these attributes:
You could change the search to look for the commonwealth attribute, or for commonMilitary or commonFleet depending on what you wanted. Just be sure to look up the attributes rather than guessing. You can also output the list to the debug console to see what you got (as UNID):
(dbgOutput (sysFindObject nil "T:commonFleet As"))
Code: Select all
attributes= "commonwealth,commonFleet,commonMilitary,genericClass"
More like (sysFindObject gSource "s:commonFleet") for that I think.
Commonwealth Fortress is a station with these attributes:
Code: Select all
attributes= "commonwealth,commonMilitary,fleetDelivery,friendly,primary,populated"
(dbgOutput (sysFindObject nil "T:commonFleet As"))
- digdug
- Fleet Admiral
- Posts: 2620
- Joined: Mon Oct 29, 2007 9:23 pm
- Location: Decoding hieroglyphics on Tan-Ru-Dorem
just a little intrusion:
I'm updating the functions on xelerus
sysFindObject has been changed in 0.99, it can accept a couple of new attributes.
To reflect that on the xelerus function list, you will find sysFindObject_changed as the old version with attribute 0.98, and sysFindObject with attribute 0.99.
You can search by attribute so you can see all the new 0.99 functions or look at the deprecated and changed functions from 0.98
(that way we can retain old functions and add the new ones)
so
sysFindObject 0.98 http://xelerus.de/index.php?s=functions&function=259
sysFindObject 0.99 http://xelerus.de/index.php?s=functions&function=283
I'm updating the functions on xelerus
sysFindObject has been changed in 0.99, it can accept a couple of new attributes.
To reflect that on the xelerus function list, you will find sysFindObject_changed as the old version with attribute 0.98, and sysFindObject with attribute 0.99.
You can search by attribute so you can see all the new 0.99 functions or look at the deprecated and changed functions from 0.98
(that way we can retain old functions and add the new ones)
so
sysFindObject 0.98 http://xelerus.de/index.php?s=functions&function=259
sysFindObject 0.99 http://xelerus.de/index.php?s=functions&function=283
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
I would like to see a couple functions but can't think of a nice way to do them.
objHasItemByUNID
and
objRemoveItemByUNID
checks if they have or removes an optional count of items that match an id
I would like them to go damaged normal enhanced (I don't care the order of what enhancements are removed, also no removing installed devices)
any takers? (no hurry I don't need them for a mod but it would have made the mod I am making easier)
objHasItemByUNID
and
objRemoveItemByUNID
checks if they have or removes an optional count of items that match an id
I would like them to go damaged normal enhanced (I don't care the order of what enhancements are removed, also no removing installed devices)
any takers? (no hurry I don't need them for a mod but it would have made the mod I am making easier)
Crying is not a proper retort!
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
anyone know a way to get an items description?
I know I can stuff it in static data but would like to do it without overwriting all the items.
I know I can stuff it in static data but would like to do it without overwriting all the items.
Crying is not a proper retort!
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
is there a nice way of telling if a space object has a certain item equipped?
Crying is not a proper retort!
- Mutos
- Militia Lieutenant
- Posts: 218
- Joined: Thu Aug 14, 2008 3:31 am
- Location: Near Paris, France
- Contact:
Hi all,
Back to the old sysFindObject point. In the Xelerus page about it, it's said to be "T:xyz" to get an attribute for stations. This is rather "t:xyz". I tried this for planets, "T:planet" didn't work but "t:planet" did.
Back to the old sysFindObject point. In the Xelerus page about it, it's said to be "T:xyz" to get an attribute for stations. This is rather "t:xyz". I tried this for planets, "T:planet" didn't work but "t:planet" did.
- Periculi
- Fleet Officer
- Posts: 1282
- Joined: Sat Oct 13, 2007 7:48 pm
- Location: Necroposting in a forum near you
That's correct- if you check the search filters description you will find:
Little t = stations including planets
The game considers any spaceObject like a colony, CW fortress or a planet as a station. Even the star is a station. Stations typically don't move, and have features that the other spaceObject type, ships, don't have.
Stations are further divided by a scale="" attribute, which determines "star" scale or "world" scale to distinguish those types from a default station scale.
Big T = structure scale stations (space stations only)xelerus wrote: * G -> Stargates only
* s -> Include ships
* t -> Include stations (including planets)
* T -> Include structure-scale stations
* T:xyz -> Include stations with attribute \'xyz\'
* A -> Active objects only (i.e., objects that can attack)
* B:xyz -> Only objects with attribute \'xyz\'
* D:xyz -> Only objects with data \'xyz\'
* E -> Enemy objects only
* F -> Friendly objects only
* M -> Manufactured objects only (i.e., no planets or asteroids)
* N -> Return only the nearest object to the source
* N:nn -> Return only objects within nn light-seconds
* O:escort -> Ships ordered to escort source
* O:docked-> Ships ordered to dock with source
* O:guard-> Ships ordered to guard source
* R:nn -> Return only objects greater than nn light-seconds away
Little t = stations including planets
The game considers any spaceObject like a colony, CW fortress or a planet as a station. Even the star is a station. Stations typically don't move, and have features that the other spaceObject type, ships, don't have.
Stations are further divided by a scale="" attribute, which determines "star" scale or "world" scale to distinguish those types from a default station scale.