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)
-   -   Procedure info displaying help (http://forums.wolflair.com/showthread.php?t=49291)

RavenX May 9th, 2014 07:30 PM

Procedure info displaying help
 
Mathias,

I'm trying to get this procedure to work so that it shows the names of all class features in a list. What am I doing wrong with it?

Code:

  <procedure id="cSpecInfo" scripttype="mouseinfo"><![CDATA[
    @text = "{b} - Class Features & Special Abilities - {/b}{br}{align left}"
    var i as number
    for i = 1 to 30
    @text = @text & "{br} {b}Level " & i & ":{/b} "

      ~display our Spells per day values based on class
      foreach pick from Class where "component.ClassAbil"
        if (eachpick.tagvalue[ClSpecWhen.?] = i) then
          @text = @text & field[name].text & ", "
          endif
        nexteach

      ~ If this was the last level we got to, change the color of the rest
      ~ of the text
      if (i = field[cTotalLev].value) then
      @text = @text & "{text clrdisable}"
      endif

      next

I am trying to build a table that displays names of the class specials similar to pathfinder.

Mathias May 10th, 2014 07:55 AM

This is the type of foreach pathfinder uses to assemble the list of class specials for an archetype, when you're choosing which archetype to add:

Code:

foreach bootstrap in this

RavenX May 10th, 2014 02:24 PM

What am I doing wrong? It keeps giving me an error message:

Quote:

Syntax error in script for Procedure 'cSpecInfo' on line 8
-> Invalid syntax within 'foreach' statement

What is the invalid syntax that it is complaining about?

Code:

  <!-- Proceedure cSpecInfo
        Presents a table that the user can see which displays various Special Ability details.
  -->
  <procedure id="cSpecInfo" scripttype="mouseinfo"><![CDATA[
    @text = "{b} - Class Features & Special Abilities - {/b}{br}{align left}"
    var i as number
    for i = 1 to 30
    @text = @text & "{br} {b}Level " & i & ":{/b} "

      ~display our Spells per day values based on class
      foreach bootstrap in Class where "component.ClassAbil"
        if (i = eachthing.tagvalue[ClSpecWhen.?]) then
          @text = @text & field[name].text & ", "
          endif
        nexteach

      ~ If this was the last level we got to, change the color of the rest
      ~ of the text
      if (i = field[cTotalLev].value) then
      @text = @text & "{text clrdisable}"
      endif

      next
    ]]></procedure>


Mathias May 10th, 2014 02:31 PM

Code:

foreach bootstrap in this from ClassAbil
You have to start the foreach already on the class, then you're looking up the class abilities that are bootstrapped to it.

RavenX May 10th, 2014 03:38 PM

How do I start the foreach on the class?

This will recompile and load but the table isn't displaying anything.

Code:

  <!-- Proceedure cSpecInfo
        Presents a table that the user can see which displays various Special Ability details.
  -->
  <procedure id="cSpecInfo" scripttype="mouseinfo"><![CDATA[
    @text = "{b} - Class Features & Special Abilities - {/b}{br}{align left}"
    var i as number
    for i = 1 to 30
    @text = @text & "{br} {b}Level " & i & ":{/b} "

      ~display our Spells per day values based on class
      foreach bootstrap in this from ClassAbil
        if (eachthing.tagvalue[ClSpecWhen.?] = i) then
          @text = @text & field[name].text & ", "
          endif
        nexteach

      ~ If this was the last level we got to, change the color of the rest
      ~ of the text
      if (i = field[cTotalLev].value) then
      @text = @text & "{text clrdisable}"
      endif

      next
    ]]></procedure>


Mathias May 11th, 2014 09:07 AM

What is the context of the portal that is calling this mouseover?

Or is this something you're calling from the Descript procedure?

I just looked at that - DAMN that'll be slow code - a 30-item for loop, each loop calling a foreach - that'll take forever to generate.

Mathias May 11th, 2014 09:08 AM

Why don't you tell me what the objective is here. I think there's going to be a better way to approach it.

RavenX May 11th, 2014 10:34 AM

Slow? Yes you have 30 levels to iterate through but you don't have class features at each and every level. 2e was sort of sparse in terms of class features.

What the objective is, was to get this information called in through a portal on the Class Tab, similar to what Pathfinder used for Specials, which lists out the name fields of each class feature at the level you gain it. That way someone could just mouse over the table and look to see what features they get and when they become active. Unlike Pathfinder, where you gain something just about every level, they're more spread out. Sometimes you don't get a new one between 9th and 21st level.

I am just trying to have it list the level and class feature name fields in a list based on level using the ClSpecWhen tag that's assigned to it.

Mathias May 11th, 2014 10:58 AM

In that case, what you want to do is create a text array on the class. Then, you put a script on the ClassAbil component that puts the name of that class special into the correct row of that array:

Code:

root.field[whatever].arraytext[level -1] = splice(root.field[whatever].arraytext[level -1], "The new text",", ")
Then, your mouseinfo script only needs a for loop to read off the text in each row.

Mathias May 11th, 2014 10:59 AM

BTW, the fact that the foreach doesn't find anything at most levels doesn't speed things up much - just starting a foreach is time consuming.


All times are GMT -8. The time now is 01:43 PM.

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