RPTools.net

Discussion and Support

Skip to content

It is currently Wed Nov 22, 2017 12:42 am 






Reply to topic  [ 6 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Sun Apr 17, 2011 1:27 pm
Posts: 14
 Post subject: Functions for data.
PostPosted: Tue May 24, 2011 6:56 pm 
I know that there are standard functions such as lt().

Is there anywhere that I can go to find a list of them?

Specifically, I'm wondering if their is a max function, or if I have to do...

<code>if(lt(root.str.currentMod, root.wis.currentMod), root.wis.currentMod, root.str.currentMod))</code>

...to get the which one is more.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7948
Location: Bay Area
 Post subject: Re: Functions for data.
PostPosted: Tue May 24, 2011 7:07 pm 
I have http://lmwcs.com/rptools/wiki/Category:Macro_Function bookmarked for easy reference, but you'll see more stuff on the menu for things other than functions. Any reason you're not using the overload operators like < ?

_________________
Downloads:


Top
 Profile  
 
 Offline
Kobold
 
Joined: Sun Apr 17, 2011 1:27 pm
Posts: 14
 Post subject: Re: Functions for data.
PostPosted: Tue May 24, 2011 7:11 pm 
I was copying what I saw on other functions. Whoever did the PHB2 originally (where I've been getting a lot of my coding syntax for the rpdat files) didn't use them. I don't know why.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7948
Location: Bay Area
 Post subject: Re: Functions for data.
PostPosted: Tue May 24, 2011 7:42 pm 
Oops.. I thought this was under macros. I have very little experience with character tool. I'm not sure what syntax or libraries the character tool uses.

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
RPTools Team
 
Joined: Tue Feb 07, 2006 1:07 am
Posts: 1766
Location: Austin, Tx
 Post subject: Re: Functions for data.
PostPosted: Wed May 25, 2011 2:10 pm 
Here are all of the extra functions in CT/IT:
  • and(boolean [,boolean]*), booelan && boolean: And one or more Boolean values and return a Boolean value. This replaces the and function in the base parser.
  • contains(string, string): Checks to see if the first string parameter contains the the text in the second string parameter and returns a Boolean value.
  • containsIgnoreCase(string, string): Checks to see if the first string parameter contains the the text in the second string parameter ignoring case and returns a Boolean value..
  • equals(p1, p2), eq(p1, p2), p1 == p2: Checks to see if the two parameters are the same and returns a Boolean value. Replaces equals in the base parser.
  • ne(p1, p1), p1 != p2: Checks to see if the two parameters are not the same and returns a Boolean value. Replaces not equals in the base parser.
  • eqic(p1, p1): Checks to see if the two parameters are equal ignoring case and returns a Boolean value. Replaces eqic in the base parser.
  • neic(p1, p1): Checks to see if the two parameters are not equal ignoring case and returns a Boolean value. Replaces neic in the base parser.
  • script(fileName, scriptName [,scriptParm]*): Execute a named script from the game settings file. The first parameter is the name of the script file and the second parameter is the name of the function in that file. All the rest of the parameters are passed to the function when it is called. The value returned is the value returned by the script.
  • modifyingScript(fileName, scriptName, controller [,scriptParm]*): Execute a named script from the game settings file and then update the controller with the results. The first parameter is the name of the script file and the second parameter is the name of the function in that file. The third parameter is the character sheet controller instance that needs to redisplay the modified properties. All the rest of the parameters are passed to the function when it is called. The value returned is the value returned by the script.
  • exists(propName): Checks to see if the property name exists in the current execution context and returns a Boolean value.
  • FALSE(): Returns the Boolean value false.
  • formatRoll(roll): Rolls the die passed in as a parameter and formats it for output using standard MT and returns a String.
  • getIfExists(propName [,default]?): Get the value for the property named in the first parameter. If the value doesn't exist return the second parameter if passed or null if it wasn't passed.
  • listGet(list, value, prop [, valueProp [,default]?]?)Gets a value from the list or the default value if value is not in the list.
  • greaterThan(p1, p2), gt(p1, p2), p1 > p2: Checks to see if the first parameter is greater than the second and returns a Boolean value. Replaces greater than in the base parser.
  • greaterThanOrEquals(p1, p2), gte(p1, p2), ge(p1, p2), p1 >= p2: Checks to see if the first parameter is greater than or equal to the second and returns a Boolean value. Replaces greater than or equals in the base parser.
  • hideRow(charSheet, condition, component, spec): Hides or shows a row in a character sheet depending on the passed condition. Nothing is returned.
  • hideColumn(charSheet, condition, component, spec): Hides or shows a column in a character sheet depending on the passed condition. Nothing is returned.
  • if(condition, then, else): If the Boolean condition is true the then value is returned, otherwise the else value is returned.
  • inList(list, value, [,prop]?): Checks to see if the value is in the list. If prop is passed, it checks to see if that property value is in the child maps contained in the list. It returns a Boolean value.
  • lessThan(p1, p2), lt(p1, p2), p1 < p2: Checks to see if the first parameter is less than the second and returns a Boolean value. Replaces less than in the base parser.
  • lessThanOrEquals(p1, p2), lte(p1, p2), le(p1, p2), p1 <= p2: Checks to see if the first parameter is less than or equal to the second and returns a Boolean value. Replaces less than or equals in the base parser.
  • meta(data): Returns the requested meta data. Available data is
    • displayName: Display name of the map.
    • propertyName: Property name of the map.
    • parent.displayName: Display name of the map's parent.
    • parent.propertyName: Property name of the map's parent.
  • not(condition), !condition: Not's the Boolean value and returns it. Replaces not in the base parser.
  • or(p1 [,pn]*), p1 || p2: Or one or more Boolean values and return a Boolean value. This replaces the or function in the base parser.
  • print(format [,params]*): Perform a formatted print and return the output string. The format is the first value and it must follow the java.util.Formatter rules. The return value is printed to the message panel of CT or IT
  • random([asText]?: Returns a pseudo-random number between 0 & 1. If the passed Boolean parameter is true then it is returned as a string, otherwise it is returned as a number.
  • remainder(dividend, divisor): Returns the remainder from dividing the first parameter by the second parameter as a number.
  • replaceModifiers(changeEvent [, instanceString [, instanceNumber]?]?): This is used to replace the modifier set values when a property value changes. The event describes the change in value. The two parameters set the instance values for the modifier. It always returns null.
  • roundHalf(value, up [, precision]): Round the number value with half up or down depending on the Boolean second parameter. The precision determines the number after the decimal point. A number value is returned.
  • setBackground(component, color): Set the background color of the component. The color can be a Color object or a string representation of a color.
  • setForeground(component, color): Set the foreground color of the component. The color can be a Color object or a string representation of a color.
  • setEnabled(component, enabled): Set the enabled state of the component to the passed Boolean value.
  • setText(component, value): Set the text in a Label, Button or Text component. The value will be converted to text before being set.
  • setValue(component, value): Set the value of components:
    • The text for Label, Button or Text components
    • The selected value of Toggle Button component instances
    • The selected item of Combo Box components
    • The image value of Char Sheet Image components
    • The data for a Char Sheet Repeating Panel component
    • The data for a Char Sheet Table component
  • switch(value, default, case1, retValue1 [, caseN, retValueN]*): Return a retValue parameter if the value parameter matches its case parameter. If the value doesn't match any case values then the default value is returned.
  • TRUE(): Return the Boolean value true.

These are the remaining base parser functions:
  • abs(number), absoluteValue(number): Return the absolute value.
  • add(value [, value]*), sum(value [, value]*), concat(value [, value]*), value + value: If values are numbers then the numbers are added. If the values are strings they are concatenated.
  • set(prop, value), prop = value: Set the value of the property to value.
  • bitwiseand(number [,number]*), band(number [,number]*): Bitwise and the passed numbers and return the result.
  • bitwisenot(number), bnot(number): Bitwise not the passed number and return the result.
  • bitwiseor(number [,number]*), bor(number [,number]*): Bitwise or the passed numbers and return the result.
  • bitwisexor(number [,number]*), bxor(number [,number]*): Bitwise xor the passed numbers and return the result.
  • ceiling(number), ceil(number): If there is a decimal part to the number raise it to the next integer value
  • divide(number [, number]*), number / number: Divide the first number by each of the remaining number parameters and return the number result.
  • eval(macro [,macro]*): Execute the passed macros one at a time. Return the value from the last macro.
  • floor(number), trunc(number), intPart(number): If there is a decimal part to the number lower it to the integer value.
  • hex(number): Returns the hex value of a number '0x' is placed before the number. The value returned is a string.
  • hypot(x, y): Return the square root of x squared plus y squared.
  • ln(number): Return the natural logarithm of the number.
  • log(number), log10(number): Return the base ten logarithm of the number.
  • max(number [,number]*): Return the maximum value out of those passed.
  • mean(number [,number]*), avg(number [,number]*), average(number [,number]*): Return the average of all of the passed values.
  • median(number [,number]*): Return the median value of the numbers passed.
  • min(number [,number]*): Return the minimum value out of those passed.
  • multiply(number [, number]*), number * number: Multiply all of the values together.
  • sqr(number [, scale]?), square(number [, scale]?), power(number [, scale]?), factor(number [, scale]?), pow(number [, scale]?), number ^ scale: Raise number to the power given in scale.
  • round(number [, precision]?): Round to the given precision. Half is rounded up.
  • sqrt(number [, scale]?), squareroot(number [, scale]?): Calculate the square root to the given scale.
  • eqs(value, value [, value]*), strEquals(value, value [, value]*), equalsStrict(value, value [, value]*): Returns the number one if all values passed are equal and zero if not.
  • neqs(value, value [, value]*), strNotEquals(value, value [, value]*), notEqualsStrict(value, value [, value]*): Returns the number one if the values passed are not equal and zero if they are all equal.
  • subtract(number [, number]*), number - number: Subtract all of the trailing numbers from the first number.


Top
 Profile  
 
User avatar  Offline
RPTools Team
 
Joined: Tue Feb 07, 2006 1:07 am
Posts: 1766
Location: Austin, Tx
 Post subject: Re: Functions for data.
PostPosted: Wed May 25, 2011 2:13 pm 
aliasmask wrote:
Oops.. I thought this was under macros. I have very little experience with character tool. I'm not sure what syntax or libraries the character tool uses.
CT & IT use the same base parser without all of the code control stuff. To do code control (if, loops, etc) you should use JavaScript. There are also a lot of extra functions defined for the CT/IT parser.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 6 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman