• 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

if/then syntax

zarlor

Well-known member
I know I'm just missing somthing really simple here, but I'm trying to put in the following for an Eval-Script to bump Str by 1 die type if it's less than d12 or add +2 to it if it's at d12.

Code:
if (hero.child[attrStr].field[trtFinal].value <= 5)
   perform #traitadjust[attrStr,+,1,"Tragor's Mantle"]
 else
   perform #traitadjust[attrStr,+,2,"Tragor's Mantle"]
endif

I get an error about invalid use of a reserved word on the first line of the script, though. Anyone have some idea what I should be using there?
 
after the first line you forgot to put <then>

if (hero.child[attrStr].field[trtFinal].value <= 5) then
perform #traitadjust[attrStr,+,1,"Tragor's Mantle"]
else
perform #traitadjust[attrStr,+,2,"Tragor's Mantle"]
endif
 
No way I would ever do something so stupid as that! You're crazy for even bringing that up!

...


Can someone please delete this thread now...
*sneaks away in embarrassment*
 
It still doesn't give a the +2 if the character has a d12 in it. I got it to give a +1 if this #traitadjust, that's how CapeCrusader told me to do it to get a d12 to raise higher, but I can't seem to get it to work passed d12 +1.
 
Oh, I didn't even test that part. It must be because of a capped max? Back to working on it, then...
 
I got it to work with this script

Traits 5000

if (hero.child[attrStr].field[trtFinal].value <= 5) then
#trait[attrStr] += 1
done
elseif (hero.child[attrStr].field[trtFinal].value >= 6) then
hero.child[attrStr].field[trtRoll].value += 2
endif

hope this helps
 
Hmm... #traitadjust shouldn't be the problem, since that is what is used for increasing a die type (and will then start adding in stright pluses on reaching d12.) #traitroll is used for adding straight plusses and #traitprof is used for adding non-stacking plusses.

I decided to add in the code that the Racial Property "Augmented Attribute does first, which is slightly modified in this instance to be:
Code:
hero.child[attrStr].field[trtMaximum].value = 8

Which should makes sure there is room to bump the character to d12+2 but that doesn't seem to fix it either. I still only get up to d12+1 as well. Really odd.
 
I got it to work with this script

Traits 5000

if (hero.child[attrStr].field[trtFinal].value <= 5) then
#trait[attrStr] += 1
done
elseif (hero.child[attrStr].field[trtFinal].value >= 6) then
hero.child[attrStr].field[trtRoll].value += 2
endif

hope this helps

Weird, that doesn't work for me at all. With a Strength set to d12 it doesn't even budge. It just stays d12.
 
Now I will let you know that if you, if your die is a d10 or below it will give you a +1 to raise it 1 die and if you have a d12 it will give you a +2 to the str roll, but if you raise your stat through normal means to a d12 after the fact it won't give the + 2. So I have not figured that out if that's what you want it to do. If not your good to go with this script.
 
Last edited:
That's weird - I made an edge and set the eval script to Traits 5000 and it works for me, of coarse it only works if I already have a d12 in the stat. if not it only goes to d12.
 
Basically it's just a magic item (that I'm trying to do without using Fantasy Companion) that simply increases your Str by 1 die or +2 if your Str is already d12 (and ignores your normal d12 Max Str.) I set a character to a starting d12 Strength and using your code and got no bonuses on it at all. But in any case I would need that +2 to work no matter when your Strength was advanced to d12. For now I think I'll stick with the original code even if it only advances to d12+1 because at least you also can see where that bonus is coming from using #traitadjust if you mouse over your Strength in Hero Lab. This seemed like it would be a fairly easy one since it should just mirror what Augmented Attribute is doing.
 
That's weird - I made an edge and set the eval script to Traits 5000 and it works for me, of coarse it only works if I already have a d12 in the stat. if not it only goes to d12.

Oh, I see. Your second line is adding it as a roll bonus, not a die adjust bonus. And you're running it at Traits where it wouldn't work when I had it set to Pre-Traits/5000. It does work a little wonky that way, so I think I will stick to how I've got it for the moment, which should work from what little I know of this stuff but I could be way off base on how it works.
 
#traitadjust accesses the trtBonus field of the Attribute, and that value falls under the character's maximum limit. You're actually adjusting the Trait.

#traitroll accesses the trtRoll field of the Attribute, and this value is not covered by the limit. It's modifiers added to the Trait, not actually changing the Trait.
 
Right, so I could use Roll to get around the limit, but I'd actually prefer raising the limit and using Adjust, which is what the trtMaximum line above should be doing (and the way Augmented Attribute does it) but it doesn't seem to be working here for some reason I seem incapable of figuring out. Perhaps stranger is that it's treating the max as if it were set to 7 (d12+1) which is presumably above the max of 6 (d12) but doesn't want to seem to allow it higher than than (such as the 8 I have set, or even 9 or 10 if I set it higher than 8). Maybe something else is just overriding it?
 
Back
Top