function list

This is a moderated forum that collects tutorials, guides, and references for creating Transcendence extensions and scripts.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
itmIsInstalled

Syntax:
(itmIsInstalled itemStruct)

Argument List:
itemStruct: The itemStruct of the item you want to see if it is installed or not.

Returns:
True if the item is installed Nil otherwise.

Category:
item, query

Description:
Query function to see if the item is installed.

Example:

Code: Select all

(itmIsInstalled (itmCreate 0x4001 3))
Returns Nil.

Comment:
Basic query function for items. Useful if you don't want to use the filters or itmMatches.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
itmMatches

Syntax:
(itmMatches itemStruct criteria)

Argument List:
itemStruct: The itemStruct of the item you want to see if it matches the criteria.
criteria: The criteria you want to see if the item matches.

Returns:
True if the item matches the criteria Nil otherwise.

Category:
item, query

Description:
Query function to see if the item matches the criteria.

Example:

Code: Select all

(itmMatches (itmCreate 0x4173 1) "w +Alien;")
Returns True.

Comment:
Very useful and flexible query function for items. One nice use is separating out things without multiple enum.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
itmHasReference

Syntax:
(itmHasReference itemStruct)

Argument List:
itemStruct: The itemStruct of the item you want to see if it is referenced or not.

Returns:
True if the item is referenced Nil otherwise.

Category:
item, query

Description:
Query function to see if the item is referenced.

Example:

Code: Select all

(itmHasReference (itmCreate 0x4001 3))
Returns True. (level one items start out referenced).

Comment:
Basic query function for items. Referenced means it give the items info like damage and hp on the item listings.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
itmSetReference

Syntax:
(itmSetReference itemStruct)

Argument List:
itemStruct: The itemStruct of the item you want to make referenced.

Returns:
True

Category:
item

Description:
Makes the item referenced.

Example:

Code: Select all

(itmSetReference (itmCreate 0x4021 3))
Makes the Penitent cannon referenced.

Comment:
Referenced means it give the items info like damage and hp on the item listings.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
itmIsKnown

Syntax:
(itmIsKnown itemStruct)

Argument List:
itemStruct: The itemStruct of the item you want to see if it is known or not.

Returns:
True if the item is known Nil otherwise.

Category:
item, query

Description:
Query function to see if the item is known.

Example:

Code: Select all

(itmIsKnown (itmCreate 0x4001 3))
Returns True. (you can't create unknown items in code.).

Comment:
Basic query function for items. Known means it is not an unknown item.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
itmSetKnown

Syntax:
(itmSetKnown itemStruct)

Argument List:
itemStruct: The itemStruct of the item you want to make known.

Returns:
True.

Category:
item

Description:
Makes the item known, if the item is unknown it turns it into its known type.

Example:

Code: Select all

(itmSetKnown (itmCreate 0x4001 3))
Returns True. (you can't create unknown items in code.).

Comment:
Known means it is not an unknown item. If it is unknown it strips away the unknown layer.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
itmSetEnhanced

Syntax:
(itmSetEnhanced itemStruct flag)

Argument List:
itemStruct: The itemStruct of the item you want to enhance.
flag: The flag saying what what type of enhancement you want to enhance the item with.

Returns:
itemStruct: The enhanced item.

Category:
item, enhancement

Description:
Enhances a item depending what kind of item it is and what is the flag.

Example:

Code: Select all

(itmSetEnhanced (itmCreate 0x4001 1) 0x0B00)
Returns a segment of light titanium armor that is immune to radiation.

Comment:
Helpful for enhancing items you create. I need to make an enhancement list.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
lambda

Syntax:
(lambda list function)

Argument List:
list: A list of arguments you want to pass into the function.
function: The code you want to pass the arguments to. It is not evaluated.

Returns:
The new function.

Category:
function

Description:
Function allowing you to create a function for later use.

Example:

Code: Select all

(block (number fun)
	(setq number 5)
	(setq fun (lambda (adder)
		(add 1 adder)
		))
	(dbgOutput number)
	(setq number (fun number))
	(dbgOutput number)
	(setq number (fun number))
	(dbgOutput number)
	)
This displays on the debug console.
5
6
7
True

Comment:
The most important function in all of Transcendence. Allows the creation of functions to be stored and used later. Many creative things can be done with it.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
leq

Syntax:
(leq expression expression)

Argument List:
expression: The first expression you want to compare.
expression: The second expression you want to compare.

Returns:
If the first number is less than or equal to than the second number returns True. If the first number is greater than the second number returns Nil.
If the first string is less than or equal to than the second string returns True. If the first string is greater than the second string returns Nil.
If the first list is less than or equal to than the list string returns True. If the first list is greater than the second list returns Nil.
Otherwise returns Nil.

Category:
logical operator

Description:
It is less than or equal to. The same as <= in math. A string is less than if it is earlier in the dictionary, case is not taken into account.

Example:

Code: Select all

(leq 7 3)
Returns Nil.

Code: Select all

(leq "Betel" "Betelgeuse")
Returns True.

Code: Select all

(leq '(a a b) '(c d e))
Returns True.

Code: Select all

(leq "B" "b")
Returns True.

Comment:
I am not sure how lists are compared but other than that this is your standard comparison function.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
ls

Syntax:
(ls expression expression)

Argument List:
expression: The first expression you want to compare.
expression: The second expression you want to compare.

Returns:
If the first number is less than the second number returns True. If the first number is greater or equal to the second number returns Nil.
If the first string is less than the second string returns True. If the first string is greater or equal to the second string returns Nil.
If the first list is less than the list string returns True. If the first list is greater or equal to the second list returns Nil.
Otherwise returns Nil.

Category:
logical operator

Description:
It is less than. The same as < in math. A string is less than if it is earlier in the dictionary, case is not taken into account.

Example:

Code: Select all

(ls 7 3)
Returns Nil.

Code: Select all

(ls "Betel" "Betelgeuse")
Returns True.

Code: Select all

(ls '(a a b) '(c d e))
Returns True.

Code: Select all

(ls "B" "b")
Returns Nil.

Comment:
I am not sure how lists are compared but other than that this is your standard comparison function.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
loop

Syntax:
(loop condition function)

Argument List:
condition: The function keeps on running as long as the condition is not Nil.
function: The function you want to run as long as the condition is not Nil.

Returns:
Whatever the last run function returns.

Category:
iteration

Description:
Runs the function over and over until the condition is Nil. The function will never be run if the condition starts as Nil.

Example:

Code: Select all

(block (number)
	(setq number 1)
	(loop (ls number 5)
		(block Nil
			(setq number (add 1 number))
			(dbgOutput number)
			"yay"
			)
		)
	)
Displays on the debug console.
2
3
4
5
Returns the string yay.

Comment:
Basic iteration function. Not as useful do to the more advanced iteration functions doing the things that you would do with a loop.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
modulus

Syntax:
(modulus number number)

Argument List:
number: The dividend of the two numbers.
number: The divisor of the two numbers.

Returns:
number: The remainder of the two numbers passed

Category:
Math

Description:
Finds the remainder of the two numbers and returns it.

Example:

Code: Select all

(modulus 56 34)
This code will return the number 22.

Comment:
Important for many things including bounding an arbitrary number between two numbers.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
multiply

Syntax:
(multiply number number)

Argument List:
number: One of the two numbers you want to multiply.
number: One of the two numbers you want to multiply.

Returns:
number: The product of the two numbers passed

Category:
Math

Description:
Finds the product of the two numbers and returns it.

Example:

Code: Select all

(multiply 56 34)
This code will return the number 1904.

Comment:
Basic math function that like all math functions are used all the time.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
not

Syntax:
(not expression)

Argument List:
expression: The expression you want to not.

Returns:
True if the expression evaluates to Nil. Nil otherwise.

Category:
Logical operator

Description:
Returns the logical not of the expression.

Example:

Code: Select all

(not (and Nil 1))
This code will return True.

Code: Select all

(not (or Nil 1))
This code will return Nil.

Comment:
Basic logical function to be used in conditionals.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
objAddItem

Syntax:
(objAddItem spaceObject itemStruct [number])

Argument List:
spaceObject: The space object that you want to add the item to.
itemStruct: The itemStruct of the item you want.
number: A number if there over rides the number of the item in the itemStruct.

Returns:
True.

Category:
item, spaceObject

Description:
Adds the item to the space object. If number is there uses that many items otherwise uses the number of items in the itemStruct.

Example:

Code: Select all

(objAddItem gplayerShip (itmCreate 0x4001 2))
Adds two segments of light titanium armor to the player ship.

Code: Select all

(objAddItem gplayerShip (itmCreate 0x4001 3) 3)
Adds three segments of light titanium armor to the player ship.

Code: Select all

(objAddItem gplayerShip (itmCreate 0x4001 2) 5)
Adds five segments of light titanium armor to the player ship.

Comment:
Very helpful function for adding non random items to a space object from code.
Crying is not a proper retort!
Post Reply