## function list

This is a moderated forum that collects tutorials, guides, and references for creating Transcendence extensions and scripts.
digdug
Posts: 2614
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem
Name:
sysVectorMultiply

Syntax:
(sysVectorMultiply vector number)

Argument List:
vector: the vector you want to be multiplied
number: the integer that multiply the vector

Returns:
vector: the new position after the multiplication

Category:
vector operator, system

Description:
This function returns a position (vector) after multipling the submitted vector by the integer

Example

Comment:
Basic vector operator function

digdug
Posts: 2614
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem
Name:
sysVectorDistance

Syntax:
(sysVectorDistance vector vector)

Argument List:
vector: the first vector
vector: the second vector for calculating the distance

Returns:
number: distance between the 2 vectors in light-seconds

Category:
vector operator, system

Description:
This function calculates the distance from two given positions (vectors)

Example

Comment:
Basic vector operator function

Betelgeuse
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am
Name:
fnchelp

Syntax:
(fnchelp function)

Argument List:
function: The function that you want to get the help text of.

Returns:
string: The help text of the passes in function.

Category:
function

Description:
Returns the help text for the given function.

Example:

Code: Select all

``(fncHelp dbgOutput)``
Returns the string "(dbgOutput string [string]*)".

Comment:
Not really useful now that we have docs. We can not have help text for non inbuilt functions in .98d
Crying is not a proper retort!

Betelgeuse
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am
Name:
iserror

Syntax:
(iserror expression)

Argument List:
expression: The expression that you want run and see if it is an error.

Returns:
conditional: True if it does contain an error, Nil otherwise.

Category:
error

Description:
Returns if the expression evaluated to an error or not.

Example:

Code: Select all

``(iserror (divide 10 0))``
Returns True.

Comment:
Not as useful as would first seem due to many errors giving you a hard crash and the fact you can't raise your own errors.
Crying is not a proper retort!

Betelgeuse
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am
Name:
errblock

Syntax:
(errblock List function^1 function)

Argument List:
List: A list of temporary variables. The first variable gets any error stored in it that happens.
function: The functions you want to run.
^1
function: The function you want to run if there is an error in the other functions.

Returns:
Whatever the last function or primitive that runs in it returns.

Category:
Control Structure, error

Description:
Allows you to run functions one right after the other. If there is an error the error is stored in the error variable and then runs the last function. If no errors the last function isn't run.

Example:

Code: Select all

``````(errblock (errVar)
(dbgOutput "Running normally")
(divide 10 0)
(dbgOutput "Not running normally")

(dbgOutput "The error is " errVar)
)``````
Displays
Running normally
The error is Division by zero (10 0) ### (divide 10 0) ###
True

Comment:
Like iserror not as useful as it could be due to many errors hard crash the game and you can't throw your own errors.
Crying is not a proper retort!

F50
Militia Captain
Posts: 995
Joined: Sat Mar 11, 2006 5:25 pm
http://xelerus.de/index.php?s=functions&function=229
(sovSetDisposition &svCSCAntarctica; &svPlayer; 0)
Makes things controlled by the Antarctica sovereign not attack the player.
This is wrong.

That line of code will make the Antarctica *attack* the player. Any other value will cause the Antarctica to not attack the player. Quite simply, the site has got it backwards.

Betelgeuse
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am
oops sorry thanks for the correction

anyone else if you see something wrong please say so I will gladly correct it.
Crying is not a proper retort!

Betelgeuse
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am
just to let everyone know many 0.99 functions are on http://xelerus.de/index.php?s=functions and we are still updating them.
Crying is not a proper retort!

digdug
Posts: 2614
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem
The function List in TXT has been updated.
(The zip file contains also the previous version.)

http://xelerus.de/index.php?s=mod&id=46&d=1

digdug
Posts: 2614
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem
Just a small reminder:
you can find 2 new categories for the functions on Xelerus:

0.98: List all the functions that have been deprecated or changed in 0.99.

0.99: List all the new functions in 0.99, if you're interested in only them.

Darth Saber
Militia Commander
Posts: 290
Joined: Mon Aug 04, 2008 4:53 pm
Location: Korriban
Okay,

Would someone be willing to compile each of the functions, together with their syntax and an example of how to use it, into a working, searchable, HTML web page?

alterecco
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym
Darth Saber wrote:Okay,

Would someone be willing to compile each of the functions, together with their syntax and an example of how to use it, into a working, searchable, HTML web page?
Umm, have you ever visited xelerus.de ??

Darth Saber
Militia Commander
Posts: 290
Joined: Mon Aug 04, 2008 4:53 pm
Location: Korriban
The obvious answer to that is yes; however, the function list in downloadable HTML format is from 2007 - three years ago. Since then we have progressed from .98d to RC8. It is also notable that many of the functions in that list did not include adequate examples of syntax usage, or explanations. This is why there is a need for an updated version which contains not only the function's name and syntax, but also an example of its usage. Some of us were not born omniscient, therefore we need help in many forms. This would be a valuable reference guide.

alterecco
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym
Please realize that there are people working on the function list in their free time, and it is a lot of work to do this. I myself have updated the functions from the start up to a certain point, and the next chance I have I will continue. The real props go to Betelgeuse who must have spent forever to compile that list. There is no omniscience involved in this process, just a lot of work and experimenting.

That said, please feel free to contribute to the function list on xelerus. I am sure one with editor rights (afaik, bimbel, Betel, digdug and me) would be happy to recieve your help.

There is also a link to a single page function list here: http://xelerus.de/functions.txt. Perhaps it will suit you better?

Edit:
Reading your post again leaves me in doubt? Have you not used the function list on xelerus? It is almost up to date with the latest RC's, and what is missing will eventually be added? It is without a doubt the most complete reference to the functions we have available (apart from the vanilla source itself). Without this list I would not have been able to do the mods I have done. I use it all the time when modding.

Styro
Miner
Posts: 46
Joined: Mon Jan 18, 2010 4:55 pm
Location: Utah, USA
And some of the information there is incorrect.

For example, the entry for shpOrderEscort says that the last parameter is "a number from 0 to 35 representing the position behind the ship is it escorting". It is actually 0 to 360 and represents the degree at which the wingman will be around the ship. So a value of 90 will place the wingman directly to the left of the escorted ship and 180 will place the wingman directly to the right. The values can actually go above 360 (and probably negative) and it still places the ship correctly (720 would place the wingman directly in front of the escorted ship.

It would also probably be better to have the information as a wiki so when people find errors they can correct them.