I need a hand on this script...

Posted by Synzra on Thu 22 Dec 2005 05:29 PM — 4 posts, 18,172 views.

#0
I had this script from my old mud and Im trying to redo it.(I kinda forgot some of the stuff) I have all the triggers for the mob but what I want it to do is look after the mob is dead and if there is more wait... till the room is cleared then move to the next room. Here is the script...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<muclient>
<plugin name="AutoXP_Ifgan"
author="Daffy"
language="jscript"
id = "54611e74584c983ca61b9a0f"
purpose = "Ifgantius XP Script"
date_written = "2004-11-13 02:30:00"
date_modified = "2004-11-13 02:30"
version = "1.0"
save_state = "y"
>
<description trim="y">
<![CDATA[
Script to XP in Ifganistan
]]>
</description>
</plugin>
<triggers>
<trigger
enabled="y"
keep_evaluating="y"
match="*They aren't here.*"
name="NOT_HERE"
regexp="n"
script="DoIfgan"
sequence="100"
group="IfganXP"
>
</trigger>
<trigger
enabled="y"
keep_evaluating="y"
match="* is DEAD!!"
name="IS_DEAD"
regexp="n"
sequence="100"
group="IfganXP"
>
</trigger>

<trigger
enabled="y"
match="* places * into your back. OUCH!*"
name="BSALERT"
sequence="100"
sound="D:\Program Files\Windows NT\Pinball\SOUND36.WAV"
group="BsAlert"
>
</trigger>
<trigger
enabled="y"
match="* tries to backstab you, but misses!*"
name="BSALERT_MISS"
sequence="100"
sound="D:\Program Files\Windows NT\Pinball\SOUND36.WAV"
group="BsAlert"
>
</trigger>
</triggers>
<aliases>
<alias
script="reset"
match="resetifgan"
enabled="y"
ignore_case="y"
>
</alias>

<alias
script="enable"
match="enable IfganXP"
enabled="y"
ignore_case="y"
>
</alias>
<alias
script="disable"
match="disable IfganXP"
enabled="y"
ignore_case="y"
>
</alias>
</aliases>
<script>
<![CDATA[
function OnPluginInstall() {
world.note('\n\n--------------------------------');
world.note('\nNOW RUNNING IFGANTIUS!\n');
world.note('Commands: ');
world.note('\tEnable IfganXP\t| Turns XPing triggers ON.');
world.note('\tDisable IfganXP\t| Turns XPing triggers OFF.');
world.note('\tEnable BsAlert\t| Turns Backstab Alert triggers ON.');
world.note('\tDisable BsAlert\t| Turns Backstab Alert triggers OFF.');
world.note('\tresetifgan\t| Resets script\'s location pointer to beginning of Ifgantius.');
world.note('\n\nXPing AFK IS ILLEGAL! You\'ve been warned!\n');
world.note('--------------------------------\n\n');
}

var step=0;

function DoIfgan(thename, theoutput, wildcardsVB) {

var steprooms = "sssssssssssse nnnnnnnnnnnnnenesensesessssssssssss wnnnnnnnnnnnnssssssssssss wswnwsnwnwnnnnnnnnnnnn*";
tostep = steprooms.charAt(step);
step++;
switch(tostep){
case "X":
world.send("exam gate");
world.DoAfter(5, "");
break;
case "*":
world.note("\nSCRIPT LOOPING!\n");
step = 0;
world.send("");
break;
case " ":
world.send("");
break;
default:
world.send(tostep);
world.send("");
break;
}
}

function enable(thename, theoutput, wildcardsVB) {
wildcards = VBArray(wildcardsVB).toArray();
world.EnableTriggerGroup("IfganXP", true);
world.note("\nIfganXP trigger group enabled.\n");
}

function disable(thename, theoutput, wildcardsVB) {
wildcards = VBArray(wildcardsVB).toArray();
world.EnableTriggerGroup("IfganXP", false);
world.note("\nIfganXP trigger group disabled.\n");
}

function reset(){
step = 0;
world.note("\nRestarting location pointer. Ifgantius RESET!\n");
}
]]>
</script>
</muclient>

Any help would be much appreciated :) Synzra
Australia Forum Administrator #1
It's not really clear what the problem is. Is it not working? In what way?
#2
Notice this on the script

switch(tostep){
case "X":
world.send("exam gate");
world.DoAfter(5, "");
break;
case "*":
world.note("\nSCRIPT LOOPING!\n");
step = 0;
world.send("");
break;
case " ":
world.send("");
break;
default:
world.send(tostep);
world.send("");
break;


In between the " " were (kill mob), basically what it would do is kill mob every room till it does see one then it stop and kill the mob. Once the room is cleared it goes on the next room doing the same thing.... (k mob) following the step. What I want it to do is follow the path but if there is a mob,stop,clear the room (if mob is present), then go on once it cleared. I cant remember if there is a pause thing when it detect a mob. Heres an example what my mud is showing me....

Front Straight Away
[Exits: north east south]
This is a 4000 ft. straight away. Speeds along here can easily reach 150 or
more miles per hour. You never knew just how hard it was to steer a car going
this fast did you?

(White) #14, Buckshot Jones, leaves you eating his dust.
(White) #28, Ricky Rudd, gets loose coming out of the turn.
(White) #02, Ryan Newman, blows a tire.

I already have all the mob set in my triggers... a ton of different mobs in this particular zone. I dont know if this help any Nick?
Amended on Sat 24 Dec 2005 04:11 PM by Synzra
Australia Forum Administrator #3
It might be possible to rewrite the script using the "wait for input" ideas I presented a while back. See:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4957