Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Authoring Kit (http://forums.wolflair.com/forumdisplay.php?f=58)
-   -   Understanding the code by example? (http://forums.wolflair.com/showthread.php?t=57759)

Mettius February 19th, 2017 03:09 PM

Understanding the code by example?
 
OK, after spending most of the weekend trying to get something going for a game system not already in HL, I'm exhaused from the learning curve.
I have a very light programming background (bash scripts a plenty, and a book on Java and Python under my belt, but no seasoned programmer to be sure).

Anyway, I've been reading the wiki until my brain feels like... I don't know. But now I've had a beer and a half, and though I'm feeling better, I'm still struggling to understand some of the skeleton code (the beer will help, right?):

So I'm going to attempt to enhance my learning by deciphering the following code bit by bit. For the love of the gods, if anyone can help that would be appreciated.

Code:

  <procedure id="DshRolls" scripttype="mouseinfo"><![CDATA[
    var final as string
    var roll as string
    foreach pick in hero where "DashTacCon.Rolls"
      if (eachpick.tagis[component.Skill] <> 0) then
        roll = eachpick.field[sklRoll].text & "{text clrsecond}  (" & eachpick.field[trtFinal].text & " + " & eachpick.linkage[attribute].field[name].text & " " & eachpick.linkage[attribute].field[trtFinal].text & "){text clrreset}"
      else
        roll = "????"
        endif
      final &= eachpick.field[name].text & " {b}" & roll & "{/b}{br}"
      nexteach
    @text = "{align left}" & final
    ]]></procedure>


Mettius February 19th, 2017 03:16 PM

proceedure id = DshRolls : OK a unique ID for this proceedure. Got it.

scripttype="mouseinfo" : I have no idea what this means.

<![CDATA[ : This is an XML construct to deal with
conflicting reserved characters. We pretend it isn't there.

var final as string
var roll as string : We are defining variables here, "final" and "roll" they will contain string data.

foreach pick in hero where "DashTacCon.Rolls" : OK here is where I start to have trouble. hero is the character "container" we are creating, pick is... I dunno. everything with the element/thing/don'tknowtheproperterm DashTacCon.Rolls... ???

Mathias February 19th, 2017 05:04 PM

scripttype determines what types of scripts are allowed to call this procedure, because some scripts have special behaviors or options that can only be done on those types of scripts. So scripttype tells the procedure what type of script it will be used in. Here's the wiki page about procedures, which is where it lists all the scripttype options that are available.

http://hlkitwiki.wolflair.com/index.php5?title=Procedure_Element_(Data)

Here's a youtube recording of a seminar I gave at Gen Con, covering how to set up searches (like the foreach operation) in Hero Lab: https://www.youtube.com/watch?v=9UPWoih8-q8&t=161s

Post #7 in this thread is also about foreaches: http://forums.wolflair.com/showthread.php?t=21663

Mettius February 20th, 2017 08:53 PM

Another bit confusing me:
Code:

<inputthing
      name="Linked Attribute for Skill"
      helptext="Select the attribute used to calculate the dice pool for this skill.">
      <it_linkage compset="Attribute" linkage="attribute"/>
      </inputthing>

What does the it_linkage line do? Looks like we are digging into the Attribute compset. And assigning what?

Compset Attribute contains three components...
Code:

  <compset
    id="Attribute"
    forceunique="yes">
    <compref component="Attribute"/>
    <compref component="Trait"/>
    <compref component="CanAdvance"/>
    </compset>

...and looking inside those components (Attribute, Trait, CanAdvance), the only use of lower case "attribute" is...

Code:

<linkage linkage="attribute" optional="no"/>

Mathias February 21st, 2017 08:02 AM

An <inputthing> element defines a line on an editor entry. In that case, this is a place in the editor where the user is selecting which attribute to assign to the "attribute" linkage on that skill.

Try opening the editor, and create a new file. Then, go to the skills tab, and try creating a new skill. You'll see an entry with that name - "Linked Attribute for Skill", and when you try the drop-down, you'll see a list of every item from the Attribute compset. If you look at the XML generated by the editor, you'll see that what you get is:

Code:

<link linkage="attribute" thing="attrSam"/>
(if you picked the sample attribute)

So that will generate the sort of records you're seeing in the thing_skills.dat file.


All times are GMT -8. The time now is 03:22 PM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.