• 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

YASQ (Yet Another Scripting Question)

Mergon

Well-known member
I am working on script with the following foreach loop:

foreach pick in hero from BaseWep where “wCategory.Melee”
~#situational[eachpick,sText,field[thingname].text]
nexteach

The portion that reads:

foreach pick in hero from BaseWep where “wCategory.Melee”

gives me the following error. The #Situational line is commented out while I try to figure out what I am doing wrong with the actual foreach loop . . . :confused:

Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Thing 'p5CAbsEle' (Eval Script '#2') on line 23
-> Invalid tag expression specified
 
I am working on script with the following foreach loop:



The portion that reads:



gives me the following error. The #Situational line is commented out while I try to figure out what I am doing wrong with the actual foreach loop . . . :confused:

Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Thing 'p5CAbsEle' (Eval Script '#2') on line 23
-> Invalid tag expression specified

I'm using the below and it doesn't seem all that different than yours:

foreach pick in hero from BaseWep where "wCategory.Melee"
#extradamage[eachpick, " damage plus 10 (3d6) poison", field[thingname].text]
nexteach
 
It doesn't make any sense to me either.

If I commect out the foreach and nexteach lines, I get no errors.
 
This is my full script in acess it matters:
Phase: Render, Priority: 10000

~If we're disabled, do nothing &
doneif (tagis[Helper.Disable] = 1)
~ If nothing chosen then get out now!
doneif (field[pChosen].ischosen = 0)

var iLevel as number
var sText as string
var iCount as number

iLevel = #totallevelcount[]
if (iLevel >= 17) then
iCount = 4
elseif (iLevel >= 11) then
iCount = 3
elseif (iLevel >= 5) then
iCount = 2
else
iCount = 1
endif

sText = "+" & iCount & "d6 "
sText &= field[pChosen].chosen.tagnames[DamageRes.?]
foreach pick in hero from BaseWep where “wCategory.Melee”
~#situational[eachpick,sText,field[thingname].text]
nexteach
 
I don't know why, but I copy/pasted the foreach line from your script into mine, and now it works. They both appear identical to me . . .
 
This is my full script in acess it matters:
Phase: Render, Priority: 10000

What if you change "wCategory.Melee" to "IsWeapon.wSpear"

do you still get the error message?

EDIT:wow, I took out your foreach and pasted the one I used here and it took the script.

EDIT 2: ok I removed the foreach saved, tested, and then manually typed your foreach statement saved and tested and it took this time.
 
Last edited:
Pretty sure I typed what you had.


sText = "+" & iCount & "d6 "
sText &= field[pChosen].chosen.tagnames[DamageRes.?]
foreach pick in hero from BaseWep where "wCategory.Melee"
#extradamage[eachpick,sText,field[thingname].text]
nexteach

EDIT, nope I changed situational to extradamage.

Edit 2, went back and changed it to situational and it took.

Not sure what is wrong with what you have pasted above, but I got same error when I copied and pasted.

J
 
foreach pick in hero from BaseWep where “wCategory.Melee”
~#situational[eachpick,sText,field[thingname].text]
nexteach
That is not valid QUOTES. You have something from Word or something but “ is not a ". :)

This is fixed:
foreach pick in hero from BaseWep where "wCategory.Melee"
~#situational[eachpick,sText,field[thingname].text]
nexteach
 
Back
Top