• 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

Procedure info displaying help

RavenX

Well-known member
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.
 
Last edited:
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
 
What am I doing wrong? It keeps giving me an error message:

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>
 
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.
 
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
      [COLOR="Blue"]foreach bootstrap in this from ClassAbil[/COLOR]
        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>
 
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.
 
Why don't you tell me what the objective is here. I think there's going to be a better way to approach it.
 
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.
 
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.
 
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.
 
I added this to the ClassAbil component after adding the array to the class component...
Code:
    <eval index="3" phase="Final" priority="50000"><![CDATA[
      var level as number
      level = root.field[cTotalLev].value 
      level -= 1
      root.field[cSpecials].arraytext[level] = splice(root.field[cSpecials].arraytext[level],field[name].text,", ")
      ]]></eval>

I am now getting an error message:
"Cannot reliably access bootstrap source for unique pick 'cBrdArmPrf'
Location: 'eval' script for Component 'ClassAbil' (Eval Script #3) near line 3
"
It repeats this saying near line 5 as well.
 
In order to use this, ClassAbil items may never be unique, just like class specials in pathfinder/d20.
 
Back
Top