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
➜ General
➜ Triggers embedded in scripts?
|
Triggers embedded in scripts?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Aleran
(4 posts) Bio
|
| Date
| Sun 25 Apr 2004 09:06 AM (UTC) |
| Message
| right now, i have a HUGE selection of triggers that are purely dedicated to one script i have, and i was wondering if there was a way to either, a) only show triggers from a certain group, or ones without a group b) not show triggers from a selected group or c)put the triggers in the script entirely.
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sun 25 Apr 2004 09:30 AM (UTC) |
| Message
| | I'm not sure exactly what you are asking for, but it sounds like making a plugin would help. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Aleran
(4 posts) Bio
|
| Date
| Reply #2 on Sun 25 Apr 2004 09:37 AM (UTC) |
| Message
| hmm, let me try and make that more clear then.
i have a script that relys on triggers in the client for each mob it catches.
every time i need to add a mob to the script i have to add a trigger to my already huge list, as well as a nearly complete line in the script.
the script allows me to enter a room, and simply call the script to clean it. i find it's really useful.
what i was wanting was to know if there is a way to omit from the trigger window's display triggers that are attached to a certain group. failing that, a way to embed the triggers into the script. | | Top |
|
| Posted by
| Flannel
USA (1,230 posts) Bio
|
| Date
| Reply #3 on Sun 25 Apr 2004 09:43 AM (UTC) Amended on Sun 25 Apr 2004 09:44 AM (UTC) by Flannel
|
| Message
| You could probably rewrite what youre doing into a more modular thing, which would cut down on the ammount of things you have (and the size of your world/script file), if you post more specifics, Itd be more definate.
However, it also sounds like itd be easy enough to make into a plugin. Or rather, yes, you can make it into a plugin. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | | Top |
|
| Posted by
| Aleran
(4 posts) Bio
|
| Date
| Reply #4 on Sun 25 Apr 2004 10:14 AM (UTC) |
| Message
| ^A battle-scarred soldier stalks rigidly down the street.$
sends to variable, reg exp checked, script attached store
the rest of the triggers are quite the same, that is to say, the name of the mob when one looks around the room.
an edited version of the script follows, edited becuase i didnt want to make a huge page.
function store(name,output,wildcardsVB)
{
var temp = world.getvariable("temporary");
var thestring = world.getvariable("thestring");
var toadd = "";
if (temp.indexOf("noble",0) > 0)
toadd = "noble";
else if (temp.indexOf("this wagoneer scowls",0) > 0)
toadd = "wagon";
.................
I cut a large bunch of lines out here
.................
else if (temp.indexOf("loud wagoneer growls",0) > 0)
toadd = "wagon";
else
toadd = "";
if (toadd.length > 0)
thestring = thestring + toadd + "~";
world.setvariable("thestring",thestring);
// world.note(thestring);
}
function cleanstore(name,output,wildcardsVB)
{
world.setvariable("thestring","");
}
function doclean(name,output,wildcardsVB)
{
var temp = world.getvariable("thestring");
var kill = temp.substring(0,temp.indexOf("~",0));
temp = temp.substring(temp.indexOf("~",0)+1,temp.length);
world.note("kill = "+kill);
world.note("temp = "+temp);
if (kill.length > 0)
world.Execute("back "+kill);
world.setvariable("thestring",temp);
}
attached to the script are some other triggers, that allow me to tell the client that a mob has died. they just call the doclean script again. macros are used to clean the string, as well as to start the clean script.
so, i Look in a room, and the client catches the names of mobs it recognizes, feeding the entire line into the script, which catches a unique portion (in most cases anyways) and adds a keyword for the mob to the stack, the hackjob that it is. it does this rather rapidly, and when i decide, i call the script using the macro, and it backstabs each mob in turn.
i guess that i'm now asking if this is possible to turn into a plugin.
thanks for your time in advance. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #5 on Sun 25 Apr 2004 09:36 PM (UTC) |
| Message
| First, you can just invoke the plugin wizard to dump as many triggers as you want into a plugin, this is a pretty quick process, you just select the triggers (and aliases etc.) you want and make the plugin. This will remove them from your main world. Then just load the plugin and you still have the same functionality. Make sure you also retain the relevant parts of the script (in the plugin). This approach would certainly clean up the main world trigger list.
However if you have heaps of triggers that do a similar thing, you may want to investigate making them into a smaller number using the "or" syntax of regular expressions.
For example:
Match: A (battle-scarred soldier|golbin|kobold|midget) stalks rigidly down the street.
This would match 4 mobs rather than one.
Take a look at this forum post:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3958
This describes a similar thing, gagging a large number of players. This uses the array-handling in MUSHclient, combined with a variable to hold the list of things to be gagged, and a subroutine that makes a trigger on-the-fly. This would probably do what you want. Then you can add new mobs with a simple alias and have it added to the list of mobs to be detected. Then you just have one trigger.
|
- 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.
21,431 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top