• 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

Removing Helper.NotUsable from a skill.

EightBitz

Well-known member
I'm trying to create a custom magic item that allows a character to have Rogue-like abilities. I'm having an issue with not being able to delete the Helper.NotUsable tag from Disable Device (skDisable). I'm not sure if the tag can't be deleted, if it's a timing issue, or if I'm doing something else wrong.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<document signature="Hero Lab Data">
  <thing id="ioRobeRog" name="Robe of the Rogue" description="This dark blue hooded cloak grants its wearer 1/2 his/her levels of bonus points in stealth, perception and disable device checks rounded up. It also enables its wearer to find traps and disable devices as if he/she were a rouge of the same level." compset="Wondrous">
    <usesource source="srcJimEqp" parent="srcJimHR" name="Equipment"/>
    <tag group="Helper" tag="ShowSpec"/>
    <tag group="Helper" tag="EquipAvail"/>
    <tag group="gType" tag="Wonder"/>
    <tag group="Hero" tag="EqpBody"/>
    <tag group="Helper" tag="EquipMag"/>
    <tag group="Helper" tag="NoPathSoc"/>
    <eval phase="PostLevel" priority="9000"><![CDATA[
    	if (field[gUserEquip].value = 1) then
	      var level as number
	      var halflevel as number
	      var thirdlevel as number
	      var trapsense as number
	      var text as string

	      level = herofield[tLevel].value
	      halflevel = herofield[tLevel].value / 2
	      halflevel = round(halflevel,0,0)
	      thirdlevel = herofield[tLevel].value / 3
	      thirdlevel = round(thirdlevel,0,-1)
				
              perform hero.child[skDisable].delete[Helper.NotUsable]
	      hero.child[skDisable].field[Bonus].value += halflevel
	      hero.child[skPercep].field[Bonus].value += halflevel
	      hero.child[skStealth].field[Bonus].value += halflevel
	      
	      text = "+" & halflevel & " to disable traps."
	      #situational[hero.childfound[skDisable],text,field[thingname].text]

	      text = "+" & halflevel & " to find traps."
	      #situational[hero.childfound[skPercep],text,field[thingname].text]
	      
	      if (level >= 3) then
	         trapsense = thirdlevel
	         text = "+" & halflevel & " to reflex saves vs. traps."
	         #situational[hero.childfound[svRef],text,field[thingname].text]

	         text = "+" & halflevel & " to dodge traps."
	         #situational[hero.childfound[ArmorClass],text,field[thingname].text]
	         endif
	      endif
      ]]></eval>
    </thing>
  </document>
 
Code:
perform hero.child[skDisable].delete[Helper.NotUsable]
It has to be a timing issue because pretty much all tags can be deleted from a Pick.

I would make a 2nd script on the magic that has ONLY the above code. I would move it to Final/999999999 timing to see if the tag gets removed. If so then I work backwards in timing to see why it no longer gets deleted.

You could also add some debug logic to check:
Code:
   	if (field[gUserEquip].value = 1) then
	      var level as number
	      var halflevel as number
	      var thirdlevel as number
	      var trapsense as number
	      var text as string

	      level = herofield[tLevel].value
	      halflevel = herofield[tLevel].value / 2
	      halflevel = round(halflevel,0,0)
	      thirdlevel = herofield[tLevel].value / 3
	      thirdlevel = round(thirdlevel,0,-1)
[B]debug "tag before: " & hero.child[skDisable].tagis[Helper.NotUsable]
              perform hero.child[skDisable].delete[Helper.NotUsable]
debug "tag after: " & hero.child[skDisable].tagis[Helper.NotUsable][/B]
	      hero.child[skDisable].field[Bonus].value += halflevel
	      hero.child[skPercep].field[Bonus].value += halflevel
	      hero.child[skStealth].field[Bonus].value += halflevel
	      
	      text = "+" & halflevel & " to disable traps."
	      #situational[hero.childfound[skDisable],text,field[thingname].text]

	      text = "+" & halflevel & " to find traps."
	      #situational[hero.childfound[skPercep],text,field[thingname].text]
	      
	      if (level >= 3) then
	         trapsense = thirdlevel
	         text = "+" & halflevel & " to reflex saves vs. traps."
	         #situational[hero.childfound[svRef],text,field[thingname].text]

	         text = "+" & halflevel & " to dodge traps."
	         #situational[hero.childfound[ArmorClass],text,field[thingname].text]
	         endif
	      endif

Just a bit of helpful advice:
Code:
text = "+" & halflevel & " to disable traps."
text = "+" & halflevel & " to find traps."
The above is better using signed() function just the correct sign is always used:
Code:
text = signed(halflevel) & " to disable traps."
text = signed(halflevel) & " to find traps."
 
It has to be a timing issue because pretty much all tags can be deleted from a Pick.

I would make a 2nd script on the magic that has ONLY the above code. I would move it to Final/999999999 timing to see if the tag gets removed. If so then I work backwards in timing to see why it no longer gets deleted.

You could also add some debug logic to check:
Code:
   	if (field[gUserEquip].value = 1) then
	      var level as number
	      var halflevel as number
	      var thirdlevel as number
	      var trapsense as number
	      var text as string

	      level = herofield[tLevel].value
	      halflevel = herofield[tLevel].value / 2
	      halflevel = round(halflevel,0,0)
	      thirdlevel = herofield[tLevel].value / 3
	      thirdlevel = round(thirdlevel,0,-1)
[B]debug "tag before: " & hero.child[skDisable].tagis[Helper.NotUsable]
              perform hero.child[skDisable].delete[Helper.NotUsable]
debug "tag after: " & hero.child[skDisable].tagis[Helper.NotUsable][/B]
	      hero.child[skDisable].field[Bonus].value += halflevel
	      hero.child[skPercep].field[Bonus].value += halflevel
	      hero.child[skStealth].field[Bonus].value += halflevel
	      
	      text = "+" & halflevel & " to disable traps."
	      #situational[hero.childfound[skDisable],text,field[thingname].text]

	      text = "+" & halflevel & " to find traps."
	      #situational[hero.childfound[skPercep],text,field[thingname].text]
	      
	      if (level >= 3) then
	         trapsense = thirdlevel
	         text = "+" & halflevel & " to reflex saves vs. traps."
	         #situational[hero.childfound[svRef],text,field[thingname].text]

	         text = "+" & halflevel & " to dodge traps."
	         #situational[hero.childfound[ArmorClass],text,field[thingname].text]
	         endif
	      endif

Just a bit of helpful advice:
Code:
text = "+" & halflevel & " to disable traps."
text = "+" & halflevel & " to find traps."
The above is better using signed() function just the correct sign is always used:
Code:
text = signed(halflevel) & " to disable traps."
text = signed(halflevel) & " to find traps."

Thanks. And thanks for the tip about text=signed...

Timing is still something I don't quite understand. I know there are phases that are executed in a certain order, and I know there's a preferred priority for each phase.

Where I start to get confused is when the priority doesn't match the preferred priority of the phase.

Like, what happens if you have a phase of Final with a priority of 500? Or if you have a phase of PreLevel with a priority of 10000?

I'm going to search my files for the phase text to get an idea of the preferred priority for each phase, and I think I'm going to print that out and pin it to my wall ... unless this is already documented somewhere?
 
A lot of phases have a value of 10000 for a lot of tasks. When I set the tag removal to final @10000, it works. When I step back to PostAttr @10000, it doesn't work. It seems reasonable to leave it at final @10000.
 
Phase and Priority both work to get to a very fine control of "when" something executes. Guess this is easier to understand if you have done "batch" processing in computers. :D

Lets see if I can explain this easily. So the Phase is the wording of Final, First, Post-Attributes. This execute in the order you see displayed in the drop down list.

1) First
2) Pre-Levels
3) Levels
4) Post-Levels
5) Pre-Attributes
6) Attributes
7) Post-Attributes
8) Final Phase

Based on the above we can see something running in Pre-Levels runs BEFORE a script setup as Pre-Attributes.

Then "Priority" allows you to get into detail control within a specific Phase. In example we have two scripts in "Pre-Levels" and we want Script A to run before Script B. We can assign Script A to run at Priority 1,000 and Script B to run at Priority 10,000. Now we know that Script A runs first and Script B second.

If you have two scripts running at exactly the same Phase/Priority (ie Pre-Attributes/10000) then HL randomly selects ONE script to run before the other. But because its random it can switch around each time you make a change in HL.

P.S. - You can have HL help enforce scripts running before/after each other by using the "Timing" button in the eval script window. This allows you to set a "name" to the script and control if it runs after/before another script. This is more advanced but very helpful feature.
 
Last edited:
Phase and Priority both work to get to a very fine control of "when" something executes. Guess this is easier to understand if you have done "batch" processing in computers. :D

Lets see if I can explain this easily. So the Phase is the wording of Final, First, Post-Attributes. This execute in the order you see displayed in the drop down list.

1) First
2) Pre-Levels
3) Levels
4) Post-Levels
5) Pre-Attributes
6) Attributes
7) Post-Attributes
8) Final Phase

Based on the above we can see something running in Pre-Levels runs BEFORE a script setup as Pre-Attributes.

Then "Priority" allows you to get into detail control within a specific Phase. In example we have two scripts in "Pre-Levels" and we want Script A to run before Script B. We can assign Script A to run at Priority 1,000 and Script B to run at Priority 10,000. Now we know that Script A runs first and Script B second.

If you have two scripts running at exactly the same Phase/Timing (ie Pre-Attributes/10000) then HL randomly selects ONE script to run before the other. But because its random it can switch around each time you make a change in HL.

P.S. - You can have HL help enforce scripts running before/after each other by using the "Timing" button in the eval script window. This allows you to set a "name" to the script and control if it runs after/before another script. This is more advanced by very helpful feature.

Ah, OK. I didn't realize that the priority was contained within the phase. I thought that was a global priority. Not sure why I thought that, because having it within the phase makes a lot more sense.
 
Back
Top