Doing random socials

Posted by Nick Gammon on Fri 04 Jan 2002 05:31 AM — 4 posts, 22,407 views.

Australia Forum Administrator #0
Recently I had occasion to stay connected (to the Internet) by sending periodic messages to a MUD. Using a timer was the obvious choice, but to be a bit more interesting I wanted to not just send the same thing every time. (Also, some MUDs disconnect you if you send the same thing repeatedly). After a bit of research, I came up with this small script routine.

By typing in "socials" I got a list of socials, and by copying and pasting (and removing multiple spaces) I was able to quickly get a list of them in usable form.

Then I used "split" (as suggested by Krenath) and the "rnd" (random) function to choose one of them.

All that remains to be done is to add a timer, firing, say, every minute, and calling the script routine DoRandomSocial.

The SocialsList variable itself is outside the sub, as building it up is only needed to be done once (when the script is loaded).

If you are going to use this code you had better generate your own list of socials from your own MUD (I used the ones on Blood Moon), and use an editor to put the quotes at the start and end, like I did below (and remove multiple spaces between them).

The net effect is MUSHclient sends a randomly-chosen social when the timer fires. Here is some example output ...




growl
Grrrrrrrrrr...
liver
You look angrily for someone to disembowel.
snowball
Who do you want to throw a snowball at?
beam
You beam delightedly at nothing in particular.
pound
You make vague pounding motions with your fist at the thought.




Here is the script code (VBscript) ...





dim SocialsList  ' store list of socials

SocialsList = split ( _
"aargh acceptapol accuse adjust agree air " & _
"anticipate apologize applaud arias babble bark " & _
"bat bcatch beam bearhug beckon beer " & _
"beg bite bkiss bleed blink blush " & _
"boast boggle bonk bounce bow brb " & _
"buff burp cackle camel charge cheer " & _
"chortle chuckle clap claw collapse comfort " & _
"compliment confused conspire contemplate cough cover " & _
"cower cramp cringe criticize cry cuddle " & _
"cup curse curtsey dance daydream discodance " & _
"doh drool duck egrin embrace explode " & _
"eyebrow faint fart fatality flare flex " & _
"flinch flip flirt flutter foot french " & _
"frown fume furrow gack gag garlo " & _
"gasp giggle glare goose grimace grin " & _
"groan grovel growl grumble gulp halo " & _
"hand handshake head hiccup highfive homework " & _
"hop howl hug hush innocent insane " & _
"jig judge kiss groin laces laaag " & _
"laugh lean lick life listen liver " & _
"love lust massage meditate mime mischievous " & _
"moan mock mooon mosh mull mutter " & _
"nod noogie nudge nuzzle pale pant " & _
"passout pat peck peer pie pinch " & _
"pissed plead point poke polite ponder " & _
"pound pout powertrip pray propose pth " & _
"puke punch purr ramble raspberry rofl " & _
"roll romeo rub ruffle run sage " & _
"sarcasm scold scowl scratch scream scuff " & _
"serenade shake shiver shoo shrug shudder " & _
"sigh silly sing slap slobber smile " & _
"smirk snap snarl sneeze snicker sniff " & _
"snore snort snowball snuggle sob spam " & _
"spank spit squeal squeeze squint squirm " & _
"stagger stare starve stomp stretch strut " & _
"sulk support sweep swoon tackle tag " & _
"tank tap tease thank threaten tickle " & _
"tight tip toast tweak twiddle twirl " & _
"twitch type undress view violin wait " & _
"wave whap whine whip whistle wiggle " & _
"wince wink wonder worry worship wrestle " & _
"wrist yae yawn yeehaw yodel yowl " & _
"zerbert ")
Randomize  ' Initialize random-number generator.

Sub DoRandomSocial (strTimerName)
  world.send SocialsList ( rnd * ubound (SocialsList ))
End Sub
Amended on Fri 04 Jan 2002 05:54 AM by Nick Gammon
#1
Is there an easy way to modify the random social plugin so that instead of socials, a list of emotes that I compiled would get sucked in and randomly set off?
USA #2
That can easily be done by replacing the socialist with an array of the things you want to send.
SocialList = Array("emote is doing something.", "emote is doing something else.")

or, to save from having to type emote on each one (assuming they all start with the same thing), you can remove that from the thing above ("is doing something.", "is doing something else.") and make your send line:

Sub DoRandomSocial (strTimerName)
world.send "emote " & SocialsList(rnd * ubound (SocialsList))
End Sub
#3
Thanks Flannel, I realize though that Nick's random social plugin on Mushclient is more complicated than the one presented here :( so I couldn't follow what you suggested step by step. I'm not that familiar with the code and can't find the array to enter emotes into but here is where I think the array is.

(from random_socials.xml)
<!-- =============================================

Trigger: Collect_Socials
Script: Do_Collect_Socials
Purpose: Matches a line of socials

============================================= -->

<triggers>
<trigger
custom_colour="2"
match="^[A-Za-z ]+$"
name="Collect_Socials"
regexp="y"
script="Do_Collect_Socials"
sequence="100"
>
</trigger>
</triggers>

<script>
<![CDATA[
sub Do_Collect_Socials (sName, sLine, wildcards)
world.enabletrigger "End_Socials", 1
sLine = Trim (sLine)
while Instr (sLine, " ") > 0
sLine = world.Replace (sLine, " ", " ", 1)
wend
world.setvariable "socials", _
world.getvariable ("socials") & " " & sLine
end sub

]]>
</script>

It's somewhere in the triggers I'm guessing but I still don't know where to drop in your instructions. *sigh* But then again, this may not even be where I put it.