Ok, so I made some modifications to my smokecure alias. It compiles fine. The problem I am having is that it is not matching like it should.
As a test I set the Disfigurement variable to 1 and I did not light the pipe before hand.
In theory it should attempt to smoke the pipe. Pick up that it is not lit. Light the pipe. Smoke the pipe.
It attempted to smoke the pipe (like it should) returned
That pipe isn't lit.
Which should have been caught by the "local z" in the "SmokeCure ()" and sent to the "LightPipe ()". It wasn't.
Here is the revised alias.
<aliases>
<alias
match="smokecure"
enabled="y"
group="Smoke"
send_to="12"
sequence="100"
>
<send>require "wait"
wait.make (function () -- coroutine starts here
Balance = tonumber (GetVariable ("Balance"))
PipeSelect = GetVariable ("PipeSelect")
Pipe1 = GetVariable ("PipeValerian")
Pipe2 = GetVariable ("PipeElm")
-- Affliction Variables
-- Smoke Elm Cures
Aeon = tonumber (GetVariable ("Aeon")) -- Elm
Deadening = tonumber (GetVariable ("Deadening")) -- Elm
Hellsight = tonumber (GetVariable ("Hellsight")) -- Elm
-- Smoke Valerian Cures
Disfigurement = tonumber (GetVariable ("Disfigurement")) -- Valerian
ManaLeech = tonumber (GetVariable ("ManaLeech")) -- Valerian
Slickness = tonumber (GetVariable ("Slickness")) -- Valerian
-- Pick Correct Pipe
if Disfigurement == 1 then
Pipe = Pipe1
SetVariable("PipeSelect", GetVariable ("PipeValerian"))
elseif ManaLeech == 1 then
Pipe = Pipe1
SetVariable("PipeSelect", GetVariable ("PipeValerian"))
elseif Slickness == 1 then
Pipe = Pipe1
SetVariable("PipeSelect", GetVariable ("PipeValerian"))
elseif Aeon == 1 then
Pipe = Pipe2
SetVariable("PipeSelect", GetVariable ("PipeElm"))
elseif Deadening == 1 then
Pipe = Pipe2
SetVariable("PipeSelect", GetVariable ("PipeElm"))
elseif Hellsight == 1 then
Pipe = Pipe2
SetVariable("PipeSelect", GetVariable ("PipeElm"))
else ColourNote ("white", "red", "No Smoke Cures Needed!!!")
SetVariable("PipeSelect", "")
Pipe = nil
end
-- Try Smoke Pipe
if Balance == 1 then
if Pipe then
SmokePipe ()
else ColourNote ("white", "red", "Pipe Not Picked!!!")
end
end
-- Smoke Pipe Function
function SmokePipe ()
local Pipe = GetVariable ("PipeSelect")
if Pipe then -- What did I do with that thing?
Send ("Smoke " .. Pipe)
local x = wait.match ("^(.*?) a long drag off your pipe\.$", 1)
local y = wait.match ("^(.*?) pipe has nothing smokeable in it\.$", 1)
local z = wait.match ("^(.*?) pipe isn\'t lit\.$", 1)
if x then -- Smooth? Isn't it?
if Pipe == GetVariable ("PipeValerian") then -- Is it Valerian I taste?
SetVariable("FullPipeValerian", GetVariable ("FullPipeValerian") - 1)
elseif Pipe == GetVariable ("PipeElm") then -- Nah, this is Elm!
SetVariable("FullPipeElm", GetVariable ("FullPipeElm") - 1)
end -- Better then turkish blend?
elseif y then -- Hey! I thought I packed this already!
EmptyPipe ()
elseif z then -- Where is my lighter?
LightPipe ()
end -- Are you (not) satisfied?
end -- Always around when I need it!
end -- Smoke Pipe Function
-- Empty Pipe Function
function EmptyPipe ()
local Pipe = GetVariable ("PipeSelect")
if Pipe == GetVariable ("PipeValerian") then
Send ("outr valerian") -- Get Valerian from Rift
local w = wait.match ("^(.*?) remove 1 valerian\, bringing the total in the Rift (.*?)$", 1)
local x = wait.match ("^(.*?) have no valerian stored in the Rift\.$", 1)
if w then -- Got Valerian from Rift
Send ("put valerian in " .. Pipe)
SetVariable ("FullPipeValerian", 10)
LightPipe ()
elseif x then -- No Valerian in Rift
ColourNote ("white", "red", "You are out of Valerian!!!")
end -- Have Valerian?
elseif Pipe == GetVariable ("PipeElm") then
Send ("outr elm") -- Get Elm from Rift
local y = wait.match ("^(.*?) remove 1 slippery elm\, bringing the total in the Rift (.*?)$", 1)
local z = wait.match ("^(.*?) have no elm stored in the Rift\.$", 1)
if y then -- Got Elm from Rift
Send ("put elm in " .. Pipe)
SetVariable ("FullPipeElm", 10)
LightPipe ()
elseif z then -- No Elm in Rift
ColourNote ("white", "red", "You are out of elm!!!")
end -- Have Elm?
end -- Is it the Valerian or Elm Pipe?
end -- Empty Pipe Function
-- Light Pipe Function
function LightPipe ()
local Pipe = GetVariable ("PipeSelect")
if Pipe then -- Have Pipe
Send ("light " .. Pipe) -- Click, click, click, Pshh!
local x = wait.match ("^(.*?) light your treasured pipe until it is smoking nicely\.$", 1)
local y = wait.match ("^(.*?) pipe is already lit and burning nicely\.$", 1)
local z = wait.match ("^(.*?) is nothing in the pipe to light\.$", 1)
if x then -- Don't let it go out man!
SmokePipe ()
elseif y then -- I must be stupid!
SmokePipe ()
elseif z then -- Wasn't this packed yesterday!
EmptyPipe ()
end -- Whats the verdict?
end -- Always around when I need it!
end -- light Pipe Function
end) -- Coroutine</send>
</alias>
</aliases>
As usual, any feedback is appreciated. |