Help With Scripting.. No idea how or what to do!

Posted by Elric on Sun 25 Nov 2001 07:53 AM — 15 posts, 43,732 views.

USA #0
This is a question I am sure alot of people have. I am working on a SmaugWiz MUD as you already know. And I am wondering if there is anyway to script it into MUSHClient to automatically catch fleeing Mobs.

I mean. I would like to follow them and continue fighting them when they flee.

This is what I see.

Your slash _butchers_ a mourner!
Your slash _butchers_ a mourner!
A mourner leaves east.
A mourner flees head over heels!

Now how would I go about making it automatically follow that mourner east!

I'd like to know how to script it in, erm, or if anyone out there can be really generous and just script it out so I can steal it!

Anywho, thanks ahead of time. And Nick! what about that SmaugWiz compliance issue? Anytime soon?
USA #1
Anyone at all?
Australia Forum Administrator #2
This should be easy enough, which script language do you want to use? VBscript? JScript?

USA #3
Well to tell you the truth.. I have no idea what I am doing, so it doesn't matter very much.. Whichever language whoever is going to do it, does it in is perfectly fine by me..
Australia Forum Administrator #4
I'll do it in VBscript, as I am used to it now. :)

The problem seems to me to be that you don't want to follow *anyone* that flees, or leaves, as that might be another player.

Hence I have devised three triggers, one to match on:


Your slash _butchers_ a mourner!


We use that to recognise that we are attacking "a mourner" (or whatever the mob is). We use that to know that we need to follow this mob, and remember its name.


Trigger: Your slash * *
Send: %2
Send to: Variable (label is name)
Label: mobname


The first wildcard (%1) is going to be the type of hit (eg. "tears", "rips", "gashes", "lacerates", "hacks", "mauls", "rends") and the second wildcard (%2) is the name of the monster.

Then we detect that the monster has left the room:


A mourner leaves east.



Trigger: * leaves *.
Label: SomeoneLeaves
Script: SomeoneLeaves


What this does is check that the person leaving is the mob we are interested in (in this example "a mourner") and if it is, remember the direction in the variable "mobdirection".

If it is someone else (eg. another player) then the variable will be unchanged.

Finally we need to detect that mob has fleed, and follow it.


Trigger: * flees head over heels!
Label: SomeoneFlees
Script: SomeoneFlees


This script function checks that the person fleeing is the mob, and if so, goes in the direction that the mob went.

The only potential problem with this arrangement is the case where the "attack" clause is two words, eg. "barely scratches". I'm not sure if that will work properly there. You might need to make extra triggers to cover the cases of the words with spaces in them.

The stuff below goes into your script file, make sure you enable scripting and set the language to VBscript.


sub SomeoneLeaves (strTriggerName, trig_line, arrWildCards)
  if LCase (arrWildCards (1)) = LCase (world.getvariable ("mobname")) then
     world.setvariable "mobdirection", arrWildCards (2)
  end if
end sub

sub SomeoneFlees (strTriggerName, trig_line, arrWildCards)
  if LCase (arrWildCards (1)) = LCase (world.getvariable ("mobname")) then
     if not isnull (world.getvariable ("mobdirection")) then
        world.send world.getvariable ("mobdirection")
     end if
  end if
end sub

USA #5
Lmao.. Tried that.. And this is what I got on my screen..

Your slash _butchers_ a mourner!
a mourner!
Your slash _butchers_ a mourner!
a mourner!
A mourner leaves southeast.
A mourner flees head over heels!

(32715/32715hp|29007m|30000mv)(512)<1849767337 coins>(#2121)
Affected: ( 995) stone skin
Affected: ( 216) bless
Affected: ( 216) bless

(32715/32715hp|29012m|30000mv)(512)<1849767337 coins>(#2121)
Affected: ( 995) stone skin
Affected: ( 216) bless
Affected: ( 216) bless

(32715/32715hp|29012m|30000mv)(512)<1849767337 coins>(#2121)
Australia Forum Administrator #6
If you are seeing "a mourner" on the screen, you haven't set the trigger to send to a variable:

Send to: Variable (label is name)
USA #7
How does one do that, when that choice is not in the dropdown menu?
Australia Forum Administrator #8
It is, in the latest version, which is 3.17.
USA #9
Oy.. I am using 3.04, Sorry.. Will my registration carry over if I install the new one?
USA #10
Alright.. I upgraded and set the right stuff.. NOW when I do it.. Nothing happens..
USA #11
I mean.. When the mourner flees.. Nothing happens.. Nothing at all..

Also... I have a program for a ZMud bot. About how compatible are they?
USA #12
Also.. Another stupid question.. Is there a way to pause in between triggers?

I mean.. If you set a trigger for * tells you 'Heal'

Can you allow it to pause for 2 seconds between each spell?
USA #13
Emm.. Erm.. Did I do something wrong?

Just wondering cause I haven't got a reply. Also, wanted to add a suggestion for MUSHClient.

A mapper like on zMUD. I have both and I quite enjoy the ease of the mapper for usage on my MUD and RoD.

Will there be one on MUSHClient? I know there is a thing that records your directions and allows a speedwalk string. But on zMUD there is an actual mapper that creates a visual map structure to help navigate and speedwalk about the MUD. Just a thought.
Australia Forum Administrator #14
Quote:

Emm.. Erm.. Did I do something wrong?


No, I was doing something else yesterday afternoon. :)

Quote:

Will my registration carry over if I install the new one?


Yes, the same registration code applies to all future versions.

Quote:

I mean.. When the mourner flees.. Nothing happens.. Nothing at all..


Set the triggers to colour the lines so you can see if the trigger is matching or not. If not, you might have an extra space or something in it. The trigger must match exactly what arrives.

If the trigger is matching make sure you have scripting enabled, and the "script file" as the file with the script functions in it.

Then check under the world configuration "variables" window, to see if, at least, the "mobname" and "mobdirection" variables have correct values in them.

Quote:

Also... I have a program for a ZMud bot. About how compatible are they?


They use different scripting languages. In fact MUSHclient supports three languages, VBscript, Jscript and PerlScript. ZMud has its own proprietary scripting language, that I think is like TinyFugue, but I'm not sure.

Quote:

Is there a way to pause in between triggers?


You can achieve that with timers. In the script that is handling the "heal", you can add as many "one-shot" timers as you want. One-shot timers fire once and then delete themselves. You could make them fire after an interval (eg. 2 seconds). To do them in sequence you would have one after 2 seconds, one after 4 seconds and so on.

Quote:

Also, wanted to add a suggestion for MUSHClient.

A mapper like on zMUD. I have both and I quite enjoy the ease of the mapper for usage on my MUD and RoD.


I've thought about that, but a mapper can be quite complex, especially on a MUD where directions are not necessarily logical. eg. if a going west takes you to a room which is actually to the east.

Maybe one day. :)