Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Doing random socials

Doing random socials

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Fri 04 Jan 2002 05:31 AM (UTC)

Amended on Fri 04 Jan 2002 05:54 AM (UTC) by Nick Gammon

Message
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

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Rowane   (3 posts)  Bio
Date Reply #1 on Wed 21 Sep 2005 06:50 AM (UTC)
Message
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?
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #2 on Wed 21 Sep 2005 07:00 AM (UTC)
Message
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

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Rowane   (3 posts)  Bio
Date Reply #3 on Wed 21 Sep 2005 07:19 AM (UTC)
Message
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.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,637 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.