Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, 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.
Entire forum
➜ MUSHclient
➜ General
➜ enable/disable a bunch of triggers
enable/disable a bunch of triggers
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Mirth
(2 posts) Bio
|
Date
| Sat 14 Jul 2001 01:12 PM (UTC) |
Message
| Is there a Mushclient equivalent to the "classes" in zMud? This is essential to me, but I cant find it mentioned in the help files. | Top |
|
Posted by
| Nick Gammon
Australia (23,072 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 14 Jul 2001 11:16 PM (UTC) Amended on Sat 14 Jul 2001 11:17 PM (UTC) by Nick Gammon
|
Message
| There is no direct equivalent, however you can achieve the same effect with a bit of scripting.
In the example below you would use the trigger "label" to put them into classes. The label has to be unique so I have used the first 3 letters of the label to indicate the class. You can change that by amending the number "3" in the script below to some other number.
For instance, a batch of triggers in class "aaa" would look like this:
aaa001
aaa002
aaa003
Thus the first 3 letters are "aaa". Then you could do another class with the starting with "bbb" (or whatever).
Once you have put the script below into your script file, and enabled scripting (language VBscript), you can simply type:
/enableclass "aaa", true ' turn that class on
/enableclass "aaa", false ' turn that class off
Here is the script:
Sub EnableClass (classname, on_or_off)
dim mylist
dim i
dim triggername
mylist = world.GetTriggerList
if not IsEmpty (mylist) then
for i = lbound (mylist) to ubound (mylist)
triggername = mylist (i)
if mid (triggername, 1, 3) = classname then
world.enabletrigger triggername, on_or_off
end if
next
End If
End Sub
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| yramrang
(4 posts) Bio
|
Date
| Reply #2 on Mon 04 Nov 2002 12:43 PM (UTC) |
Message
| hello everyone,
well, first I would like to say that mushclient has saved me from ALOT of truble :) but I still have ALOT to learn too...
so, all I am good for right now is coppy and pasting scripts...
this particular script works perfect for me, but I would like to ask a question on how to put it on an alliace so I wont have to type everytime /enableclass "battle", true
instead, it would be faster to just type "battle on" and "battle off", or even have a trigger that will enable it whenever my fighting prompt apears, wich means I am in a fight :)
currently, I just have a macro that sends to my typing window the "/enableclass "battle", true" command, but macros are limited, and I would like to be able to do that for more classes...
thanks in advance | Top |
|
Posted by
| Avariel
Portugal (55 posts) Bio
|
Date
| Reply #3 on Mon 04 Nov 2002 02:11 PM (UTC) Amended on Mon 04 Nov 2002 02:13 PM (UTC) by Avariel
|
Message
| you can do it with an alias and a small script..
ill try to make an example using JScript ( dont know VBscript sintax )
<aliases>
<alias
script="OnToggleBattle"
match="^battle[ ]+(on|off)$
enabled="y"
regexp="y"
>
</alias>
</aliases>
<script>
<![CDATA[
function OnToggleBattle (thename, theoutput, wildcardsVB)
{
wildcards = VBArray(wildcardsVB).toArray();
var toggle = wildcards [0]
if ( toggle == on ) {
status = true;
}
else if ( toggle == off ) {
status = false;
}
enableclass ( "battle" , status);
world.send ( "--- battle mode [" + toggle + "] ---")
}
]]>
</script>
explanation: whenever you type BATTLE ON or BATTLE OFF the alias will see if you want to toggle on or off and will enable or disable the class with the help of Nick's funtion... then it will send you a note telling what have done..
dont know if thats the better way but i use it in my scripts..
|
The Avariel Wind Lord | Top |
|
Posted by
| yramrang
(4 posts) Bio
|
Date
| Reply #4 on Mon 04 Nov 2002 05:06 PM (UTC) |
Message
| yay!! thanks
I actualy got it to work, I used the same aliace and your script modified as best as I could do it for VB
it looks something like
Dim Toggle
Sub OnToggleBattle (thename, theoutput, thewildcards)
if thewildcards(1) = "on" then toggle = "true"
if thewildcards(1) = "off" then toggle = "false"
enableclass "btl", (toggle)
world.note "battle class is " & (thewildcards(1))
end sub
also made a trigger with a separate script that just enables the battle class when the fighting prompt apears
it just looks like
sub battletrigger (thename, theoutput, thewildcards)
enableclass "btl", true
world.note "battle class enabled!"
end sub
very messy, I know, but it seems to work, and thats ok by me :)
thanks again
| Top |
|
Posted by
| Shadowfyr
USA (1,788 posts) Bio
|
Date
| Reply #5 on Mon 04 Nov 2002 05:46 PM (UTC) |
Message
| Of course class like groupings are now available in 3.30, so... lol | Top |
|
Posted by
| Nick Gammon
Australia (23,072 posts) Bio
Forum Administrator |
Date
| Reply #6 on Mon 04 Nov 2002 10:15 PM (UTC) |
Message
|
Quote:
var toggle = wildcards [0]
if ( toggle == on ) {
status = true;
}
else if ( toggle == off ) {
status = false;
}
enableclass ( "battle" , status);
Yes, you can do this more easily now in the latest versions with "world.enablegroup". You can also save a bit of typing by doing a boolean inline, like this:
world.EnableGroup ("battle", wildcards [0] == "on");
wildcards [0] == "on" will evaluate to true or false, which is what is required as an argument to EnableGroup.
|
- 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.
19,118 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top