• 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

class skill problem

AndrewD2

Well-known member
I've got a race that gets all Cha based skills as class skills, so I grabbed the script from the Circlet of Persuasion and modified it a little changing out the competence bonus for a #makeclassskill[] macro. Looks like this:

Code:
~ Iterate through all our skills
      var ChaSkill as number

      ~ Give bonus only to CHA skills
      foreach pick in hero from BaseSkill
        ChaSkill = 0

        ~ Check Skill Override
        if (eachpick.tagis[SkillOver.aCHA] <> 0) then
          ChaSkill = 1
          endif

        ~ If it has a normal linkage to Charisma it also qualifies.
        if (eachpick.islinkage[skillattr] <> 0) then
          if (eachpick.linkage[skillattr].tagis[thingid.aCHA] <> 0) then
            ChaSkill = 1
            endif
          endif

        if (ChaSkill = 1) then
          #makeclassskill[each]
          endif
        nexteach

And I'm getting this error:
Code:
Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Thing 'raRPMindbe' (Eval Script '#1') on line 21
  -> Non-existent thing 'each' used by script

Can't really figure out why it's not working, I've tried it with each and eachpick and get the same result.

Andrew
 
The macro must not be setup to actually be able to deal with eachpicks. So you just have to assign the tag yourself:

Code:
~ Give bonus only to CHA skills
foreach pick in hero from BaseSkill
  ~ Check Skill Override
  if (eachpick.tagis[SkillOver.aCHA] <> 0) then
    perform eachpick.assign[Helper.ClassSkill]
  else
    ~ If it has a normal linkage to Charisma it also qualifies.
    if (eachpick.islinkage[skillattr] <> 0) then
      if (eachpick.linkage[skillattr].tagis[thingid.aCHA] <> 0) then
        perform eachpick.assign[Helper.ClassSkill]
      endif
    endif
  endif
nexteach

Also my advice is don't get into LW habit of not lining up the IF/ELSE/ENDIF statements. I have never been to a shop that does not line up IF/ELSE/ENDIF statements that includes seeing a dozen different languages.

Based on "memory" should be used carefully I tend to limit the creation of variables as its memory that has to be created and then destroyed by the software/OS. No matter how efficient this is or their garbage collection system is we are still talking overhead that should be limited. This needs to be pushed more now that we have it running on tablets with more limited CPU, memory, and battery life.
 
@AndrewD2 normally I would nick pick code like I just did above but I thought I remember reading you where going for a IT/programmer degree actually. So I just thought I would share what I had seen is all. Obviously its my experiences but I have been to allot of programing shops in the US in my 15 years as a technical consultant. So it should hold "some" water. ;)
 
Heh, I generally always line up my statements unless I'm copying it directly from something else. The idea on overhead is an excellent point that's going into my notebook. I usually try to avoid variables when possible as is.
 
Back
Top