Multi-stage autoresponse emotes.

Posted by Magnum on Sat 21 Sep 2002 06:28 PM — 4 posts, 17,440 views.

Canada #0
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.
Amended on Sat 21 Sep 2002 06:40 PM by Magnum
Australia Forum Administrator #1
Aren't the multiple World.AddTimer lines redundant? Why not just have one outside the select case?
Canada #2
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.
Australia Forum Administrator #3
I didn't spot the difference, must have been skimming again. :)

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