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 


Auto edit Value in lua ? Help Dark Byte
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Fri Dec 30, 2016 7:32 pm    Post subject: Reply with quote

Zanzer sir,

Could we use autoAssemble(script) instead use "Assign to current cheat table" for your script ?.

Maybe like this ?

Code:
script=[[
   ]] if syntaxcheck then return end
local recordId = 0
local elapsed = 20000
local duration = 1000
local original = 5053
local changeTo = 5054
[ENABLE]
myrecord = getAddressList().getMemoryRecordByID(recordId)
if mytimer == nil then
  mytimer = createTimer(nil, false)
end
mytimer.OnTimer = function(timer)
  if mytimer.Interval == elapsed then
    mytimer.Interval = duration
    myrecord.Value = changeTo
  else
    mytimer.Interval = elapsed
    myrecord.Value = original
  end
end
mytimer.Interval = elapsed
mytimer.Enabled = true
[DISABLE]
mytimer.Enabled = false
myrecord.Value = original [[
   ]]

autoAssemble(script)


Thank you
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Dec 30, 2016 8:58 pm    Post subject: Reply with quote

No need for that. Just copy the specific code you need into your script.
Code:
local recordId = 0
local elapsed = 20000
local duration = 1000
local original = 5053
local changeTo = 5054

myrecord = getAddressList().getMemoryRecordByID(recordId)
if mytimer == nil then
  mytimer = createTimer(nil, false)
end
mytimer.OnTimer = function(timer)
  if mytimer.Interval == elapsed then
    mytimer.Interval = duration
    myrecord.Value = changeTo
  else
    mytimer.Interval = elapsed
    myrecord.Value = original
  end
end
mytimer.Interval = elapsed

function CECheckbox1Change(sender)
  mytimer.Enabled = sender.Checked
end
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Fri Dec 30, 2016 9:19 pm    Post subject: Reply with quote

Great Zanzer sir,
That is all lua script without AA script on it.
Done and thank you
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Sun Jan 01, 2017 8:41 am    Post subject: Reply with quote

Zanzer wrote:
No need for that. Just copy the specific code you need into your script.
Code:
local recordId = 0
local elapsed = 20000
local duration = 1000
local original = 5053
local changeTo = 5054

myrecord = getAddressList().getMemoryRecordByID(recordId)
if mytimer == nil then
  mytimer = createTimer(nil, false)
end
mytimer.OnTimer = function(timer)
  if mytimer.Interval == elapsed then
    mytimer.Interval = duration
    myrecord.Value = changeTo
  else
    mytimer.Interval = elapsed
    myrecord.Value = original
  end
end
mytimer.Interval = elapsed

function CECheckbox1Change(sender)
  mytimer.Enabled = sender.Checked
end

Hello Zanzer sir . when I run this code, then my code auto click below will not work. Do you have any way to fix it?
Code:

if mytimer == nil then
  mytimer = createTimer(nil, false)
end
mytimer.OnTimer = function(timer)
  mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP)
end
mytimer.Interval = 500

if myhotkey then
  myhotkey.Destroy()
end
myhotkey = createHotkey(function()
  mytimer.Enabled = not mytimer.Enabled
end, VK_F5)
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sun Jan 01, 2017 9:46 am    Post subject: Reply with quote

Don't name all of your timers the same thing (mytimer).
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Mon Jan 02, 2017 6:51 am    Post subject: Reply with quote

Zanzer wrote:
Don't name all of your timers the same thing (mytimer).

Tks Zanzer Very Happy
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
Goto page Previous  1, 2
Page 2 of 2

 
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