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


Joined: 12 Mar 2008
Posts: 1

PostPosted: Wed Mar 12, 2008 7:35 pm   

Random chance to emote
 
I managed to sort my first problem out. Sort of. It's probably a hugely inelegant way of doing it, but ho hum!

Anyway, I want to have a % chance for an emote to fire at the same time as a command - what's the best way to go about doing this?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Mar 13, 2008 12:07 am   
 
#oninput {*} {#if (%random(1,100)>50) {do an emote}}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4715
Location: Pensacola, FL, USA

PostPosted: Thu Mar 13, 2008 1:10 am   
 
%item(@emoteList, %random(1, %numitems(@emoteList)))
_________________
Discord: Shalimarwildcat
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Thu Mar 13, 2008 4:40 pm   
 
And to combine the two...

#oninput {*} {#IF (%random(1,100) > 90) {%item(@emoteList, %random(1, %numitems(@emoteList)))}}

This is a 10% chance, simply lower the 90 to change that higher. Remember, your % chance with this method is the REMAINDER of the 90 out of 100, which is 10.
This randomizes your chance of emoting, and also randomly chooses an emote from a list...

Here is a sample emote list:
emoteList {cough|sneeze|emote pukes on his shoes|spit self|emote bites his nails}

cough, sneeze, and spit are all socials on my former mud. spit self would make your drool.
the others are manual emotes using the emote command.

Enjoy.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Thu Mar 13, 2008 11:20 pm   
 
I bet you get 17 in a row on a bad day and curse the levity.

(listening to cynical music)
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