 |
JWhitney Wanderer
Joined: 20 Oct 2006 Posts: 51
|
Posted: Wed Jun 22, 2011 4:45 am
Using %1 In A Function |
I have a set of prot/buff timers that used to work in zMUD that I can't seem to get to work in CMUD. I've spent many hours trying to fix the problem, but no dice so far. The problem boils down to using %1 inside of a function. Here's an example:
Buff "On" Trigger:
| Code: |
<trigger priority="27810">
<pattern>^Suddenly your body flashes bright white inviting the lightning to strike$at your knuckles.$</pattern>
<value>prot_set thunder_knuckles
prot_report ON Thunder Knuckles</value>
</trigger> |
Buff "Off" Trigger:
| Code: |
<trigger priority="11820">
<pattern>^Your body doesnt seem to sizzle anymore$</pattern>
<value>prot_calc thunder_knuckles
prot_report OFF Thunder Knuckles {@prot_calc(thunder_knuckles)s}</value>
</trigger> |
Prot_Calc ALIAS
| Code: |
<alias name="prot_calc">
<value>#VAR prots_%1 {OFF} {OFF} "Prots Set Variables"
#VAR prots_%1_last {@prot_calc(%1)} {_nodef} "Prots Set Variables"
#SAY "["Duration: @prot_calc(%1)s"]"</value>
</alias> |
Prot_Calc FUNCTION
| Code: |
<func name="prot_calc">
<value>%eval(@base_timer - @prots_(%1)_time)</value>
</func> |
Basically, every bit of this works perfectly except for when it gets to the last part of the Function - as soon as it gets to the @prots_(%1)_time part, it doesn't expand the %1 in to being "@prots_thunder_knuckles_time" as I want it to. This usage (@variablename_%1_etcetera) works in commands and everywhere else I've used it, but not inside of a function. I have tried every variation of brackets and other commands to attempt to get it to expand, but I haven't been successful thus far. Is there any way around this that you folks know of?
Thank you for taking the time to read this. |
|
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4774 Location: Pensacola, FL, USA
|
Posted: Wed Jun 22, 2011 4:51 am |
try @{prots_%1_time}
|
|
_________________ Discord: Shalimarwildcat |
|
|
 |
JWhitney Wanderer
Joined: 20 Oct 2006 Posts: 51
|
Posted: Wed Jun 22, 2011 5:33 am |
Worked perfectly - such a simple solution but I literally spent hours trying to figure it out. Thank you very much for the advice, Shalimar!
|
|
|
|
 |
|
|
|