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 ➜ Multi-stage autoresponse emotes.

Multi-stage autoresponse emotes.

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


Posted by Magnum   Canada  (580 posts)  Bio
Date Sat 21 Sep 2002 06:28 PM (UTC)

Amended on Sat 21 Sep 2002 06:40 PM (UTC) by Magnum

Message
Just for fun, I have created just a few auto-response emotes (socials) for humourous purposes. If you are very sensitive to poor sexual comments, you may want to ignore the rest of this post, as it can be a tad distasteful in it's attempt to be funny.

A few people at Ages of Despair MUD have asked me how it was done, so I will provide the code here.

First, the trigger which detects that someone has used the "pet" emote to pet me:

<triggers>
  <trigger
   enabled="y"
   match="^(?:&gt; )*(?:\*)*(\w*) pets you lovingly\.$"
   name="EMOTE_pet"
   regexp="y"
   script="Emote_Pet"
   sequence="100"
  >
  </trigger>
</triggers>

(The &gt; is actually a > in my trigger.)

Now, the script that it calls:

Sub Emote_pet (TriggerName, TriggerLine, arrWildcards)
	If NOT (World.IsTimer("Emote_Pet_Timer") = 0) Then
		EmotePet = 0
	End If
	If LCase(arrWildcards(1)) <> EmotePetter Then
		EmotePetter = LCase(arrWildcards(1))
		EmotePet = 0
	End If
	If LCase(arrWildcards(1)) = "quintesence" Then
		World.LogSend "remote " & LCase(arrwildcards(1)) & " smiles as you pet him."
	Else
		EmotePet = EmotePet + 1
		Select Case EmotePet
			Case 1
				World.LogSend "remote " & LCase(arrwildcards(1)) & " develops an erection, better not pet him anymore!"
				World.DeleteTimer "Emote_Pet_Timer"
				World.AddTimer "Emote_Pet_Timer", 0, 0, 15, "", 5, ""
			Case 2
				World.LogSend "remote " & LCase(arrwildcards(1)) & " moans and thanks you for petting his erection."
				World.DeleteTimer "Emote_Pet_Timer"
				World.AddTimer "Emote_Pet_Timer", 0, 0, 15, "", 5, ""
			Case 3
				World.LogSend "remote " & LCase(arrwildcards(1)) & " makes a mess in your hands! Thank you!"
				World.DeleteTimer "Emote_Pet_Timer"
				World.AddTimer "Emote_Pet_Timer", 0, 0, 15, "", 5, ""
			Case Else
				World.LogSend "remote " & LCase(arrwildcards(1)) & " dodges your messy hands. Eww! Stay away!"
				World.DeleteTimer "Emote_Pet_Timer"
				World.AddTimer "Emote_Pet_Timer", 0, 5, 0, "", 5, ""
		End Select
	End If
End Sub

The script uses the existance of a timer to determine what stage of emote to respond with. If the sender repeats a second emote within 15 seconds, they get the stage 2 response. Again and they get the stage 3 response. Yet again, and they receive the 4th (and final response). They will continue to get the last response for 5 minutes, or until someone else performs the emote, in which case the routine is reset to their name.

There is an exception check made for a player named "quintesence". If that player uses the "pet" emote with me as a target, they get a custom response.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 22 Sep 2002 08:05 AM (UTC)
Message
Aren't the multiple World.AddTimer lines redundant? Why not just have one outside the select case?

- Nick Gammon

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

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #2 on Sun 22 Sep 2002 04:47 PM (UTC)
Message
Yes, I suppose I could have assigned the seconds and minutes to variables, and then used a single 'AddTimer' line after the CASE statement, using those variables. :)

(The last one is 5 minutes, as opposed to 15 seconds).

I've moved this, and a couple of other emote responses to a plugin. Later, I plan to create an xml 'ENTITY' value representing a regular expression that matches the mud prompt, then see if I can use that value later in the XML, at the beginning of each trigger code.

(My prompt is simply "> ", but others may have something more complex).

If it works on this simple plugin, I will incorporate it into future plugins.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 23 Sep 2002 02:26 AM (UTC)
Message
I didn't spot the difference, must have been skimming again. :)

At least you could put the deletetimer outside the case statement.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


13,795 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.