Multiplayer Interactive-Fiction Game-Design Blog


Property Definitions No property definitions in the library. Objects



Download 8.87 Mb.
Page137/151
Date02.02.2017
Size8.87 Mb.
#15199
1   ...   133   134   135   136   137   138   139   140   ...   151

Property Definitions


No property definitions in the library.

Objects


No objects in the library.

Functions

Abs


Returns the absolute value of a number.

Returns the absolute value of a number.



Parameter Name

Description

Value

A number.

Return value description

Absolute value.


ACos


Returns the arc-cosine of a number.

Returns the arc-cosine of a number.



Parameter Name

Description

Value

A number.

Return value description

Arc-cosine, in randians.


ASin


Returns the arc-sine of a number.

Returns the arc-sine of a number.



Parameter Name

Description

Value

A number.

Return value description

Arc-sine, in randians.


ATan


Returns the arc-tangent of a number.

Returns the arc-tangent of a number.



Parameter Name

Description

Value

A number.

Return value description

Arc-tangent, in randians.


ATan2


Returns the arc-tangent of a number.

Returns the arc-tangent of a number.



Parameter Name

Description

Y

Y-coordinate of the number.

X

X-coordinate of the number.

Return value description

Arc-tangent, in randians.


Ceil


If this isn't an integer, return's the next highest integer.

If this isn't an integer, return's the next highest integer.

Example:

ceil (123) returns 123.

ceil (123.1) returns 124.

ceil (123.8) returns 124.

ceil (-1.1) returns -1.

Parameter Name

Description

Value

A number.

Return value description

Next highest integer.


ClassesEnum


Enumerates all the classes.

This enumerates all the classes as strings. You can pass a class string into ObjectNew(), for example.



Parameter Name

Description

Return value description

List of all the classes, as strings.


Cos


Returns the cosine.

Returns the cosine.



Parameter Name

Description

Value

Angle, in radians.

Return value description

Cosine of the angle.


CosH


Returns the hypberboloic cosine.

Returns the hypberboloic cosine.



Parameter Name

Description

Value

Angle, in radians.

Return value description

Hypberboloic cosine of the angle.


DeleteGroup


Deletes a group of objects.

This accepts a list of objects and deletes them all at once, including their contained objects.



Parameter Name

Description

ObjectList

List of objects to delete.

DeleteContained

If TRUE then even the object's contents are deleted. If FALSE then the object's contents are left behind.

Return value description

TRUE if success.


Exp


Raise the constant, e, to the specified power.

Raise the constant, e, to the specified power.



Parameter Name

Description

Value

Number.

Return value description

Raise the constant, e, to the specified power.


Floor


If this isn't an integer, return's the next lowest integer.

If this isn't an integer, return's the lowest highest integer.

Example:

floor (123) returns 123.

floor (123.1) returns 123.

floor (123.8) returns 123.

floor (-1.1) returns -2.

Parameter Name

Description

Value

Number.

Return value description

Next lowest integer.


GlobalEnum


Enumerates all the global variables.

This enumerates all the global variables. It returns a list with their names.



Parameter Name

Description

Return value description

List with the names of all the global variables. The names are strings.


GlobalGet


Gets the value of a global.

This gets the value of a global.

x = GlobalGet ("MyGlobal");

is equivalent to

x = MyGlobal;

The only difference is that GlobalGet() lets you access globals created after compile time.



Parameter Name

Description

Global

The name of the global. This must be a string.

Return value description

The value of the global, or Undefined if the global does not exist.


GlobalGetSet


Changes the get/set code for accessing the global.

This adds code for getting or setting a global. Applications can use this to dynamically create code to intercept a global get and set. (If no code exists then the global is accessed directly.)

Example:

GlobalSet ("MyNewGlobal", 0);

GlobalGetSet ("MyNewGlobal", GetFunc, SetFunc);

After this is called, any attempts to change "MyNewGlobal" will be passed to SetFunc(), and any attemps to get the value will be passed to GetFunc().



Parameter Name

Description

Global

The name of the global. This must be a string.

GetCode

This is the code that will be run when the global is read from. It must either be the name of an existing function or method (with object).

If this is NULL the global will be accessed directly when it's read.



SetCode

This is the code that will be run when the global is written to. It must either be the name of an existing function or method (with object).

If this is NULL the global will be accessed directly when it's written.



Return value description

TRUE if the global get/set code is changed, FALSE or Undefined if the call fails.


GlobalQuery


Tests to see if a global variable exists.

This tests to see if a global variable exists.



Parameter Name

Description

Global

The name of the global. This must be a string.

Return value description

TRUE if the global variable exists, FALSE if it doesn't.


GlobalRemove


Removes a global variable from the list.

This removes a global variable from the list.



Parameter Name

Description

Global

The name of the global. This must be a string.

Return value description

TRUE if the global is removed, FALSE if it doesn't exist.


GlobalSet


Sets the value of a global.

This sets the value of a global.

GlobalSet ("MyGlobal", 54);

is equivalent to

MyGlobal = 54;

The only difference is that GlobalSet() lets you access globals created after compile time.



Parameter Name

Description

Global

The name of the global. This must be a string.

If the global does NOT exist then it will be created.



Value

The value to set the global to.

Return value description

The value of the global.

If this is used to create a global, it will normally return the value of the global. However, if the global cannot be created it will return Undefined.




GUIDStringToObject


Converts a 32-character GUID string to an object.

This converts a 32-character GUID string (from ObjectToGUIDString()) to an object reference. The string will be converted even if the object does not exist.



Parameter Name

Description

String

GUID-string of the object. This must be exactly 32 characters long, consisting only of '0'...'9', and 'a'...'f' (or 'A'...'F').

Return value description

Object defined by the GUID. The object reference will be created even if the object doesn't really exist. If the string is not a valid GUID-string then Undefined will be returned.


IsBOOL


Tests to see if the value is boolean.

Returns TRUE if the value is a boolean, FALSE if it is any other type.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsChar


Tests to see if the value is a character.

Returns TRUE if the value is a character, FALSE if it is any other type.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsCharAlpha


Returns TRUE if the character is alphabetical.

Returns TRUE if the character is alphabetical, such as 'A'..'Z' and 'a'..'z', including non-roman.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsCharAlphaNum


Returns TRUE if the character is alphabetical or numeritcal

Returns TRUE if the character is alphabetical or numberical, such as 'A'..'Z' and 'a'..'z', including non-roman, or '0'..'9'.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsCharDigit


Returns TRUE if the character is a digit.

Returns TRUE if the character is a digit, '0' .. '9'.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsCharLower


Returns TRUE if the character is lower case.

Returns TRUE if the character is lower case.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsCharSpace


Returns TRUE if the character is whitespace.

Returns TRUE if the character is whitespace, such as space, tab, and newline.



Parameter Name

Description

Value

Character.

Return value description

Boolean value.


IsCharUpper


Returns TRUE if the character is upper case.

Returns TRUE if the character is upper case.



Parameter Name

Description

Value

Character.

Return value description

Boolean value.


IsFunction


Tests to see if the value is a function.

Returns TRUE if the value is a function or an method associated with an object, FALSE if it is any other type.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsInfinite


Tests to see if a number is infinite.

Returns TRUE if the number is infinite, FALSE if it's finite.



Parameter Name

Description

Value

Value of any type.

Return value description

Returns TRUE if the number is infinite, FALSE if it's finite.


IsList


Tests to see if the value is an list.

Returns TRUE if the value is an list, FALSE if it is any other type.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsMethod


Tests to see if the value is a method.

Returns TRUE if the value is a method, FALSE if it is any other type.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsNan


Tests to see if a value is a number.

Returns TRUE if the value is not-a-number (in the floating point sense), FALSE if it is a number (in the floating point sense).



Parameter Name

Description

Value

A number.

Return value description

Returns TRUE if the value is not-a-number (in the floating point sense), FALSE if it is a number (in the floating point sense).


IsNumber


Tests to see if the value is a number.

Returns TRUE if the value is a number, FALSE if it is any other type.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsObject


Tests to see if the value is an object.

Returns TRUE if the value is an object, FALSE if it is any other type.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsResource


Tests to see if the value is a resource.

Returns TRUE if the value is a resource, FALSE if it is any other type.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


IsString


Tests to see if the value is a string.

Returns TRUE if the value is a string or string table entry, FALSE if it is any other type.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


LanguageGet


Returns the current language.

Returns the language currently in use by the virtual machine. The current language affects what resources and string table entries are used; since they're language specific.



Parameter Name

Description

Return value description

Current language. This is a standard Windows language identifier number.


LanguageSet


Sets the current language.

This sets the current language.

Changing the language affects what resources and string table entries are used; since they're language specific.

Parameter Name

Description

Language

New language to use. This is a standard Windows language number.

Return value description

None


Log


Returns the natural log of the number.

Returns the natural log of the number.



Parameter Name

Description

Value

A number.

Return value description

Returns the natural log of the number.


Log10


Returns the log (base 10) of the number.

Returns the log (base 10) of the number.



Parameter Name

Description

Value

A number.

Return value description

Returns the log (base 10) of the number.


Max


Returns the higher of two values.

Returns the higher of two values.



Parameter Name

Description

Value1

A number or string.

Value2

A number or string.

Return value description

Returns the higher of two values.


Min


Returns the lower of two values.

Returns the lower of two values.



Parameter Name

Description

Value1

A number or string.

Value2

A number or string.

Return value description

Returns the higher of two values.


MMLFromList


Does the inverse of MMLToList().

This does the inverse of MMLToList(). It takes a list, in the same format as is output by MMLToList(), and returns a string with the MML/XML.



Parameter Name

Description

List

List, in the same output format is MMLToList().

OneMainTag

If TRUE, this assumes there is one main MML/XML tag for the entire string. If FALSE, it allows for many.

Return value description

String.


MMLToList


Converts a MML string (or resource) into a list of entries.

A MML string, like "This is a test" is basically an XML string. Resource are also stored in a matter very similar to XML.

This function parses the string or resource, and returns a list with the MML (like XML) all parsed up.

The list contains three elements, [Name, Attributes, Contents].

Name is a string name of the tag, such as "hello".

Attributes is a list containing the attributes of the tag, or NULL if there are no attributes. Each attribute is a sub-list with [AttribName, AttribValue].

Contents is a list containing the contents of the tag, or NULL if there are no contents. The contents are a sub-list with strings, or more sub-lists, are are embeded MML/XML tags.

For example: "This is a test" would be converted to ["hello", [ ["val", "43"] ] , ["This is a test"] ].



Parameter Name

Description

MMLOrResource

Either an MML string or a resource.

OneMainTag

If TRUE, this assumes there is one main MML/XML tag for the entire string. If FALSE, it allows for many. If a resource is passed in, this MUST be set to TRUE.

For example: "This is a test" would get converted to ["hello", NULL, ["This is a test"]] if OneMainTag is TRUE. It would be converted to [NULL, NULL, [ ["hello", NULL, ["This is a test"]] ]] if OneMainTag is FALSE.

For example: "
LineOne

Line two
" MUST have OneMainTag set to TRUE.



Return value description

List. See the main description.


ObjectClone


Clones an object or set of object.

This clones an object or set of objects. All the object's contents (sub-objects) are also cloned.

The object's properties and timers are copies, with references to cloned objects remapped to their clones. If an object is cloned, but its parent is NOT cloned, then the clone's will NOT be contained by any object.

Once all the objects have been cloned, the Property will be set to PropertyValue, and then all the objects will be called with Constructor2().



Parameter Name

Description

Clone

This is either a single object, or a list of objects. Any objects contained within these objects are also cloned.

Property

If this is a string, then all the cloned objects will have this propery, such as "pCloneOf" set to the value from PropertyValue. The value will be set BEFORE Constructor2() is called for the cloned object. This is useful to identify which objects are cloned.

If NULL, then no property will be set.



PropertyValue

Value to set the Property to.

Return value description

Returns a list of all the cloned objects. Each cloned object is a sub-list with [Original object, New object]. The list is NOT sorted. You can use this to later delete the clones.


ObjectEnum


Enumerates all the objects.

This returns a list of all the objects.



Parameter Name

Description

Return value description

List of all the objects.


ObjectNew


Creates a new object from a name or other object.

This creates a new object from a name or other object. It acts like "new XXX;" except that an arbitrary object class can be created.



Parameter Name

Description

Create

This can be a string containing the object's class, such as ObjectNew ("oMyObject"); which is equivalent to "new oMyObject;". Or, this can be another object, in which case the base class/layer will be used. (Ex: ObjectNew (oMyObject) will create an object with the same class as oMyObject.)

Return value description

The new object, or NULL if error.


ObjectQuery


Tests to see if an object exists.

This tests to see if an object exists. An object may have been delete.

For example:

x = new Object;

ObjectQuery(x); // returns TRUE

delete x;

ObjectQuery(x); // returns FALSE

Parameter Name

Description

Object

Object to test.

Return value description

TRUE if the object exists, FALSE if it doesn't.


ObjectToGUIDString


Converts an object to a 32-character GUID string.

This converts an object reference to a 32-character GUID string. The string is 32 hexadecimal digits that uniquely identify the object.



Parameter Name

Description

Object

Object

Return value description

String with the object's GUID. If it's not an object then Undefined is returned.


Pow


Raise a number to the specified power.

Raise a number to the specified power.



Parameter Name

Description

Base

Number to raise.

Exponent

Power to raise it to.

Return value description

The number raised to the specified power.


Random


Returns a random value.

This returns a random value.

If no parameters are passed, it's a random value between 0 and 32767.

If one parameter is passed in, and the parameter is a list, this returns one of the elements of the list.

If one parameter is passed in, and the parameter isn't a list, this returns a random number between 0 (inclusive) and Value1. (exclusive)

If two parameters are passed in, this returns a random number between Value1 (inclusive) and Value2 (exclusive).



Parameter Name

Description

Value1

(Optional) A number. If only one parameter is provided then this can be a list.

Value2

(Optional) A number.

Return value description

Random number or selection from the list.


RandomSeed


Seeds the random value.

This seeds the random value. You can set the seed to ensure that calls to Random() are follow the same pattern every time.



Parameter Name

Description

Seed

(Optional) Seed number, 0 to 4 billion. If no parameter is used then the seed will be based on the current time.

Return value description

None


ResourceEnum


Enumerates a list of all the resources in the project.

This enumerates a list of resources in the project.



Parameter Name

Description

Return value description

List of resources.

Each resource is represented by a sub-list with [ResourceName, ResourceType]. ResourceName is the name of the resource, that can be passed to ResourceGet(). ResourceType is the type of the resource, such as "TransPros".




ResourceGet


Gets a resource given a string name.

Gets a resource given a string name.

For example: ResourceGet ("rMyResource") will return the resource, rMyResource. If the resource doesn't exist, it returns NULL.

Parameter Name

Description

ResourceString

String for the resource.

Return value description

Resource as a value.


Round


Rounds the value to the nearest integer.

Rounds the value to the nearest integer.

Example:

round (123) returns 123.

round (123.1) returns 124.

round (123.5) returns 124.

round (123.8) returns 124.

round (-1.1) returns -1.



Parameter Name

Description

Value

A number.

Return value description

Rounds the value to the nearest integer.


Sin


Returns the sine.

Returns the sine.



Parameter Name

Description

Value

Angle, in radians.

Return value description

Sine of the angle.


SinH


Returns the hypberboloic sine.

Returns the hypberboloic sine.



Parameter Name

Description

Value

Angle, in radians.

Return value description

Hypberboloic sine of the angle.


Sqrt


Returns the square root of a number.

Returns the square root of a number.



Parameter Name

Description

Value

A number.

Return value description

Returns the square root of a number.


Tan


Returns the tangent.

Returns the tangent.



Parameter Name

Description

Value

Angle, in radians.

Return value description

Tangent of the angle.


TanH


Returns the hypberboloic tangent.

Returns the hypberboloic tangent.



Parameter Name

Description

Value

Angle, in radians.

Return value description

Hypberboloic tangent of the angle.


TimeFromDateTime


Converts from a year, month, day, etc. to a time (in days) since January 1, 1601.

This converts from a year, month, day, etc. to a time (in days) since January 1, 2001.



Parameter Name

Description

GMT

If TRUE then the time is GMT (system) time. If FALSE then time is in the local computer's time.

Year

Year. Example: 2004

Month

Month. 1..12

Day

Day. 1..31

Hour

Hour. 0..23

Minute

Minute. 0..59

Second

Second. 0..59

Milliseconds

Milliseconds. 0..999

Return value description

Time. If an error occurs this returns NULL.


TimeGet


Gets the time.

This returns the time. This is a single number, which is the number of days since January 1, 2001.

To convert it to year, month, day, etc. call TimeToDateTime()

Parameter Name

Description

Return value description

Number of days since January 1, 1601.


TimeSinceStart


Returns the number of seconds that the computer has been running.

Returns the number of seconds that the computer has been running.

This is a good time function to check how many seconds, minutes, or hours of real-time have ellapsed.

Parameter Name

Description

Return value description

Number of seconds since the computer was started.


TimeToDateTime


Converts from a time (in days) to a year, month, day, etc.

This converts from a time (in days) to a year, month, day, etc.

It accepts a time from TimeGet() or TimeFromDateTime() and returns a list. The elements of the list contain the year, month, day, etc.

Parameter Name

Description

Time

Time from TimeGet() or TimeFromDateTime()

GMT

If TRUE then the time is calculated as GMT (system) time. If FALSE then time is calculated in the local computer's time.

Return value description

Returns a list. List[0] = year (ex: 2004), List[1] = month (1..12), List[2] = day (1..31), List[3] = hour (0..23), List[4] = minute (0..59), List[5] = second (0..59), List[6] = milliseconds (0.999), List[7] = day of week (1..7).


TimeZone


Returns the time zone information.

This returns the offset in time for the current time zone, in days. UTC = local time + TimeZone().



Parameter Name

Description

Return value description

Offset in days.


ToBool


Converts the value to a boolean.

Converts the value to a boolean.



Parameter Name

Description

Value

Value of any type.

Return value description

Boolean value.


ToChar


Converts the value to a character.

Converts the value to a character.



Parameter Name

Description

Value

Value of any type.

Return value description

Character.


ToFunction


Converts the value to a function.

Converts the value to a function.



Parameter Name

Description

Value

Value of any type, but usually a string of the function's name.

Return value description

Function, or undefined if it can't be converted.


ToMethod


Converts the value to a public method.

Converts the value to a public method.



Parameter Name

Description

Value

Value of any type, but usually a string of the method's name.

Return value description

Method, or undefined if it can't be converted.


ToNumber


Converts the value to a number.

Converts the value to a number.



Parameter Name

Description

Value

Value of any type.

Return value description

Number.


ToObject


Converts an object.method to an object, or a hexadecimal string to an object.

Converts an object.method to an object, or a hexadecimal string to an object.

If the value is an Object.Method, this will return the object part. If the string is a 32-digit hexadecimal string, this will return an object ID, which may not be valid. If an object is passed in, the same object will be returned. Otherwise, it returns undefined.

Parameter Name

Description

Value

Value of any type.

Return value description

Object or undefined.


ToString


Converts the value to a string.

Converts the value to a string.



Parameter Name

Description

Value

Value of any type.

Return value description

String.


ToStringMML


Sanitizes a string to it can be placed into a resource.

Resources uses a tagged text system called MML (very similar to XML). MML uses special characters, like < and > to indicate the start of a section, such as:



Hello there!

Because some characters are used by the tag system (< and >), these can't be included directly in the strings. These need to be converted to character codes. In this case, '>' is converted to '<' and '<' is converted to '>'.

If you want to create create your own resources that include strings you will need to do these conversions. The easiest way is to use the ToStringMML() function.

For example: To speak "2 <3" you would use:

"" + ToStringMML("2 < 3") + "

This produces the string:

"2 < 3"

Parameter Name

Description

String

The string that is to be "sanitizied" so it can be placed in a resource string.

Return value description

Sanitized version of the string, which characters like '<' converted to '<', etc.


Trace


Outputs the string to the debug trace and/or for logging.

Calling trace with a string (or other value) will output the string to the debug trace. It will also output the string for logging purposes.

For example:

Trace ("Write this in the log.\n");

will write the data in the log.

Parameter Name

Description

String

String that should be output to the debug trace, or the log.

Return value description

None


TypeOf


Returns the data's type as a string.

Returns the data's type as a string.

The following strings are returned:

"bool" for a boolean

"char" for a character

"function" for a function

"list" for a list

"list.method" for a method call into a list

"method" for a method

"number" for a number

"null" for a NULL value

"object" for an object

"object.method" for a method call into an object

"resource" for a resource reference

"string" for a string

"string.method" for a method call into a string

"stringtable" for a stringtable reference

"undefined" for undefined



Parameter Name

Description

Value

Value to check the type of.

Return value description

String for the value's type.



Download 8.87 Mb.

Share with your friends:
1   ...   133   134   135   136   137   138   139   140   ...   151




The database is protected by copyright ©ininet.org 2024
send message

    Main page