mikey1993 Newbie cheater Reputation: 0
Joined: 20 Jul 2017 Posts: 22
|
Posted: Sat Dec 09, 2017 3:17 am Post subject: Need some help with Lua Timer. |
|
|
I am trying to write a script with multiple timers. The 1st timer works perfectly but the 2nd timer isn't operating as I'd like.
timer10 = createTimer(nil, true)
timer_setInterval(timer10, 1)
function Loop()
NoObstaclesValue = 11536506
HighBeesZ1 = 1224.871094
HighBeesX1 = 313.856842
HighBeesZ2 = 1161.190063
HighBeesX2 = 345.2701721
local NoObstacle = readBytes("0x63BE94")
local ZClick = readFloat("[game.exe + 01F5DDA4] + 1FC")
local XClick = readFloat("[game.exe + 01F5DDA4] + 1F4")
local ZTele = readFloat("[game.exe + 01F5DDA4] + 58")
local XTele = readFloat("[game.exe + 01F5DDA4] + 50")
if isKeyPressed(0x4A) then
FarmingStage1 = 1
end
if (FarmingStage1 == 1) then
writeFloat("[game.exe + 01F5DDA4] + 1FC",HighBeesZ1)
writeFloat("[game.exe + 01F5DDA4] + 1F4",HighBeesX1)
writeInteger("0x221CF14",6)
doKeyPress(0x75)
end
if (FarmingStage1 == 1) and (ZTele > 1223) and (ZTele < 1225) and (XTele > 312) and (XTele < 314) then
FarmingStage1 = 2
end
if (FarmingStage1 == 2) then
doKeyPress(0x72)
end
if (FarmingStage1 == 2) then
local timer1 = createTimer(getMainForm())
timer1.Interval = 60000
timer1.OnTimer = function(timer)
FarmingStage1 = 3
FarmingStage2 = 1
DoneState1 = true
if DoneState1 == true then
timer1.destroy()
end
end
end
if (FarmingStage2 == 1) then
writeFloat("[game.exe + 01F5DDA4] + 1FC",HighBeesZ2)
writeFloat("[game.exe + 01F5DDA4] + 1F4",HighBeesX2)
writeInteger("0x221CF14",6)
doKeyPress(0x71)
end
if (FarmingStage2 == 1) and (ZTele > 1159) and (ZTele < 1162) and (XTele > 343) and (XTele < 346) then
FarmingStage2 = 2
end
if (FarmingStage2 == 2) and (FarmingStage1 == 3) then
doKeyPress(0x72)
end
if (FarmingStage2 == 1) then
local timer2 = createTimer(getMainForm())
timer2.Interval = 60000
timer2.OnTimer = function(timer)
FarmingStage2 = 3
FarmingStage1 = 1
DoneState2 = true
if DoneState2 == true then
timer2.destroy()
end
end
end
end
timer_onTimer(timer10, Loop)
(0x71) is supposed to spam while FarmingStage2 == 1 but it continues to spam even after FarmingStage2 changes to 2. If anyone can tell me what I'm doing wrong I'd very much appreciate it. Thank you so much in advance.
|
|