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 


Need help with Lua script in AA and timers

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
DiegoPKV
How do I cheat?
Reputation: 0

Joined: 11 Oct 2016
Posts: 1

PostPosted: Tue Oct 11, 2016 7:10 am    Post subject: Need help with Lua script in AA and timers Reply with quote

I've been a week trying to do a script that regenerates fusion metter to learn Lua and improve my coding skills.
This cheat worked before with sleep() but it did CE or trainers irresponsive, then I started trying to make it work with a derivated code and the use of timers.

This is the new code:
Code:

[ENABLE]
{$lua}

Fusion_form = readBytes("21C6C901")
Max_fusion = readBytes("21C6C902")
Act_fusion = readBytes("21C6C900")


function regen()

if (Act_fusion < 100) then
Act_fusion = Act_fusion + 1
writeBytes("21C6C900",Act_fusion)
end

if (Act_fusion >= 100) then

if (Act_fusion >= 100 and Fusion_form < Max_fusion) then
inc = Fusion_form + 1
writeBytes("21C6C901",inc)
Act_fusion=0
writeBytes("21C6C900",Act_fusion)
end

if (Act_fusion >= 100 and Fusion_form == Max_fusion) then
Act_fusion=100
writeBytes("21C6C900",Act_fusion)
end
end

if (Act_fusion == 0 and Fusion_form <= Max_fusion) then
end
end

t = createTimer(nil)
timer_onTimer(t,regen)
timer_setInterval(t,100)
timer_setEnabled(t,true)

{$asm}
[DISABLE]
{$lua}
t.destroy()


It runs ok until Fusion_form stops the increment and Act_fusion continues endlessly



picasion.com_04cad274b88a5c677ec23d9ca438717c.gif
 Description:
Script running ingame
 Filesize:  237.24 KB
 Viewed:  2639 Time(s)

picasion.com_04cad274b88a5c677ec23d9ca438717c.gif


Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Tue Oct 11, 2016 11:25 am    Post subject: Reply with quote

Code:
[ENABLE]
{$lua}
function regen()
  local Fusion_form = readBytes("21C6C901")
  local Max_fusion = readBytes("21C6C902")
  local Act_fusion = readBytes("21C6C900")
  if (Act_fusion < 100) then
    Act_fusion = Act_fusion + 1
    writeBytes("21C6C900",Act_fusion)
  end
  if (Act_fusion >= 100) then
    if (Fusion_form < Max_fusion) then
      Fusion_form = Fusion_form + 1
      writeBytes("21C6C901",Fusion_form)
      Act_fusion=0
      writeBytes("21C6C900",Act_fusion)
    elseif (Fusion_form == Max_fusion) then
      Act_fusion=100
      writeBytes("21C6C900",Act_fusion)
    end
  end
end

t = createTimer(nil)
timer_onTimer(t,regen)
timer_setInterval(t,100)
timer_setEnabled(t,true)
{$asm}
[DISABLE]
{$lua}
t.destroy()
{$asm}


try this?
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 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