• 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

Trying to get thingid in foreach

Septerran

Member
I'm trying to create a Mythic template which in turn makes all skills class skills. I also have RGG - Horrifically Overpowered Feats & friends, so I checked 'Skill Domination' feat to find that it does nothing(most of these feats appear to not actually make mechanical changes, probably for good reason).

I have been struggling with this, Hero Lab Scripting, far longer than I care to admit(read: years). I'm a programmer in more than a dozen different languages, including VB, and I still can't seem to wrap my head around 'HLScript'. It's rather frustrating but I figured it's finally time to embrace humility and ask for assistance.

The eval script I've been trying to create is currently at First/500, but I will probably move it if I can find a better timing slot for it.

Code:
~ cycle through skills
foreach pick in hero from BaseSkill
  ~ make class skill
  ~#makeclassskill[eachpick.thingid.?]

  ~ didn't work; maybe this?
  ~field[abText].text = eachpick.thingid.?
  ~#makeclassskill[field[abText].text]

  ~ or maybe this??
  ~var skid as string
  ~skid = eachpick.thingid.?
  ~#makeclassskill[skid]

  ~ obvious frustration....
  ~#makeclassskill[hero.child[AllSkills].thingid]

  ~ maybe pulltags/pushtags..?
  ~ hah! j/k, I don't know how those work
nexteach

I am at a loss here. Not knowing the construction of 'thing' or 'pick'(pick is an instance of thing??), I don't know where to find the thingid and even then, I'm not even sure if that's going to work.

I may be going about this the wrong way entirely and so would appreciate any direction that could be provided. I'm relatively certain that I'm overcomplicating all of this, particularly since I keep trying to learn based on my experience in other languages, but I don't know what else to do and so I keep waiting for it to somehow just 'click', yet it never does.

Please rescue my sanity before there is none left.
 
Hmmm.... I think this might work.....

Right before your foreach, declare a temp variable:
Code:
var myId as string

Then, first thing in the loop do
Code:
myId = eachpick.tagids[thingid.?]

Then use myId in the macro: #makeclassskill[myId]
 
In the end all #makeclassskill[] macro is doing is assigning a tag to a skill. In this case that macro expects to get a non-string based Unique ID.

In example:
Code:
#makeclasskill[skAcrobat]

It can't accept a string or a pointer like eachpick. :(

But you don't really need the macro you can use the assign[] method to assign a specific tag to the Pick you find in the loop.

That code looks like this:
Code:
~ loop through all skill Picks
foreach pick in hero from BaseSkill
  ~ make skill a class skill
  perform eachpick.assign[Helper.ClassSkill]
nexteach
 
Thanks Shadow. I keep forgetting a lot of macros don’t use string values. :(

Do you know of a way to set that up so a macro can if dealing with eachpick, etc? I’m still diving a bit deeper than before into the various constructs and haven’t come across that if it is...
 
Thanks Shadow. I keep forgetting a lot of macros don’t use string values. :(

Do you know of a way to set that up so a macro can if dealing with eachpick, etc? I’m still diving a bit deeper than before into the various constructs and haven’t come across that if it is...
So assuming you need a macro that can access a pointer (and this only works with the authoring kit). Meaning this can not be done for Pathfinder or 5e systems.

In your definition file you could do the following:
Code:
    <scriptmacro
      name="makeclassskill2"
      param1="pick"
      result="perform #pick.assign[Helper.ClassSkill]"/>
I would use a better name than above but works for the example.

Then the foreach loop would be:
Code:
~ loop through all skill Picks
foreach pick in hero from BaseSkill
  ~ make skill a class skill
  #makeclassskill2[eachpick]
nexteach

The compiler just replaces the macro over the code you write. So in the end this:
Code:
#makeclassskill2[eachpick]
becomes this:
Code:
perform eachpick.assign[Helper.ClassSkill]
And then the compiler attempts to compile the script.

So above the Pahthfinder #makeclassskill[] macro goes from this
Code:
#makeclasskill[skAcrobat]
to this
Code:
perform hero.childfound[skAcrobat].assign[Helper.ClassSkill]
 
Thank you both very much. I was thinking things like '#makeclassskill[]' operated like functions rather than as macros. It makes sense that it would stringify the parameter now. This insight has allowed me to make more progress on other things as well, so thanks once again.
 
Back
Top