Hi, I'm trying to make a simple script on my keypad 0 to draw/sheathe my weapons.
I have the following:
sheathed = getVariable("WeaponSheathed")
echo("sheathed")
if sheathed == "yes" then
send("draw weapons from scabbard belt")
setVariable("WeaponSheathed", "no")
elseif sheathed == "no" then
send("sheathe sword")
send("sheathe knife")
setVariable("WeaponSheathed", "yes")
end
I put the echo in to see if it is getting the variable.
I have the variable WeaponSheathed set up, and set it to string type, and set it to yes
I was going to just use boolean, but couldn't work out how to use that. Haven't done mudlet scripting in a while.
Any help would be appreciated.
draw/sheathe weapon key
Re: draw/sheathe weapon key
Hi!
You don't need to setup variables in advance, or use get/setVariable like in MUSHclient. So you can set the variable in a trigger, without ever touching the Variables view in the script editor. And you can write the above like so:
You don't need to setup variables in advance, or use get/setVariable like in MUSHclient. So you can set the variable in a trigger, without ever touching the Variables view in the script editor. And you can write the above like so:
I use else because the variable only has the two states. And sendAll is the preferred way to send multiple things in a row like that =)
Re: draw/sheathe weapon key
Since you mentioned using booleans for the variables, I figured I'd drop in and show how to change demonnic's code to use them.
Re: draw/sheathe weapon key
Oh... yeah, somehow I managed to gloss over that part of the original post. Thanks!