View Single Post
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,730

Old December 16th, 2016, 09:52 AM
Quote:
Originally Posted by Minous View Post
I've been digging around both the almost non-existent documentation and random forum posts, Im drowning here. HL uses its own proprietary language that isnt quickly learned, and is confusing as hell to a programmer.
So I agree mostly with what your finding here about HL scripting. On the other hand you are dealing with Gizmo's which is REALLY hard place to do scripting. You didn't just jump into the deep end of HL scripting you went in with rocks on your feat and sharks in the water.

Overall you are actually doing really well.

The issue above is transitioning to the correct Pick in HL. Transitioning means to have a pointer to the correct location or the correct Xpath if you are use to XML.

In an XML structure:
Code:
<item_master>
   <item>
      <partnumber>
      <part_desc>
   </item>
</item_master>
So for the above if I wanted to reference Part Description I would have "transition" down the Xpath to it. Like so:

Code:
item_master\item\part_desc
This concept works exactly the same in HL which is built on XML tech:
Code:
Top Level Container (Hero)
-Picks live on the Hero (child)
--A feat on the character (fDodge)
---Fields on fDodge
----Values
---Tags on fDodge
--A weapon on the character (wLongsword)
---Fields on wLongsword
----Values
---Tags on wLongsword
--A Magic Weapon (gizmo)
---Longsword Pick (wLongsword)
Based on the above if I wanted to access the non-magical longsword I would do this:
Code:
hero.child[wLongsword].field[xxx].value
If in a script you have "just" a field name:
Code:
field[abValue].value
HL adds in the transition logic "This" for you meaning you are getting the field from the Pick you are actually on.
Code:
this.field[abValue].value
The last thought is "eachpick" which means a generic pointer name that transitions to the Pick that the foreach loop grabbed.

And finally we have "setfocus" which is another generic pointer that is used to place a memory pointer at a single specific Pick. From the HL example above I could say "setfocus" to the fDodge feat. Once I have set that pointer I can access any "field" or "tag" on the fDodge feat by using the "focus" keyword which has all the "transition" logic built in from the setfocus.
Code:
~ Set pointer
perform hero.child[fDodge].setfocus
~ Did the pointer actually set to the fDodge fea?
doneif (state.isfocus = 0) 

~ Increase the abValue field on the fDodge feat by 1
focus.field[abValue].value += 1

~ Set the disable feat tag on to fDodge
perform focus.assign[Helper.ftDisable]
So now based on all the above can you see what is wrong here? Is "state" anything I have listed above for transitioning? Is "field[actName]" not a complete transition?
Code:
state.field[actName]

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.
ShadowChemosh is offline   #17 Reply With Quote