• 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

Modify Description on a component?

TCArknight

Well-known member
I'm back again with something that doesn't seem to be working... :(

I have a Skill component, and this eval script on the component:
Code:
<!-- Update description for each rank3+ with additional info -->
    <eval index="5" phase="Traits" priority="10000"><![CDATA[
      trustme
      var myDesc as string
      
      ~if this skill is not added directly to the hero (i.e. an advance), skip it entirely
      doneif (field[trtFinal].value <= 2)
      
      if (field[trtFinal].value >= 3) then 
        myDesc = field[descript].text
        myDesc &= "{br}{br}{b}Bonus: {/b}Reroll any single die when you take a Risk with this skill.{br}"
        field[descript].text = myDesc
        ~perform amendthing[descript,myDesc]
        endif
         
      ]]></eval>
That results in:
Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Component 'Skill' (Eval Script '#5') on line 11
-> Only derived fields can generally be modified via scripts (field 'descript')

If i try using the amendthing statement instead, I get this:
Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Component 'Skill' (Eval Script '#5') on line 12
-> Script reference is invalid under the circumstances

I created the appenddesc macro based on the posts elsewhere -
Code:
  <scriptmacro
    name="appenddesc"
    param1="thing"
    param2="append"
    result="perform state.thing[#thing].amendthing[description,#append & "{br}{br}" & state.thing[#thing].field[descript].text]"/>

If I try using:
Code:
 #appenddesc[this,myDesc]
it results in
Code:
Hero Lab was forced to stop compilation after the following errors were detected:

Syntax error in 'eval' script for Component 'Skill' (Eval Script '#5') on line 13
  -> Non-existent thing 'this' used by script

I'm at a loss with this, because it seems like the trustme should at least allow me to modify the descript field directly.

Am I missing something?
 
If a field is static, trustme will not override that - it only overrides the protections on user fields and persistent fields.

In your original script, you're still in a pick context - you haven't transitioned to state.thing[], and amendthing isn't valid on a pick.

state.thing[] must be given an Id. "this" is not a legal option, because it's not the Id of a specific thing - it's a path that leads to a pick context. Amendthing is not just modifying the current pick - you need to modify the thing that this pick is based on.

Code:
foreach thing in TheComponent where tagids[thing.?]
     perform eachthing.amendthing[description,"The Text"]
     nexteach

should work.
 
Actually, I'd add a new text field, and then in your mouseinfo procedures, write a standard bit just after where the procedure already adds field[descript].text, so that if that "Additional Information" field is not empty, it adds it to the text that's displayed. Skip the whole amendthing part.
 
Back
Top