tatteredking
Well-known member
I am attempting to write a script that counts how many skills have X ranks in them .
My thought was to define a counter variable, and then go through each skill, and if the skill had sufficient ranks, it increments the variable. I looked at the Master Craftsman feat, which has a requirement of 5 skills in any 2 Craft or Profession skills, but there was no script in there.
Having some skill in coding in other languages, I assumed I needed to define a variable. Then I banged out this script...
Syntax error in 'pre-requisite rule' script for Thing ... on Line 4
-> Unrecognized name for a special symbol in current context: 'skcounter
So it appears I am not defining the variable correctly. So, a couple questions...
1) is there an easier way to script a prerequisite of "Any two skills at rank 6"?
2) how does one properly define a user defined variable?
My thought was to define a counter variable, and then go through each skill, and if the skill had sufficient ranks, it increments the variable. I looked at the Master Craftsman feat, which has a requirement of 5 skills in any 2 Craft or Profession skills, but there was no script in there.
Having some skill in coding in other languages, I assumed I needed to define a variable. Then I banged out this script...
Code:
@valid = 0
~ reset counter
@skcounter = 0
~ count how many skills have ranks 6 or more
if (#skillranks[skAppraise] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skAcrobat] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skBluff] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skClimb] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skCrafAlch] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skDiplo] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skDisable] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skDisguise] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skEscape] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skFly] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skHandleAn] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skHeal] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skIntim] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowArca] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowDun] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowEng] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowGeog] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowHist] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowLoc] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowNat] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowNobl] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowOth] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowRel] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skKnowPlan] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skLinguist] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skPercep] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skRide] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skSenseMot] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skSleight] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skSpellcr] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skStealth] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skSurvival] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skSwim] >= 6) then
@skcounter = @skccounter +1
endif
if (#skillranks[skUseMagic] >= 6) then
@skcounter = @skccounter +1
endif
~ valid if two or more skills have rank 6 or more
if (@counter >= 6) then
@valid = 1
endif
Syntax error in 'pre-requisite rule' script for Thing ... on Line 4
-> Unrecognized name for a special symbol in current context: 'skcounter
So it appears I am not defining the variable correctly. So, a couple questions...
1) is there an easier way to script a prerequisite of "Any two skills at rank 6"?
2) how does one properly define a user defined variable?