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.
enable/disable a bunch of triggers
Posted by Mirth on Sat 14 Jul 2001 01:12 PM — 7 posts, 27,002 views.
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:
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:
Here is the script:
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
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
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
you can do it with an alias and a small script..
ill try to make an example using JScript ( dont know VBscript sintax )
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..
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..
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
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
Of course class like groupings are now available in 3.30, so... lol
Quote:
var toggle = wildcards [0]
if ( toggle == on ) {
status = true;
}
else if ( toggle == off ) {
status = false;
}
enableclass ( "battle" , status);
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.