• 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

Custom DC calculation

Anpumes

Well-known member
I have been having some difficulty with getting one of my Eval Scripts to output what I am requesting of it. The primary thing that isn't happening, is the picking of which Attribute Modifier is highest and pulling that number into the variable.

The specific code that doesn't seem to be working is:
Post-attributes; 10000
Code:
      ~Pick the highest bonus between our Con and Cha
      var highmod as number
      highmod += maximum(hero.child[aCHA].field[aModBonus].value, hero.child[aCON].field[aModBonus].value)

The full code for those curious is:
Post-attributes; 10000
Code:
      ~If we're not shown, not the first copy, or disabled, get out now
      doneif (tagis[Helper.ShowSpec] = 0)
      doneif (tagis[Helper.FirstCopy] = 0)
      doneif (tagis[Helper.SpcDisable] <> 0)

      ~Pick the highest bonus between our Con and Cha
      var highmod as number
      highmod += maximum(hero.child[aCHA].field[aModBonus].value, hero.child[aCON].field[aModBonus].value)

      ~Set the value of half our levels
      var halflvl as number
      halflvl += round(#totallevelcount[] / 2, 0, -1)

      ~Calculate our DC
      field[abValue].value += 10 + halflvl + highmod


      ~Display DC
      field[livename].text = field[thingname].text & " (DC " & field[abValue].value & ")"

I am not the best at coding but I somehow manage to find and understand it usually but I've tried for a while to make this work and searched the forums, reading countless posts trying to figure out a solution on my own without any luck. So I am asking for any assistance available from the community.

Thank you.
 
What problem are you having with this?

If you're getting an error message, please copy the exact message. If you're not getting the display results you expect, how do they differ from what you'd expect?
 
No error at all but the code I have to pick the highest modifier between CON and CHA is not returning a result. No number, no error, nothing. I'm probably just using the wrong formulation or something equally stupid but best I can tell it should work...
 
Is this on a Class Ability or a Racial Ability as I am thinking the stop tags your using is not the same on both and the script is never even executing.

Have you used "debug" commands to make sure the script is executing at all? Like this:

Code:
      ~If we're not shown, not the first copy, or disabled, get out now
      doneif (tagis[Helper.ShowSpec] = 0)
      doneif (tagis[Helper.FirstCopy] = 0)
      doneif (tagis[Helper.SpcDisable] <> 0)
debug "script started"
      ~Pick the highest bonus between our Con and Cha
      var highmod as number
      highmod += maximum(hero.child[aCHA].field[aModBonus].value, hero.child[aCON].field[aModBonus].value)
debug highmod
      ~Set the value of half our levels
      var halflvl as number
      halflvl += round(#totallevelcount[] / 2, 0, -1)
debug halflvl
      ~Calculate our DC
      field[abValue].value += 10 + halflvl + highmod
debug field[abValue].value
      ~Display DC
      field[livename].text = field[thingname].text & " (DC " & field[abValue].value & ")"

Then go to Develop->Floating Info Windows->Show Debug Output to see the debug output.
 
Well, I don't understand it but putting those "debug" commands in did something. I did not change anything else but suddenly it is working correctly. I even copied my original code and the "debug" inserted code you provided for comparison, side by side... I don't see any difference but for some reason it is working as intended now.

Guess I'll just chalk it up to a glitch of some sort. Thank you both for your help. :)
 
Back
Top