• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Fudge Traits

RayPrancer

Well-known member
The first step in programming Fudge properly should have been to get the trait levels set. They range from Terrible (-3) to Legendary (4) with each intermidate step also being represented by a word rather than a number. In theory it should just be an eight part if statement but I'm having trouble with the proper syntax. I've tried making it eight seperate if statements but I think there may also be a timing issue - currently at Render with priority 5000
 
Not easily as I don't post to these boards from the computer where I have Hero Lab installed but I've typed it out again below.

<code>
<field
id="trtDisplay"
name="Attribute Level to Display"
type="derived"
maxlength="50">
</field>
</code>
(default delta script)
<code>
<eval index="2" phase="Render" priority="5000" name="Calc trtDisplay>
<after name="Calc trtFinal"/>
~bound the final trait including in-play adjustments
var final as number
final = field[trtFinal.value]

~convert the final trait to the proper string for display
var display as string
if final = 0 then
display = "Terrible"
endif
if final = 1 then
display = "Poor"
endif
if final = 2 then
display = "Mediocre"
endif
if final = 3 then
display = "Fair"
endif
if final = 4 then
display = "Good"
endif
if final = 5 then
display = "Great"
endif
if final = 6 then
display = "Superb"
endif
if final = 7 then
display = "Legendary"
endif

~display the text in the correct place
field[trtDisplay].text = display
]]></eval>
</code>

Typing this out again suggests I have a ] in the wrong place so I've tried changed to
final = field[trtFinal].value
which is now prompted Hero Lab to say "Expected ( following if or while statement" when I try to compile
 
You were correct in identifying that you had the ] in the wrong place.

Now, it's telling you that you're missing the ( and ) in your if...thens:

if (final = 0) then
display = "Terrible"
endif
 
After doing that it was still giving an error message but that was because the last line should have been just </eval> given I hadn't opened with a CDATA. It's now compiling and rendering correctly for derived traits. Next step: render skills and attributes which is covered on the wiki if I get stuck
 
Back
Top