View Single Post
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,146

Old January 6th, 2014, 08:10 AM
Quote:
Originally Posted by TobyFox2002 View Post
More trouble, same as the previous code, it works unpredictably. Its really stumping me and I don't think I can continue. I've tried to examine the Authoring Wiki, but it just makes my head spin, without examples and 'non-technical' explanations.

Post-Levels (Users)/5000
Code:
      ~ Calculate our total level - our Kundula level plus any 'extra levels'
      ~ assigned to us
      var level as number
      level = field[xTotalLev].value

      ~ Assign the Number of times the alternate form is active.
      var dice as string
      if (level > 10) then
        dice = "Alternate Form (1/day)"
      elseif (level > 15) then
        dice = "Alternate Form (3/day)"
      elseif (level > 20) then
        dice = "Alternate Form at Will"
        endif
      field[livename].text = "" & dice & ""
As for this, my guess is you could be doing this too soon. When you want to change the name of something, I find it easiest to run these in the Final Phase. A couple of other things to note is that I think you intend to use ">=" instead of just ">", and I got an error on the field. The line:

Code:
level = field[xTotalLev].value
sets "level" equal to the value of xTotalLev on the thing the script is on. That may be your intention, but I wasn't sure, so I changed it on the version I wrote. I also changed who you are modifying the name. I find using variables as a string to have very inconsistent success, so I removed that. Here's what I have:

Final Phase/5000
Code:
 ~ Calculate our total level - our Kundula level plus any 'extra levels'
      ~ assigned to us
      var level as number
      level = herofield[tTotLevel].value

      ~ Assign the Number of times the alternate form is active.
      if (level >= 10) then
        field[livename].text = field[name].text & " (1/day)"
      elseif (level >= 15) then
        field[livename].text = field[name].text & " (3/day)"
      elseif (level >= 20) then
        field[livename].text = field[name].text & " (at Will)"
      endif
See if that does what you are looking for.
Sendric is offline   #20 Reply With Quote