Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


I need help with toggle loop

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
milosmml7777
Cheater
Reputation: 0

Joined: 31 Dec 2015
Posts: 39
Location: The Abyss

PostPosted: Thu Aug 10, 2017 5:11 am    Post subject: I need help with toggle loop Reply with quote

Code:
function CEButton1Click(sender)
         if a==1 then
         function mytime()
         if (acthp < fullhp) then
         fullhp = 100
         local acthp = readFloat("[[[[[[[[[[hw.dll+00EA0F64]+20]+98]+88]+B8]+88]+98]+90]+4D0]+4E0]+7B4")
  writeFloat("[[[[[[[[[[hw.dll+00EA0F64]+20]+98]+88]+B8]+88]+98]+90]+4D0]+4E0]+7B4", readFloat("[[[[[[[[[[hw.dll+00EA0F64]+20]+98]+88]+B8]+88]+98]+90]+4D0]+4E0]+7B4")+1)
  end
  end
  if (a==b) then
  a=0
  else
  a=a+1
  end
  end
  end
  a=0
  b=2
  timer.Interval = 1000
 timer.Enabled = true
  timer = createTimer(nil)
  timer.OnTimer = function(mytime)
  end

and all i get is this:
Error:[string "timer = createTimer(nil)
..."]:10: attempt to index a nil value (global 'sender')
Error:[string "timer = createTimer(nil)
..."]:8: attempt to index a nil value (global 'sender')

I swear if i see those errors again im going to flip, i saw them about 1000 times trying to fix this and i was all out of luck, the intention of this code is to regen hp and that is what it does but it just ignores the toggle and gives me errors.

_________________
D'S Nuts
Back to top
View user's profile Send private message
Corroder
Master Cheater
Reputation: 8

Joined: 10 Apr 2015
Posts: 425

PostPosted: Thu Aug 10, 2017 4:49 pm    Post subject: Reply with quote

maybe something like this (not tested)

Code:
local function mytime(Sender)
 if a==1 then
  if (acthp < fullhp) then
    fullhp = 100
    local acthp = readFloat("[[[[[[[[[[hw.dll+00EA0F64]+20]+98]+88]+B8]+88]+98]+90]+4D0]+4E0]+7B4")
    writeFloat("[[[[[[[[[[hw.dll+00EA0F64]+20]+98]+88]+B8]+88]+98]+90]+4D0]+4E0]+7B4", readFloat("[[[[[[[[[[hw.dll+00EA0F64]+20]+98]+88]+B8]+88]+98]+90]+4D0]+4E0]+7B4")+1)
  end
 end

 if (a==b) then
  a=0
  else
  a=a+1
 end

  a=0
  b=2
end

t=createTimer(Sender) --create timer 't',owner
timer_setInterval(t, 1000) --timer,milliseconds
timer_onTimer(t,mytime) --timer,function
timer_setEnabled(t,true) --timer,boolean


function CEButton1Click(sender)
 if a==1 then mytime() end
end

_________________
I can't do it now because I don't know yet and because You knew it before me. There is heaven above the sky.
Back to top
View user's profile Send private message
milosmml7777
Cheater
Reputation: 0

Joined: 31 Dec 2015
Posts: 39
Location: The Abyss

PostPosted: Thu Aug 10, 2017 7:11 pm    Post subject: Reply with quote

Using this code does remove the error but does not regen the hp.
Code:

local function mytime(Sender)
 if a==1 then
  if (acthp < fullhp) then
    fullhp = 100
    local acthp = readFloat("[[[[[[[[[[hw.dll+00EA0F64]+20]+98]+88]+B8]+88]+98]+90]+4D0]+4E0]+7B4")
    writeFloat("[[[[[[[[[[hw.dll+00EA0F64]+20]+98]+88]+B8]+88]+98]+90]+4D0]+4E0]+7B4", readFloat("[[[[[[[[[[hw.dll+00EA0F64]+20]+98]+88]+B8]+88]+98]+90]+4D0]+4E0]+7B4")+1)
  end
 end

 if (a==b) then
  a=0
  else
  a=a+1
 end

  a=0
  b=2
end

t=createTimer(Sender) --create timer 't',owner
timer_setInterval(t, 1000) --timer,milliseconds
timer_onTimer(t,mytime) --timer,function
timer_setEnabled(t,true) --timer,boolean


function CEButton1Click(sender)
 if a==1 then mytime() end
end


Edit:

Nevermind, it gives me the error:

Error:attempt to call a nil value

_________________
D'S Nuts
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites