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

with the help of help I have added all the missing functions (check the first post it is huge :D) including the xml functions (might as well define them in case people want to overwrite or just need them)
Last edited by Betelgeuse on Sat Dec 08, 2007 8:28 am, edited 1 time in total.
Crying is not a proper retort!
User avatar
bimbel
Militia Lieutenant
Militia Lieutenant
Posts: 181
Joined: Wed Jul 05, 2006 8:22 am
Location: Germany
Contact:

Betelgeuse wrote:hmm how about this lets put it on a website but allow people to download the html files in a pack so they can use them offline.
That would be possible but it would have limited usability! Because you can just download the html but php/MySQL is doing all the dynamic things like sorting or filtering.

But still I'm in favor of this idea!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

hmm lets think of some filters

filter by what it returns (ie I want just things that return strings)
filter by what it has in the argument list
filter by use category (would have to make categories but that is easy)

Description text search

Would have to make pages describing the various types and the argument lists can link to that so people can understand what can go in there. (those pages can have a preset filter showing things that return it or things that have it in its argument list.

Categories should have pages too showing some more advanced examples like insertion into the middle of a list and lists within lists.
Crying is not a proper retort!
Apemant
Commonwealth Pilot
Commonwealth Pilot
Posts: 94
Joined: Mon Dec 03, 2007 12:51 pm

Ok, so how do we do this? Everyone submits a part of it here in this thread and someone sorts it out? Hmm a template of some sort would be welcome here... then I could write a few descriptions of some basic script principles and constructs...
User avatar
bimbel
Militia Lieutenant
Militia Lieutenant
Posts: 181
Joined: Wed Jul 05, 2006 8:22 am
Location: Germany
Contact:

I think before we start gather information we should try to make a plan waht informations we want to display and how we want to display them!
So we have all data on one level which will make it easier to format or use otherwise!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

well here is a list of data that we need for each one. Can anyone think of anything else?

name
argument list (can someone post a nice format to put this in we need the format before we can supply the data)
what it returns (everything returns something just most return Nil)
category (we need a list of categories)
Description
Example
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

hmm how about for argument list it would just put a ^X after the argument type to mean the last X arguments can be repeated as many times as needed. Each line would be an argument type followed by a description of what it is.

here is an example

Name
objEnumItems

Argument List
object: The space object that you want to look through the items of.
modifiers: A filter saying what kinds of items you want.
variable: A variable used by the function that will contain each of the items that where allowed by the filter.
function: The function that will be applied for each of the items that follow the filter.

Returns
Nil

Category
object, iteration

Description
For each item that passes the filter in this object it will run the function using the variable to contain that item.

Example

Code: Select all

(objEnumItems gPlayerShip "dI" theItem
			(plyMessage gplayer (itmGetName theItem 4))
			)
This will when run tell the player all the items on the players ship that are installed devices.


Any suggestions on how it can be better.
Crying is not a proper retort!
User avatar
Ttech
Fleet Admiral
Fleet Admiral
Posts: 2767
Joined: Tue Nov 06, 2007 12:03 am
Location: Traveling in the TARDIS
Contact:

Betelgeuse wrote:hmm how about for argument list it would just put a ^X after the argument type to mean the last X arguments can be repeated as many times as needed. Each line would be an argument type followed by a description of what it is.

here is an example

Name
objEnumItems

Argument List
object: The space object that you want to look through the items of.
modifiers: A filter saying what kinds of items you want.
variable: A variable used by the function that will contain each of the items that where allowed by the filter.
function: The function that will be applied for each of the items that follow the filter.

Returns
Nil

Category
object, iteration

Description
For each item that passes the filter in this object it will run the function using the variable to contain that item.

Example

Code: Select all

(objEnumItems gPlayerShip "dI" theItem
			(plyMessage gplayer (itmGetName theItem 4))
			)
This will when run tell the player all the items on the players ship that are installed devices.


Any suggestions on how it can be better.
Like a loop?
Image
Image
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

yes it is like a loop because both are iteration functions.
Crying is not a proper retort!
User avatar
Ttech
Fleet Admiral
Fleet Admiral
Posts: 2767
Joined: Tue Nov 06, 2007 12:03 am
Location: Traveling in the TARDIS
Contact:

Betelgeuse wrote:yes it is like a loop because both are iteration functions.
Wouldbn't that be a lot of on screen text though?
Image
Image
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

It is just an example there are many reasons why you would want to go through every item of a certain type in a space object.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
add

Syntax:
(add number number)

Argument List:
number: A number you want to add
number: The other number you want to add

Returns:
number: The sum of the two numbers passed

Category:
Math

Description:
Sums up the numbers passed to it and returns the result.

Example:

Code: Select all

(add 1 2)
This code will return the number 3.

Comment:
I am not sure why add only takes two arguments. :?
Last edited by Betelgeuse on Tue Dec 11, 2007 10:00 am, edited 4 times in total.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
and

Syntax:
(and condition condition^1)

Argument List:
condition: Something other than Nil or Nil
condition: Something other than Nil or Nil
^1

Returns:
condition: the result of anding all of the conditions

Category:
Logical

Description:
Returns True if all the conditions are not Nil otherwise returns Nil.

Example:

Code: Select all

(block (someCondition) 
	(setq someCondition True)
	(and someCondition Nil)
	)
This will return a Nil.

Comment:
Logical functions are very important in if and while functions.
Last edited by Betelgeuse on Fri Jan 04, 2008 4:28 am, edited 4 times in total.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
append

Syntax:
(append List List^1)

Argument List:
List: The list you want to start the new list
List: The list you wanted added on to the list.
^1

Returns:
List: A new list containing all the elements of the passed in lists with their order preserved.

Category:
List Operator

Description:
Makes a new list with all the elements of the passed in lists in the order that they came in at.

Example:

Code: Select all

(append '(a b c) '(d e))
Will return the list (a b c d e)

Code: Select all

(append '(a) '(d) '(b e))
Will return the list (a d b e)

Comment:
The reason why I repeat List in the argument list is because this must have at least two lists.
Last edited by Betelgeuse on Tue Dec 11, 2007 10:02 am, edited 1 time in total.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

Name:
apply

Syntax:
(apply Function List)

Argument List:
Function: The function you want to run.
List: A list of arguments you want the function to be run with.

Returns:
Whatever the function returns.

Category:
Function Operator (can someone think of a better category for this?)

Description:
Runs the function as though it was called normally using the list as its arguments.

Example:

Code: Select all

(block (someArgumentList)
	(setq someArgumentList '(True True Nil))
	(apply and someArgumentList)
	)
This will return Nil.

Code: Select all

(block (someArgumentList) 
	(setq someArgumentList '(1 34))
	(apply add someArgumentList)
	)
This will return 35.

Comment:
Much more powerful than first appears. Both the function and argument list can vary.
Last edited by Betelgeuse on Tue Dec 11, 2007 10:04 am, edited 1 time in total.
Crying is not a proper retort!
Post Reply