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
RayJenkins
Newbie


Joined: 20 May 2002
Posts: 2
Location: USA

PostPosted: Sun Apr 21, 2002 5:48 am   

capturing gold in prompt
 
This is my prompt:
&R%X&WXP [&Y%h/%H&WH &B%m/%M&WB &G%v/%V&WV] %a -&P%S &B%T &P%A &W$&Y%g &W>

Shows something like this:
24536XP [500/500H 800/800B 610/610V] 950 -S day H $9999999 >

My pattern:
&W$&Y(%d)

#var cash %1

When I use this trigger, it captures my experience left (%x) instead of my gold (%g), can anyone spot the problem?
Reply with quote
bruntilda
Novice


Joined: 10 Oct 2000
Posts: 39

PostPosted: Sun Apr 21, 2002 8:52 am   
 
quote:

This is my prompt:
&R%X&WXP [&Y%h/%H&WH &B%m/%M&WB &G%v/%V&WV] %a -&P%S &B%T &P%A &W$&Y%g &W>

Shows something like this:
24536XP [500/500H 800/800B 610/610V] 950 -S day H $9999999 >

My pattern:
&W$&Y(%d)

#var cash %1

When I use this trigger, it captures my experience left (%x) instead of my gold (%g), can anyone spot the problem?



You probably need to put a ~ tilde in front of the $ to keep it from matching as a newline. But other than that, i'm not really sure what you are trying to do with all of the & characters, are you trying to automatically save parts of the pattern into variables that way? If so, the syntax is incorrect, look at the "Pattern matching" section of the zmud help, it has some nice examples.


Something like this would work much better to capture the gold.


#TRIGGER { ~$(%d)} {#VAR cash %1}


but this will capture any number preceded by a dollar sign as the amount of money that you have, so it would be better to incorporate this into one large prompt trigger to capture all the status you need at once.
Reply with quote
bruntilda
Novice


Joined: 10 Oct 2000
Posts: 39

PostPosted: Sun Apr 21, 2002 8:54 am   
 
quote:

This is my prompt:
&R%X&WXP [&Y%h/%H&WH &B%m/%M&WB &G%v/%V&WV] %a -&P%S &B%T &P%A &W$&Y%g &W>

Shows something like this:
24536XP [500/500H 800/800B 610/610V] 950 -S day H $9999999 >

My pattern:
&W$&Y(%d)

#var cash %1

When I use this trigger, it captures my experience left (%x) instead of my gold (%g), can anyone spot the problem?



You probably need to put a ~ tilde in front of the $ to keep it from matching as a newline. But other than that, i'm not really sure what you are trying to do with all of the & characters, are you trying to automatically save parts of the pattern into variables that way? If so, the syntax is incorrect, look at the "Pattern matching" section of the zmud help, it has some nice examples.



Something like this would work much better to capture the gold.



#TRIGGER { ~$(%d)} {#VAR cash %1}



but this will capture any number preceded by a dollar sign as the amount of money that you have, so it would be better to incorporate this into one large prompt trigger to capture all the status you need at once.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Apr 21, 2002 11:13 am   
 
This is NOT your prompt:
&R%X&WXP [&Y%h/%H&WH &B%m/%M&WB &G%v/%V&WV] %a -&P%S &B%T &P%A &W$&Y%g &W>
It's the string your MUD uses to create the prompt.

zMUD works with what your MUD shows, it has no way of detecting the string your MUD uses to establish the prompt.

THIS is your prompt, it's what you see after every command:
24536XP [500/500H 800/800B 610/610V] 950 -S day H $9999999 >
and that's what your trigger needs to match. Bruntilda's trigger will do what you intended.

& is a special character, both to your MUD and to zMUD. It is used in a zMUD trigger phrase as a shortcut for creating variables, and becomes a wildcard at the same time. So in your trigger, &W is %1. That's why it captures the experience.

$ is also a special character to zMUD. If you want zMUD to treat a special character as a normal character, it must have the ~ immediately preceding it.

I hope this helped. As Brunhilda said, you should read "pattern matching".

LightBulb
Vague questions get vague answers
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