-
Function: Functions are various mathematical formulas available through the expression editor that allow you to have the Creator calculate sines, cosines, logs, and much more.
-
abs (Function): provides the “absolute value” of a number. In other words, it will make a negative number into a positive number.
For example, abs(-5.23)=5.23.
-
acos (Function): This is the trigonometric arccosine (inverse cosine) function. Values for x should range from -1 to 1, with results from 180 to 0, respectively. Any other input values will result in ‘nan’.
-
asin (Function): This is the trigonometric arcsine (inverse sine) function. Values for x should range from -1 to 1 with results from -90 to 90, respectively. Any other input values will result in ‘nan’.
-
atan (Function): This is the trigonometric arctangent (inverse tangent) function. Results will range from -90 to 90.
-
ceil (Function): The integer when you round up a value.
For instance, ceil(0.3095)=1, ceil(9.2850)=10, and ceil(-3.5)= -3.
-
cos (Function): This is the trigonometric cosine function. cos(0)=1.
For more information on sine and cosine, see http://en.wikipedia.org/wiki/Trigonometric_functions
-
exp (Function): The exponential function e^x, where e is approximately 2.71828182818.
For more information, see http://en.wikipedia.org/wiki/Exponential_function
-
floor (Function): The integer when you round down a value. For instance, floor(1.5)= 1, floor(9.2850)= 9, and floor(-3.5)= -4.
-
In (Function): The natural logarithm of a value. The natural logarithm is the logarithm to the base e, where e is approximately 2.71828182818.
For more information, see http://en.wikipedia.org/wiki/Natural_logarithm
-
log10 (Function): The base 10 logarithm of a value.
For instance, log10(10)=1, log10(100)=2.
For more information, see http://en.wikipedia.org/wiki/Logarithm
-
magnitude (Function): Finds the length of a line segment drawn directly from the origin 0,0 to the given point.
You can also include an offset to find the length between two points – for example, magnitude(x-x’,y-y’).
If you have one actor at 100, 240 and another at 25, 30, you can find the distance between them with magnitude(25-100,30-240).
-
max (Function): Returns the higher value of the two numbers or variable units. This can be very useful for determining if a new score is higher than an existing score, or for other similar comparisons.
For example, max(12,35)=35.
-
min (Function): Returns the smaller value of the two numbers or variable units.
For example, min(12,35)=12.
-
padInt (Function): Displays an integer with the specified number of digits.
For instance, padInt(32,5) will display 00032. However, padInt(38025,2) will display 38025. It will always display at least the minimum number of digits needed to retain the value of x.
-
padReal (Function): Displays a floating point with padding and precision.
For instance, padReal(9.1234,15,6) will display 9.1234 with at least 15 total digits (including the decimal) and at most 6 digits to the right of the decimal. – 00000009.123400.
-
pow (Function): Returns the value of x to the power of y.
For example, pow(2,3)=222=8.
-
precision (Function): Displays a floating point number with the specified number of decimal places.
For instance,prec(1234.234,2) will display 1234.23.
-
random (Function): Returns a random integer equal to or between the first integer and the second.
For instance, random(1,5) could return any of the following values: 1,2,3,4,5.
-
sin (Function): The trigonometric sine function. This is similar to the cosine function, but is offset by one quarter of a wave cycle. For more information, see http://en.wikipedia.org/wiki/Trigonometric_functions
Tip: if you use the sine function and start your incrementing variable at 0, your actor’s movement does not start at the middle point between the minimum and maximum points of the wave.
-
sqrt (Function): Provides the square root of a value. Input values less than 0 will result in ‘nan’.
-
tableCellValue (Function): Returns the value of a cell of a selected table at a certain row and column. Tables are numbered starting at 1. You can also use the row or column name as an input for this function.
For example, tableCellValue(game.Data,1,15) will return the value in table, Data, at row 1 and column 15.
-
tableColCount (Function): Returns the number of columns in the selected table.
-
tableColNumber (Function): This will return the column number with the given column label.
-
tableColSum (Function): Returns the sum of the table cells in a given column between the starting row and ending row. This only works on numerical type columns (integer, real, angle).
-
tableMergeValues (Function) – This will return a string value with the concatenated values from a given column or row (depending on the setting in the 2rd parameter). If the start range is greater than end range, then it will go from last value to first value, appending to the end. The separator will be concatenated between each value.
-
tableRowCount (Function): Returns the number of rows in the selected table.
-
tableRowNumber (Function): This will return the row number with the given row label. It will return 0 if it doesn’t exist. This is useful if you want to jump to a section of a table and start iterating through rows from there.
-
tableSearch (Function): Searches a given column or row (depending on the setting in the 3rd parameter), and returns the index for the first instance of the given key (or keyword) where a match is found (also depending on the match type as set in the 7th parameter). It will search between the specified range. If the start range is greater than the end range, it will do a reverse search. A “0” will be returned if the key value is not found. If you specify “not” in front of the last parameter, it will check against the opposite search.For example,
tableSearch(game.table,”yes”,”row”,1,1,10,”exact”)will look for the first instance of “yes” in a cell value in row 1 between columns 1 and 10, and return the column value. WhiletableSearch(game.table,”yes”,”row”,1,1,10,”notexact”)will return the column number where the cell value is not exactly “yes”. -
tan (Function): The trigonometric tangent function. For more information, check outhttp://en.wikipedia.org/wiki/Trigonometric_functions
-
textFind (Function): Returns the index of the location of the text, pattern, in the text attribute, text, starting the index startIndex. If the text was not found, it returns “-1”. CASE SENSITIVEUsage: Given a text attribute with the value “the quick sly fox jumped over the lazy dog.”
textFind(self.Text,”the”,1) returns the value 1.
However, textFind(self.Text,”the”,2) returns the value 31.
-
textLength (Function): This returns the length of the text or numerical attribute
-
textRepeat (Function): Returns a text which repeat the text attribute, text, n times, where n is a non-negative integer value.Usage: Given a text attribute with the value “yo”, textRepeat(self.Text,2) returns the value “yoyo”.
You can also enter the text directly into the function and use an expression for the n value. For example: textRepeat(“buffalo”,mod(self.Time,3)) will return either “buffalo” or “buffalo buffalo” depending on the time.
-
textReplace (Function): This will return the text or text attribute, text, with the first instance of text value, pattern, with text value, replacement.Usage: Given you have a list of separated values in a text attribute like, “s01s02s03s04s05s”, you can replace “s02s” with “s” to signify that question 2 has already been used. See the textSubStr for more usage.
-
textReplaceAll (Function): This works just like the textReplace function but will return a text value with ALL instances replaced.
-
textSubStr (Function): This returns a text which is the substring of attribute, text, starting from index startIndex and ending at index endIndex.Usage: Given a text attribute with the value “the quick sly fox jumped over the lazy dog.”
textSubStr(self.Text ,5,8)returns the value “quic”. You can also use this to extract a random set of numbers from a string and use that as a way to choose a unique question via table row number. -
vectorToAngle (Function): Finds the angle relative to the origin 0,0, given an X and Y coordinate. For instance, vectorToAngle(100,200)=63.435. You can also find the angle relative to an offset.
For instance, vectorToAngle(x-x’,y-y’).
VectorToAngle(100-200,150-250) will find the angle between the points 100,150 and 200,250, or -135 degrees.
-
round (Function): The integer when you round to the nearest. If exactly 0.5 between two integers, the result is the greater.
For instance, round(1.5)= 2, round(9.2850)= 9, and round(3.7)= 4.
-
roundTo (Function): Round a real number to a specific decimal digit. Unlike the precision function, the return value is still a number, not text. To pad the decimal with 0’s for display purposes, use the precision function instead.
Examples:
roundTo(0.12345, 3) = 0.123;
roundTo(2.5, 0) = 3;
roundTo(4, 2) = 4;