-
November 22nd, 2015, 14:02 #1
Scripting - Using < and > operators
Afternoon Folks,
Been working on the scripting required for working out the MOD values within Traveller.
However I've spent that last hour or more (time flies when you're coding) hitting a brick wall.
Seems;
Code:if nMyValue == 0 then nMyModValue = -3; elseif nMyValue <=2 then nMyModValue = -2; elseif nMyValue <=4 then nMyModValue = -1; end
However I do have it working using a long winded method
Code:function onSourceUpdate() local nValue = calculateSources(); local nModValue = 0; if nValue == 0 then nModValue = -3; elseif nValue == 1 then nModValue = -2; elseif nValue == 2 then nModValue = -2; else nModValue = 0; end
Cheers
Colin
-
November 22nd, 2015, 16:24 #2
- Join Date
- Jun 2013
- Location
- Isanti, MN
- Posts
- 2,922
Is your code in an XML file? If so, you need to replace "<" with "<" and ">" with ">".
-
November 22nd, 2015, 21:57 #3
In Lua, you should be able to use the alternative operators: gt, lt, ge, le. These replace >, <, >= and <=. This avoids conflict with the XML.
Using Ultimate license - that means anyone can play.
Valarian's Fantasy Grounds Rulesets
-
November 23rd, 2015, 09:33 #4
Morning Folks,
Oddness, I thought I replied to this thread last night.
Got it working, using the < etc as this is within the character sheet XML main.
Now I'm going to experiment with it, as I hate having the exact same code copied for each ability so I'll see if I can move it to it's own script file (then comes the fun of passing arguments).
Cheers though, got it working.
Colin
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks