Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
BossHogg
Newbie


Joined: 19 Jul 2012
Posts: 2

PostPosted: Thu Jul 19, 2012 1:24 am   

#VAR and/or %1 function problem
 
I have the following trigger pattern:

Code:
Roundtime: %d sec.



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.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: 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.
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: 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}
Reply with quote
BossHogg
Newbie


Joined: 19 Jul 2012
Posts: 2

PostPosted: Thu Jul 19, 2012 10:25 pm   
 
You guys rock, that was it.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net