Junior Member
Join Date: Sep 2009
Posts: 10
|
Hello,
It's the first script that I'm writing, but I'm lost and that doesn't compile. Code:
var val as number val = field[pwRanks].value if (val == 1) then field[pwInfo].text = "Removes one Injuried condition per 20 minutes" elseif (val == 2) field[pwInfo].text = "Removes one Injuried condition each 5 minutes" elseif (val == 3) field[pwInfo].text = "Removes one Injuried condition each 1 minute (10 Rounds)" elseif (val == 4) field[pwInfo].text = "Removes one Injuried condition each 30 seconds (5 Rounds)" elseif (val == 5) field[pwInfo].text = "Removes one Injuried condition each 12 seconds (2 Rounds)" elseif (val == 6) field[pwInfo].text = "Removes one Injuried condition each 6 seconds (1 Round)" elseif (val == 7) field[pwInfo].text = "Removes one Injuried and the Disabled condition each 6 seconds (1 Round)" elseif (val == 8) field[pwInfo].text = "Removes one Injuried, the Disabled and the Dying condition each 6 seconds (1 Round)" endif Code:
Syntax error in 'eval" script for Thing 'pwRegenera' (Eval Script #1) on line 3 -> Error parsing right-side expression in relational comparison |
#1 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
^_^ Try adding a "then" onto your elseifs.
And minor thing, but "Injured" not "Injuried". |
#2 |
Junior Member
Join Date: Sep 2009
Posts: 10
|
Did some changes in the script, add "then", but still no luck.
Code:
var val as number val = field[pwRanks].value if (val = 1) then field[pwInfo].text = "Recovers from Injured in 20 minutes, from Disabled in 1 hour or Dying in 5 hours." endif if (val = 2) then field[pwInfo].text = "Recovers from Injured in 10 minutes, from Disabled in 20 minutes or Dying in 1 hour." endif if (val = 3) then field[pwInfo].text = "Recovers from Injured in 5 minutes, from Disabled in 10 minutes or Dying in 20 minutes." endif if (val = 4) then field[pwInfo].text = "Recovers from Injured in 1 minutes (10 Rounds), from Disabled in 5 minutes or Dying in 10 minutes." endif if (val = 5) then field[pwInfo].text = "Recovers from Injured in 6 seconds (1 Round), from Disabled in 1 minute (10 Rounds) or Dying in 5 minutes." endif if (val = 6) then field[pwInfo].text = "Recovers from Injured in 6 seconds (1 Round) without rest, from Disabled in 6 seconds, or Dying in 1 minute." endif if (val = 7) then field[pwInfo].text = "Recovers from Injured and Disabled in 6 seconds (1 Round) without rest, or Dying in 6 seconds." endif if (val = 8) then field[pwInfo].text = "Recovers from Injured, Disabled and Dying in 6 seconds (1 Round) without rest." endif Last edited by Metal Sonic; October 16th, 2012 at 05:25 AM. |
#3 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
I notice that you changed your "==" to "=". I do apologize... I meant to run your script through the editor last night, but I ran out of time to do more than dash off a reply. If I may make a suggestion, go to Power Options and add a copy of "Recovery (Bruised)" or something similar and take a look at how they handle the text. I know they do that one with "if" and "elseif".
|
#4 |
Junior Member
Join Date: Sep 2009
Posts: 10
|
Thanks. I tried to follow that example, but still having errors.
Code:
Syntax error in 'eval" script for Thing 'pwRegenera' (Eval Script #1) on line 15 -> Error in right-side expression of assignment Code:
var text as string if (field[pwmRanks].value = 1) then text = "Recovers from Injuried in 20 minutes, from Disabled in 1 hour or Dying in 5 hours." elseif (field[pwmRanks].value = 2) then text = "Recovers from Injuried in 10 minutes, from Disabled in 20 minutes or Dying in 1 hour." elseif (field[pwmRanks].value = 3) then text = "Recovers from Injuried in 5 minutes, from Disabled in 10 minutes or Dying in 20 minutes." elseif (field[pwmRanks].value = 4) then text = "Recovers from Injuried in 1 minutes (10 Rounds), from Disabled in 5 minutes or Dying in 10 minutes." elseif (field[pwmRanks].value = 5) then text = "Recovers from Injuried in 6 seconds (1 Round), from Disabled in 1 minute (10 Rounds) or Dying in 5 minutes." elseif (field[pwmRanks].value = 6) then text = "Recovers from Injuried in 6 seconds (1 Round) without rest, from Disabled in 6 seconds, or Dying in 1 minute." elseif (field[pwmRanks].value = 7) then text = "Recovers from Injuried and Disabled in 6 seconds (1 Round) without rest, or Dying in 6 seconds." else text = "Recovers from Injuried, Disabled and Dying in 6 seconds (1 Round) without rest." endif field[pwmInfo].text = text Last edited by Metal Sonic; October 16th, 2012 at 12:00 PM. |
#5 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
Still no access to the editor at the moment, but your "else" clause doesn't close out the string. There's a missing end quote.
|
#6 |
Junior Member
Join Date: Sep 2009
Posts: 10
|
Already fixed that, but the error persists.
|
#7 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
Huh. Didn't know it worked like that. Your problem is that you have a tab at the end of your "7" line. Strangely enough, that causes it to error out. The following will work:
Quote:
|
|
#8 |
Junior Member
Join Date: Sep 2009
Posts: 10
|
Thanks, now it's compiling!
...But, it doesn't work! There's no text in the Power! |
#9 |
Senior Member
Volunteer Data File Contributor
Join Date: Nov 2009
Posts: 1,502
|
{facepalm} I knew I should have actually run it. The reason for that, I suspect, is because "pvmInfo" stands for "Power Modifier information". Look through the other powers and find one that modifies the text based on the contents. Gravity Control might work since it displays different text based on the rank involved.
|
#10 |
|
|