I wrote an alias to detect, view, and set fighting styles on a MUD. Everything works as expected, except for actually setting the style. When I try to set a style, it accepts something like
ast kick 80 130, but doesn't send astyle kick 80 130, and also doesn't set the strength and speed variables. I tried setting them manually, and the script worked with viewing the current style, and would send it if I did ast <style>, but wouldn't do anything if I tried to change the str/spd.<aliases>
<alias
name="astyle"
match="^(c|r)?as(?:t|tyle)?(d| )?(kung|kick|kar|aik)?(?: )?([0-300])?(?: )?([0-300])?$"
enabled="y"
group="combat"
regexp="y"
send_to="12"
sequence="100"
>
<send>--[[ See current style ]]
if "%1" == "c" and "%3%4%4" == "" then
if GetVariable("style") == nil or GetVariable("strength") == nil
or GetVariable("speed") == nil then
print "No style has been set."
else
print("Your current style: " .. GetVariable("style") .. " " ..
GetVariable("strength") .. "% " .. GetVariable("speed") .. "%")
end -- if
--[[ Reset current style ]]
elseif "%1" == "r" and "%3%4%5" == "" then
DeleteVariable("style")
DeleteVariable("strength")
DeleteVariable("speed")
print "All variables have been reset."
--[[ Detect best style ]]
elseif "%1" == "" and "%2" == "d" and "%3%4%5" == "" then
ColourNote("silver", "", "asd")
SendNoEcho("astyle detect strength")
SendNoEcho("astyle detect speed")
--[[ Set new style ]]
elseif "%1%2" == " " then
if "%3" ~= "" then
SetVariable("style", "%3")
end -- if
local style = GetVariable("style")
if "%4" ~= "" then
SetVariable("strength", "%4")
end -- if
local str = GetVariable("strength")
if "%5" ~= "" then
SetVariable("speed", "%5")
end -- if
local spd = GetVariable("speed")
Send("astyle " .. style .. " " .. str .. " " .. spd)
--[[ Display syntax ]]
else
print "Syntax: cas[tyle][d] -- Display current style"
print " ras[tyle][d] -- Reset style"
print " as[tyle]d -- Detect best style"
print " as[tyle] <style> <strength> <speed> -- Select new style"
end -- if</send>
</alias>
</aliases>