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
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Mar 23, 2002 7:31 am   

Random Trigger
 
quote:

Here's what I'd like to do. (I've tried some different ways, but none seem to work.)

I'd like a trigger to fire a random response back to the mud after a certain action is performed.

Here's what the command I send:

lick soandso

The mud shows:

You lick him. (You lick her, as the case might be)

And I want a trigger off of "You lick him/her." that will randomize sayings such as..

say Mmm! Raspberry!
say Mmm! Peach!

etc, etc.

Please help!

Thanks!



#trigger {You lick {him|her}.} {say Mmm! %item(@Responses,%random(1,%numitems(@Responses))!}

#variable Responses {Raspberry|Peach}

#alias AddResponse {#if (%null(%1)) {#noop there was nothing to add} {#additem Responses %1}}

li'l shmoe of Dragon's Gate MUD
Reply with quote
Carabas
GURU


Joined: 28 Sep 2000
Posts: 434
Location: USA

PostPosted: Sun Mar 24, 2002 6:12 am   
 
If you don't need an alias to add new 'flavors', then a simpler way of doing this would be:

#TRIGGER {You lick {him|her}.} {say Mmm! %case(%random(1,2),Raspberry,Peach)!}

To add more 'flavors' just change the %random(1,2) to %random(1,#), where # is the amount of 'flavors' you have listed in the %case function. For example:

%case(%random(1,4),Raspberry,Peach,Strawberry,Cherry)


Carabas
------
I like work; it fascinates me. I can sit and look at it for hours.
- Jerome K. Jerome
Reply with quote
Sinema
Beginner


Joined: 14 Nov 2001
Posts: 27
Location: USA

PostPosted: Mon Apr 22, 2002 2:22 am   
 
Howdy

Just poking around before asking my question.. and I seem to found something similar to what I wanted to use..

#TRIGGER {You lick {him|her}.} {say Mmm! %case(%random(1,2),Raspberry,Peach)!}

Now how would I alter this instead of Random .. to go 1 .. then 2.. 1 .. then 2..etc..

instead of random .. go in consecutive order..

~
Regards,

Sinema
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Apr 22, 2002 5:47 am   
 
Use a variable that counts how many times it happens (a counter).

#TRIGGER {You lick {him|her}.} {#ADD licks 1;say Mmm! %case(@licks2,Raspberry,Peach)!}

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