• 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

Why might "eachpick" be valid for a debug statement but not for a string operation?

Duggan

Well-known member
Why might "eachpick" be valid for a debug statement but not for a string operation?

Code:
var skills as string
foreach pick in gizmo from Skill
  skills &= "!" & eachpick.idString & " & "
  debug "Add to " & eachpick.idstring
  nexteach

This is code I have within an eval statement. If I comment out the first statement, it works and prints the idstrings. If I don't comment out the first statement, it gives me an error message of "Reference to undeclared variable: 'eachpick'".

What's the difference?
 
Last edited:
You mis-capitalized idstring.

"Reference to undeclared variable" is the compiler's last resort - it means "I really can't figure out what you're trying to do - perhaps you meant to declare a variable earlier, and you're trying to use it here?"
 
Thank you. That is helpful. Not directly in my attempt to have the Advances not allow duplicate Skills, but it is helpful in getting me a it further,
 
Ah! And I figured out the Advances. I was able to repurpose the eval on AdvBoost to have the already-picked choices not show up. I know someone else had had this issue a while back... they probably already found their own solution. :)

Code:
<eval value="1" phase="Final" priority="1001">
  <![CDATA[
    var skills as string
    
    foreach pick in gizmo from Skill
      skills &= " & !Skill." & eachpick.idstring
      nexteach
    field[advDynamic].text &= skills
    ]]>
  </eval>
 
Back
Top