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
hodgkinr
Wanderer


Joined: 05 Jan 2002
Posts: 55
Location: United Kingdom

PostPosted: Tue Dec 30, 2003 11:05 am   

trigger help please
 
I remember picking this off a forum a while back now and i have just got around to making it work for me.

Trigger is on: (%1) gives you (%2) (%3) coin

emote does not usually take money from strangers, but i'll toss you for it, lets gamble.
emote says heads you win tails you loose!
emote takes a coin from his pocket and casually flips it into the air.
#VAR gambler %1
#VAR bet %2
#var coin %3
#VAR results %case( %random( 2), "heads", "tails")
emote watches the coin land on @results
#IF (@results = heads) {
emote says you win!
give @bet @coin coins to @gambler
} {emote says you loose sorry...try again later!}

The problem i'm getting is when they win. It does not seem to be recognising my variables sending them back to the mud. I get the mesage:

Give what to who?
There is prolly some other char needed instead of the @.

If you can point me in the right direction i would appreciate it.

Thanks

Bob
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Dec 30, 2003 12:01 pm   
 
Don't use %1..%n inside trigger patterns. This may lead to unexpected results. Instead, use the proper wildcard, like %w, %d, * or some other.

You didn't give the message from the MUD when someone gives you coins, but I'll assume that the pattern you need is:
(%w) gives you (%d) (%w) coin

Next, in the comparison, enclose heads in double quotes, since it is a string literal:
@results = "heads"

Finally, make sure that your variables are being assigned something. It is also possible that you changed the variable resolution character (normally @) to something else, so check for that in the Preferences, under Special Characters.
Reply with quote
hodgkinr
Wanderer


Joined: 05 Jan 2002
Posts: 55
Location: United Kingdom

PostPosted: Tue Dec 30, 2003 2:57 pm   
 
Ok I’m triggering on: give 1 gold coin to greyheart
I have now changed the trigger to: (%a) gives you (%b) (%c) coin

And updated the program to:

emote don't really take money from strangers, but i'll toss you for it, lets gamble.
emote says heads you win tails you loose!
emote takes a coin from his pocket and casually flips it into the air.
@gambler = %1
@bet = %2
@money = %3
#VAR results %case( %random( 2), "heads", "tails")
emote watches the coin land on @results
#IF (@results = "heads") {
emote says you win
give @bet@money coins to @gambler
} {emote says you loose sorry...try again later!}

my special character preferences definatley have the Variable Char @ enabled.

But it’s still not sending the: give @bet@money cons to @gambler

If I use #show give @bet@money coins to @gambler
I get:
give 1 gold coins to Greyheart
echo on the screen
my guess now is the mud has capitalised my char name and this is the problem but how do I change the 1st char to lower case in my variable?

Thanks
Bob
Reply with quote
hodgkinr
Wanderer


Joined: 05 Jan 2002
Posts: 55
Location: United Kingdom

PostPosted: Tue Dec 30, 2003 3:22 pm   
 
ok got it %lower
works fine now
Thanks
Bob
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