 |
BossHogg Newbie
Joined: 19 Jul 2012 Posts: 2
|
Posted: Thu Jul 19, 2012 1:24 am
#VAR and/or %1 function problem |
I have the following trigger pattern:
but, the script text
Code: |
#VAR rt {%1 * 1000}
#WA 3200
att |
The trigger matches the pattern and fires on this line received from the MUD:
Roundtime: 3 sec.
It waits 3.2 seconds and sends the command att to the MUD, but the variable rt value is showing as * 1000 when I'm looking for it to be 3000
What am I doing wrong? It seems to ignore the %1 function. |
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Jul 19, 2012 2:13 am |
The %1 represents the value captured by the first set of parentheses in your pattern, a %2 would represent the value in the second set of parentheses, etc. You don't have any parentheses in your trigger pattern, so there is no value in %1.
Change your pattern to:
Code: |
Roundtime: (%d) sec. |
|
|
|
 |
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Thu Jul 19, 2012 5:43 am |
You also need to change the braces in your #VAR command to parentheses - braces will concatenate the values as strings, parentheses will evaluate them mathematically. So the final trigger will look like this:
Code: |
#TRIGGER {Roundtime: (%d) sec.} {#VAR rt (%1 * 1000);#WA 3200;att} |
|
|
|
 |
BossHogg Newbie
Joined: 19 Jul 2012 Posts: 2
|
Posted: Thu Jul 19, 2012 10:25 pm |
You guys rock, that was it.
|
|
|
 |
|
|