Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Mutants & Masterminds
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
Metal Sonic
Junior Member
 
Join Date: Sep 2009
Posts: 10

Old October 15th, 2012, 03:59 PM
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
The error is
Code:
Syntax error in 'eval" script for Thing 'pwRegenera' (Eval Script #1) on line 3
-> Error parsing right-side expression in relational comparison
Any help?
Metal Sonic is offline   #1 Reply With Quote
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old October 15th, 2012, 05:15 PM
^_^ Try adding a "then" onto your elseifs.

And minor thing, but "Injured" not "Injuried".
Duggan is offline   #2 Reply With Quote
Metal Sonic
Junior Member
 
Join Date: Sep 2009
Posts: 10

Old October 16th, 2012, 05:13 AM
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.
Metal Sonic is offline   #3 Reply With Quote
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old October 16th, 2012, 07:43 AM
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".
Duggan is offline   #4 Reply With Quote
Metal Sonic
Junior Member
 
Join Date: Sep 2009
Posts: 10

Old October 16th, 2012, 09:23 AM
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.
Metal Sonic is offline   #5 Reply With Quote
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old October 16th, 2012, 11:16 AM
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.
Duggan is offline   #6 Reply With Quote
Metal Sonic
Junior Member
 
Join Date: Sep 2009
Posts: 10

Old October 16th, 2012, 12:00 PM
Already fixed that, but the error persists.
Metal Sonic is offline   #7 Reply With Quote
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old October 16th, 2012, 04:43 PM
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:
var text as string
if (field[pwmRanks].value = 1) then
text = "Recovers from Injured in 20 minutes, from Disabled in 1 hour or Dying in 5 hours."

elseif (field[pwmRanks].value = 2) then
text = "Recovers from Injured in 10 minutes, from Disabled in 20 minutes or Dying in 1 hour."
elseif (field[pwmRanks].value = 3) then
text = "Recovers from Injured in 5 minutes, from Disabled in 10 minutes or Dying in 20 minutes."
elseif (field[pwmRanks].value = 4) then
text = "Recovers from Injured in 1 minutes (10 Rounds), from Disabled in 5 minutes or Dying in 10 minutes."
elseif (field[pwmRanks].value = 5) then
text = "Recovers from Injured 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 Injured 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 Injured and Disabled in 6 seconds (1 Round) without rest, or Dying in 6 seconds."
else
text = "Recovers from Injured, Disabled and Dying in 6 seconds (1 Round) without rest."
endif
field[pwmInfo].text = text
FWIW, I started by eliminating the line in question and verifying that it still failed. Finding no reason why it should, I typed the line in and it worked. I then copied and pasted both texts into Notepad++ and compared them to see the extra tab. Go figure.
Duggan is offline   #8 Reply With Quote
Metal Sonic
Junior Member
 
Join Date: Sep 2009
Posts: 10

Old October 17th, 2012, 05:22 AM
Thanks, now it's compiling!

...But, it doesn't work! There's no text in the Power!

Metal Sonic is offline   #9 Reply With Quote
Duggan
Senior Member
Volunteer Data File Contributor
 
Join Date: Nov 2009
Posts: 1,502

Old October 17th, 2012, 11:04 AM
{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.
Duggan is offline   #10 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:22 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.