OK. I just upgraded to WinXp and I can't seem to use my Zmud anymore so I downloaded MUSHclient based on some advised from some mudders.
I am really having problem with MUSHclient since I don't know that much programming.
RIght now, I just want to test Triggers, Variables and few other easy things.
I am trying to create a trigger that can cast a spell on me when it matches some texts from the mud.
from the mud, I am trying to match these;
"Spell Up"
Once it is matched, it should check a variable ( "spell2" in this case) to see if the spell needed to cast itself or not. If spell2 == 0 then cast it, if spell2==1 then no.
So, what I did first was to create a spell2 variable in the Variables page and gave it a value of 0.
Then in the trigger,
-------------------------
Trigger: Spell Up *
Send:
if(@spell2==0)
{
cast "Magic Armor" Ordan ;cast the spell on me
@spell2=1 ;set variable to casted status
}
--------------------
then above trigger didn't work..and I wasn't suprised. :)
ANyone, can someone help me set this trigger up?
give me as much detail/explination as possible; as I am still a newbie on this.100000
addon: basically what I wanted to know is how to do IF/ELSE IF statements and changing variable values in the Send: Box in a trigger.
Of course the way you have it would work in ZMud, however MushClient takes a different approach on such things.
Trigger: Spell Up *
Send:
Leave this area blank
Name:cast
Label:cast
I assume that the * is the spell number needed.
Now open notepad. save the file as: whatevername.vbs
In the new VBScripting file put the following stuff
Sub cast(a,b,c)
spell = c(1)
if world.getvariable(spell) = 0 then
world.send "cast " & chr(34) & "Magic Armor" & chr(34) & Ordan 'cast the spell on me
world.setvariable spell,1 'set variable to casted status
end if
end sub
You can also put that script into the send box of the trigger itself, remove the "script" box entry, and then change "send to" to script.
And for future reference, just copy the trigger and paste it into the forums (trigger menu, click copy, then paste it here). For something like this it doesnt really matter, but for the future when you have syntax problems or whatnot, it becomes a huge help when we try to figure out which character you missed where.
The Trigger
------------
Trigger: test1
Send:
Send To: Script
Label: test
Script: test
The Script
----------
Sub test(a,b,c)
world.send "The value of MagicArmor is " & " " & world.GetVariable(MagicArmor)
if world.getvariable(MagicArmor) = 0 then
world.send "cast " & chr(34) & "Magic Armor" & chr(34) & Ordan
world.setvariable "MagicArmor",1
end if
world.send "Hello All"
end sub
[Note: MagicArmor is suppose to be my global variable. If it is 0 then the spell is not on me, if it is 1 then it is on. I "Add"ed MagicArmor in the Scripting->Variables section and gave it a value of 0. However, the spell is not casting. :( ]
[Problem, I also get "THere are no value within" from outputing wolrd.GetVariable(MagicArmor). If I comment out If/end if, then world.setvariable "MagicArmor",1 actually set MagicArmor to 1.]
world.send "The value of MagicArmor is " & " " & world.GetVariable(MagicArmor)
if world.getvariable(MagicArmor) = 0 then
You must place "MagicArmor" in quotes. What Mushclient thinks you are doing above is telling it, "Take the value in the 'VBScript' variable MagicArmor and use that to find a Mushclient variable and return its value."
This lets you do things like:
sub setstatus(a, b, c)
Playername = c(1)
setvariable "PS_" & Playername, 1
end sub
In other words, you might match on "Fred joins your party." and the script would set a variable called 'PS_Fred' to 1, to show he is in the party. You could then later run a search on all variables that contain 'PS_' to find a list of player names and which ones are in a party. Basically, you have to remember that getvariable and setvariable have to be given a name in "". If you leave that off, then the script automatically assumes you are now talking about the contents of a script variable, not the name of a Mushclient variable.
I think Nick should just include 2-3 aliases that make triggers/aliases from the command line, so we can tell newbies "Type #trigger {match on;send}" or whatever. Most people find MUSHclient more difficult because they have to go into a dialog box to add triggers, I think.
I seriously considered a plugin that would take anything starting with # and parse it into mushclient functions as though it was zmud. Until the addition of 'send to script' though some things where not terribly practical and a few would still be problematic. Since then I came to my senses. ;) lol
Took me about half an hour to explain to someone that we could indeed write an alias to add an alias/trigger, since he wanted to edit on the fly.
It might be a good plugin to make, a whole plugin for ZMud users to feel more like Zmud. Well, without the bloat, and faster. Or at least some well-used features.
Turns out that the triggers are added to the plugin space, which makes them pretty much temporary... Why not just include 3 triggers in the default world configuration?
Cant you use world.execture to throw the addaliases into the world script space? (Youd have to have them enable scripting, and select a script engine, but still).
I really am not quite sure why youd add things from the command line that werent temporary. Or at least not on the fly. Just have the plugin note stuff (like the enabling scripting et al) and have a third alias which outputs the stuff they can copy/paste into their main world file to enable permanant addition of things.
Flannel said:
I really am not quite sure why youd add things from the command line that werent temporary.
This is why:
Quote:
Flannel said:
It might be a good plugin to make, a whole plugin for ZMud users to feel more like Zmud. Well, without the bloat, and faster. Or at least some well-used features.
Quote:
Flannel said:
Just have the plugin note stuff (like the enabling scripting et al) and have a third alias which outputs the stuff they can copy/paste into their main world file to enable permanant addition of things.
That defeats the purpose of not having to go in the triggers dialog. Anyway, I just included this for all the people that told me "You can't add stuff from the command line? This sucks."