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)
-   -   Trigger button - No action? (http://forums.wolflair.com/showthread.php?t=61048)

TCArknight August 8th, 2018 01:25 PM

Trigger button - No action?
 
I have an action button on a portal.
Code:

    <portal
      id="rollability"
      style="actBig"
      tiptext="Click to roll your ability scores.">
      <action
        action="trigger"
        confirm="This will reroll your base attributes. Proceed?">
        <trigger><![CDATA[
                  perform hero.assign[Helper.RollAbilities]
                  notify "Button Clicked"
                ]]></trigger>
        <buttontext><![CDATA[
          @text = "Roll Abilities"
          ]]></buttontext>
        </action>
      </portal>

When the button is clicked the confirmation message does pop up. But, the Helper.RollAbilities tag is never assigned to the hero, and the notify never shows.

Am I missing something regarding the trigger?

Mathias August 8th, 2018 02:13 PM

You can't assign tags permanently with a trigger script - they'll vanish once the current calculation pass is done, because tag lists are always empty at the beginning of evaluation, and then the scripts assign more tags, and the button's script isn't running every single calculation pass. The script will have to change a user field or a persistent derived field, and then a script will look at that to determine whether to assign the tag.

TCArknight August 8th, 2018 03:35 PM

Thanks Mathias. :)

I did try having an foreach pick loop in the trigger to step through each Attribute on the hero and modify a field, but that didn’t seem to work either.

Neither did calling a procedure that did the same.

Shouldn’t the notify statement run at least? Even if it’s the only thing in the trigger, no notification pops up.

Mathias August 8th, 2018 03:56 PM

Does the notify pop up the next time you make some other change - just enough to trigger a re-evaluation, like adding and deleting a space from the name?



If not, test whether commenting out line 1 of that script gets the notify working - could be that assigning a tag is really bad, but not something that's getting a warning, so HL just stops running the script.

TCArknight August 8th, 2018 04:36 PM

No such luck....
Code:

    <portal
      id="rollability"
      style="actBig"
      tiptext="Click to roll your ability scores.">
      <action
        action="trigger"
        confirm="This will reroll your base attributes. Proceed?">
        <trigger><![CDATA[
                ~declare variables that are used to communicate with our caller
                var NumOfDice as number
                var SizeOfDice as number
                var total as number
                var myVal as number
       
                NumOfDice = 3
                SizeOfDice = 6
                ~call DieRoll
                var i as number
       
                total = 0
                for i = 1 to NumOfDice
                  total += random(SizeOfDice)
                  next
         
                if (total <= 3) then
                  myVal = -2
                elseif (total <= 5) then
                  myVal = -1
                elseif (total <= 8) then
                  myVal = 0
                elseif (total <= 11) then
                  myVal = 1
                elseif (total <= 14) then
                  myVal = 2
                elseif (total <= 17) then
                  myVal = 3
                elseif (total <= 18) then
                  myVal = 4
                  endif
                         
                hero.child[abilAccuracy].field[trtBase].value = myVal
                ]]></trigger>
        <buttontext><![CDATA[
          @text = "Roll Abilities"
          ]]></buttontext>
        </action>
      </portal>

the trtBase field is defined as:
Code:

    <field
      id="trtBase"
      name="Base Value"
      type="derived"
          persistence="full"
      defvalue="0">
      </field>

There is no change to the value in trtBase after confirming the trigger. (most of the content is in the DieRoll procedure, but as the call DieRoll didn't seem to work, I moved the rest into the trigger directly.

Thing is, I'm not seeing a difference between what I have, and the same type of portal from the sample In Play tab.

TCArknight August 8th, 2018 05:20 PM

Ok, one thing I notice is that each other instance of the triggers are part of portals that are in templates.

I try modifying it to part of a template:
Code:

  <template
    id="baRoll"
    name="Roll Abilities"
    compset="Ability"
    marginhorz="16"
    marginvert="3">
       
    <portal
      id="rollability"
      style="actBig"
      tiptext="Click to roll your ability scores.">
      <action
        action="trigger">
        <trigger><![CDATA[
                ~declare variables that are used to communicate with our caller
                var NumOfDice as number
                var SizeOfDice as number
                var total as number
                var myVal as number
                NumOfDice = 3
                SizeOfDice = 6
                call DieRoll
         
                if (total <= 3) then
                  myVal = -2
                elseif (total <= 5) then
                  myVal = -1
                elseif (total <= 8) then
                  myVal = 0
                elseif (total <= 11) then
                  myVal = 1
                elseif (total <= 14) then
                  myVal = 2
                elseif (total <= 17) then
                  myVal = 3
                elseif (total <= 18) then
                  myVal = 4
                  endif
                 
                hero.child[abilAccuracy].field[trtBase].value = myVal
                herofield[acCashCfg].value += 1000
                ]]></trigger>
        <buttontext><![CDATA[
          @text = "Roll Abilities"
          ]]></buttontext>
        </action>
      </portal>

At this point, when I click the 'button' I get:
Quote:

Use of a trigger script requires a valid pick context be established
and also, the buttontext doesn't show on the button....

Mathias August 9th, 2018 06:50 AM

For that error, please show me the <templateref/> down in the layout element where this template has been placed.

TCArknight August 9th, 2018 06:58 AM

I had a feeling I might be missing something there, but couldn’t figure out what....
Code:

<templateref template=“baRoll” taborder=“60” />
And..... I think I see what’s missing. Would I need to add a thing=“” entry for it? If so, would it be actor or the ability component?

Mathias August 9th, 2018 07:01 AM

Since you have a line in there that's modifying abilAccuracy, I'd use abilAccuracy. That way, that line can be changed to:

field[trtBase].value = myVal


The actor should also work.

TCArknight August 9th, 2018 07:50 AM

Thank you!

I’ll give that a shot when I get home this evening...


All times are GMT -8. The time now is 05:28 PM.

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