|
Senior Member
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,321
|
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> Am I missing something regarding the trigger? Working on - |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
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.
|
#2 |
Senior Member
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,321
|
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. Working on - |
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
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. |
#4 |
Senior Member
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,321
|
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> Code:
<field id="trtBase" name="Base Value" type="derived" persistence="full" defvalue="0"> </field> Thing is, I'm not seeing a difference between what I have, and the same type of portal from the sample In Play tab. Working on - |
#5 |
Senior Member
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,321
|
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> Quote:
Working on - |
|
#6 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
For that error, please show me the <templateref/> down in the layout element where this template has been placed.
|
#7 |
Senior Member
Join Date: Jan 2007
Location: NW Arkansas
Posts: 1,321
|
I had a feeling I might be missing something there, but couldn’t figure out what....
Code:
<templateref template=“baRoll” taborder=“60” /> Working on - |
#8 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,213
|
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. |
#9 |
|
|