RPScript - Syntax help

Discussion of initiative tool.

Moderators: dorpond, Azhrei

Post Reply
User avatar
drswoboda
Dragon
Posts: 313
Joined: Tue Apr 25, 2006 12:54 pm
Location: Milwaukee, WI

RPScript - Syntax help

Post by drswoboda »

Hey Jay,

I ran across this tonight and I'm looking for the right syntax here. I probably have a type mismatch.

Code: Select all

          <property>
            <description>Hit Dice for this class.</description>
            <script>(if(eq(class, 1), "1d10", (if(eq(class, 2), "1d6", (if(eq(class, 3), "1d6", (if(eq(class, 4), "1d8", (if(eq(class, 5), "1d10", "NA"))))))))))</script>
          </property>
Instead of giving me output like '1d6' or '1d10' it outputs the more interesting version like this:
roll (1, 6)
roll (1, 10)

Clearly I have stumbled across something I don't know how to use ;)
-David

User avatar
drswoboda
Dragon
Posts: 313
Joined: Tue Apr 25, 2006 12:54 pm
Location: Milwaukee, WI

Post by drswoboda »

bump :)

User avatar
jay
RPTools Team
Posts: 1767
Joined: Tue Feb 07, 2006 1:07 am
Location: Austin, Tx

Post by jay »

Sorry, I must have missed your post earlier. The problem is with the dice parser which is taking a look at the scripts before they are processed. It does a text replace of all roll strings (1d6) with a roll method call (roll(1,6)). It is a pain. To fix it you can try something like "1d"+"6" for your strings and that will allow them to be returned as string values without the dice parser getting involved.

User avatar
drswoboda
Dragon
Posts: 313
Joined: Tue Apr 25, 2006 12:54 pm
Location: Milwaukee, WI

Post by drswoboda »

Great, thanks Jay.

I recall seeing you having done that somewhere in the settings file, and now the light has gone off and I understand why you did it that way.
-David

Post Reply

Return to “InitiativeTool”