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 is the same skill showing up three times in a foreach loop? (http://forums.wolflair.com/showthread.php?t=59239)

EightBitz September 27th, 2017 08:49 PM

Why is the same skill showing up three times in a foreach loop?
 
First of all, scratch my previous question about the labeltext script. I'm doing that whole thing a different way, which I think will still work out the way I want it, but I'm having another odd issue now.

I have the following portal:
Code:

<portal
  id="skill"
  style="outNormal">
  <output_label>
      <labeltext><![CDATA[
        var attrname as string
        var skillname as string
        var linkname as string
        var debugstr as string
       
        attrname = field[name].text
        foreach pick in hero from Skill where "component.Skill & !Helper.Maximum & !Hide.Skill"
            skillname = eachpick.field[name].text
            linkname = eachpick.linkage[attribute].field[name].text
            if (compare(attrname,linkname) = 0) then
              debugstr = "attrname: " & attrname & ", skillname: " & sklname & ", linkname: " & linkname
              debug debugstr
              done
              endif
            nexteach
        ]]></labeltext>
      </output_label>
  </portal>

The debug output for that portal is:
Code:


**********  Start Evaluation Cycle  **********

attrname: Agility, sklname: Movement, linkname: Agility
attrname: Agility, sklname: Movement, linkname: Agility
attrname: Agility, sklname: Movement, linkname: Agility
attrname: Strength, sklname: Prowess, linkname: Strength
attrname: Stamina, sklname: Close Quarters Combat, linkname: Stamina
attrname: Focus, sklname: Research, linkname: Focus
attrname: Personality, sklname: Communication, linkname: Personality
attrname: Willpower, sklname: Interview, linkname: Willpower
attrname: Dexterity, sklname: Fieldcraft, linkname: Dexterity
attrname: Perception, sklname: Investigation, linkname: Perception
attrname: Reflexes, sklname: Ranged Weapons, linkname: Reflexes

Notice that the movement skill, which is linked to the Agility attribute is showing up three times instead of just once. I am stumped again.

Duggan September 28th, 2017 03:45 AM

Just covering the obvious, have you checked the debug output to be sure that you don't have Agility or Movement added multiple times to your hero?

EightBitz September 28th, 2017 05:16 AM

Quote:

Originally Posted by Duggan (Post 256519)
Just covering the obvious, have you checked the debug output to be sure that you don't have Agility or Movement added multiple times to your hero?

Yep. And they're both set as unique.

ShadowChemosh September 28th, 2017 12:01 PM

Quote:

Originally Posted by EightBitz (Post 256521)
Yep. And they're both set as unique.

I would add debug logic to confirm the thingid so you can be sure what your looking at.

Code:

debug eachpick.idstring
Honestly it looks like you have multiple Picks on the Hero. Once you get the Thing ID you can confirm if they are really the same Pick or different.

EightBitz September 28th, 2017 12:22 PM

Quote:

Originally Posted by ShadowChemosh (Post 256536)
I would add debug logic to confirm the thingid so you can be sure what your looking at.

Code:

debug eachpick.idstring
Honestly it looks like you have multiple Picks on the Hero. Once you get the Thing ID you can confirm if they are really the same Pick or different.

It's the same idstring all three times.
That is the only thing with a name of "Movement"
Movement is defined as unique.
All the skills are bootstrapped in bootstrap.1st, and since they're all unique, nothing is user selectable, so no skill can be added multiple times.

EightBitz September 28th, 2017 12:23 PM

Quote:

Originally Posted by ShadowChemosh (Post 256536)
I would add debug logic to confirm the thingid so you can be sure what your looking at.

Code:

debug eachpick.idstring
Honestly it looks like you have multiple Picks on the Hero. Once you get the Thing ID you can confirm if they are really the same Pick or different.

Also, on the final output, it's only listed once. If it was actually duplicate picks on the hero, it would be listed multiple times, no?

EDIT: No, scratch that. With this logic, it would only be listed once. But in the UI, it's listed on the skills table only once, and THAT should be an indication that it's only picked once.

Duggan September 28th, 2017 01:16 PM

Movement is unique. Is Agility?

EightBitz September 28th, 2017 01:30 PM

Quote:

Originally Posted by Duggan (Post 256544)
Movement is unique. Is Agility?

Yep. Every attribute is unique, bootstrapped, and not user-selectable. Every skill is also unique, bootstrapped, and not user-selectable.

EightBitz September 28th, 2017 01:41 PM

Just to see what would happen, I removed "isunique='yes'" from the Movement skill, and I got an error that the linked trait must be unique. So I put it back, then removed it from Agility. I get an error that the compset requires it to be unique.

So, not only are both unique, but one is required to be unique by its compset, and the other is required to be unique by virtue of having a linkage.

EDIT: Actually, I misread one of the error messages. For "Movement", it's the compset as well. For both skills and attributes, their compsets require them to be unique.

Mathias September 28th, 2017 01:46 PM

Try adding a

Code:

debug "starting script"
at the very beginning, so that you can tell if the script has re-started - visual elements can end up being generated several times.


All times are GMT -8. The time now is 04:50 AM.

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