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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
jtrent
Beginner


Joined: 22 Nov 2001
Posts: 18
Location: USA

PostPosted: Sun Apr 04, 2004 8:58 pm   

capturing to a variable
 
I am having a slight problem capturing to a variable. I have looked through a bit of the old posts, and didn't see what I need help with, maybe I overlooked, but anyways, if someone would be willing to help me with the following.

#TR {You have (%d)/(%d) hp, (%d)/(%d) ma, (%d)/(%d) mv, (%d)/(%d) st, (*)|}
{#VAR chp %1;#VAR php %2;#VAR cma %3;#VAR pma %4;#VAR cmv %5;#VAR pmv %6;#VAR cst %7;#VAR pst %8;#VAR croom %9;#wait 500;#gag}

Its a trigger of my prompt. I use it for the cppi plugin on the website. But anyways. I am able to capture %1-%8 just fine. %9 I am having trouble with. It's the room name, it usually shows up on my prompt in about 2-5 words. st, is the last set word before the room name, and I used a | for the first set word after the room name.

Any help on this would be appreciated.
Reply with quote
Selorien
Newbie


Joined: 02 Apr 2004
Posts: 3

PostPosted: Sun Apr 04, 2004 10:18 pm   
 
If your mud output outputs the information in two seperate lines, then I would suggest making two seperate triggers, one for each line. If you post an example of your mud output, then I could show you the trigger that I have that does almost the same exact thing for WoTMUD.
Reply with quote
jtrent
Beginner


Joined: 22 Nov 2001
Posts: 18
Location: USA

PostPosted: Sun Apr 04, 2004 10:37 pm   
 
You have 1671/1671 hp, 666/666 ma, 931/931 mv, 1555/1555 st, The Altar| [Healthy]

It's on one line. I can make my prompt any way I decide. Currently I have it set like the above, with #gag on the trigger so that all i see is the results in the status window.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Apr 04, 2004 10:41 pm   
 
Looking at the help for #VAr we see that it takes 4 arguments. Bold arguments are optional.
#VAR variableName value defaultValue class
Because replacement of %nn values occurs before processing of the script begins your 2-5 word room name is intepretted as multiple arguments. To stop this from happening use braces or quotes.
#VAR croom {%9}
or
#VAR croom "%9"

This is true of all scripts. As a general rule try with the proper enclosure first, then remove them if there is a problem.
Reply with quote
jtrent
Beginner


Joined: 22 Nov 2001
Posts: 18
Location: USA

PostPosted: Sun Apr 04, 2004 10:46 pm   
 
Well that did the trick. I appreciate your help.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Apr 05, 2004 2:39 am   
 
Although it's not the problem, #WAIT is discouraged in triggers. See the Support Library for details. Since this trigger only changes variables and gags the line, it really doesn't need a delay and you should just remove the #WAIT.

However, if you still want a delay it can easily be provided by using #COND with no pattern and no value, and a Wait type with a parameter of 500.
#COND {} {} {Wait|Param=500}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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