Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Authoring Kit (http://forums.wolflair.com/forumdisplay.php?f=58)
-   -   Why might "eachpick" be valid for a debug statement but not for a string operation? (http://forums.wolflair.com/showthread.php?t=59845)

Duggan December 30th, 2017 06:06 PM

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?

Mathias December 30th, 2017 07:08 PM

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?"

Duggan December 30th, 2017 07:45 PM

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,

Duggan December 31st, 2017 07:34 AM

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>



All times are GMT -8. The time now is 09:02 AM.

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