• 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

Rounding function

EightBitz

Well-known member
Can someone pleeeeeze tell me what's wrong with this line? It's in an eval script, if that makes any difference.

field[trtBonus].value = round((#trait[attrStr] + #trait[attrCon] + #trait[attrWpr])/3,2,1)

I'm trying to take the average of the three attributes (Strength, Constitution, Willpower), and round it up to the nearest integer.
 
For the record, I've also tried:

field[trtBonus].value = round((#trait[attrStr] + #trait[attrCon] + #trait[attrWpr])/3,0,1)

In either case (I guess I should have mentioned this in my original post), when I try to load the system, I get an error that says:

Syntax error in 'eval' script for Thing ... (Eval Script #1) on line 2
-> Error parsing parameter 1 of function.
 
I don't think you can have that much going on in the first parameter try this

Code:
field[trtBonus].value += #trait[attrStr] + #trait[attrCon] + #trait[attrWpr]
field[trtBonus].value = round(field[trtBonus].value/3,0,1)

I don't think it can parse the extra paraentheses
 
Last edited:
I don't think you can have that much going on in the first parameter try this

Code:
field[trtBonus].value += #trat[attrStr] + #trait[attrCon] + #trait[attrWpr]
field[trtBonus].value = round(field[trtBonus].value/3,0,1

I don't think it can parse the extra paraentheses

Suuuuuuuuuuuuure. Frustrate me even MORE by including a typo in an otherwise useful answer. :-p

(Oh, and thanks.)
 
Back
Top