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 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Mon Dec 26, 2016 5:52 am    Post subject: Auto edit Value in lua ? Help Dark Byte Reply with quote

I like this idea. Paragraph my value 5053 then I hack into 5054. There is no set time code every 20 seconds it will change to 5053, within 1 second into 5054 to change it?
I want to put it in the CheckBox. Please use code that guides the CheckBox
Thank Admin and all member Razz
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Dec 26, 2016 7:28 am    Post subject: Reply with quote

Maybe like this

Code:


MyValue = 5053

function chgValue()
t=createTimer(nil)
t.Interval=1000
t.OnTimer=function(t)
  MyValue = 5054
end
t.Enabled=true

b=createTimer(nil)
b.Interval= 20000
b.OnTimer=function(b)
  MyValue = 5053
end
b.Enabled=true
end

function CECheckbox1Change(sender)
chgValue()
end
Back to top
View user's profile Send private message
akumakuja28
Master Cheater
Reputation: 16

Joined: 28 Jun 2015
Posts: 432

PostPosted: Mon Dec 26, 2016 2:04 pm    Post subject: Reply with quote

I am so confused. Please explain what you want the script to do.
_________________
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Tue Dec 27, 2016 7:32 am    Post subject: Reply with quote

Corroder wrote:
Maybe like this

Code:


MyValue = 5053

function chgValue()
t=createTimer(nil)
t.Interval=1000
t.OnTimer=function(t)
  MyValue = 5054
end
t.Enabled=true

b=createTimer(nil)

b.Interval= 20000
b.OnTimer=function(b)
  MyValue = 5053
end
b.Enabled=true
end

function CECheckbox1Change(sender)
chgValue()
end


As shown in the photo. My Value pointer . lime want to get value for the code above to work like I do?
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Dec 27, 2016 8:00 am    Post subject: Reply with quote

Code:
MyValue = 5053

function chgValue()
t=createTimer(nil)
t.Interval=1000
t.OnTimer=function(t)
  MyValue = 5054  // put some AA scipt here to handle your pointer scan
end
t.Enabled=true

b=createTimer(nil)

b.Interval= 20000
b.OnTimer=function(b)
  MyValue = 5053  // put some AA scipt here to handle your pointer scan
end
b.Enabled=true
end

function CECheckbox1Change(sender)
chgValue()
end


This just an example as you explained at your first post.
I did not get what you want the script to do, but maybe see Step 8 Cheat Engine Tutorial will help you.
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Thu Dec 29, 2016 5:13 am    Post subject: Reply with quote

Corroder wrote:
Code:
MyValue = 5053

function chgValue()
t=createTimer(nil)
t.Interval=1000
t.OnTimer=function(t)
  MyValue = 5054  // put some AA scipt here to handle your pointer scan
end
t.Enabled=true

b=createTimer(nil)

b.Interval= 20000
b.OnTimer=function(b)
  MyValue = 5053  // put some AA scipt here to handle your pointer scan
end
b.Enabled=true
end

function CECheckbox1Change(sender)
chgValue()
end


This just an example as you explained at your first post.
I did not get what you want the script to do, but maybe see Step 8 Cheat Engine Tutorial will help you.

According to your code. My value pointer available. now I want to transplant into your code so that it works in my opinion. What can I do with the value shown in photos? Sad
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Dec 29, 2016 8:30 am    Post subject: Reply with quote

Code:
t.OnTimer=function(t)
  MyValue = 5054  // put some AA scipt here to handle your pointer scan
end

b.OnTimer=function(b)
  MyValue = 5053  // put some AA scipt here to handle your pointer scan
end


I am not familiar with AA script, hope some one will help 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: Thu Dec 29, 2016 10:05 am    Post subject: Reply with quote

If someone would like to translate his question, I'd gladly help.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Dec 29, 2016 7:40 pm    Post subject: Reply with quote

Zanzer sir,

If i am not misunderstood,

From his first post, it said :

He want to change original value 5053 to 5054 every 20 seconds and back again to 5053 after 1 second. He want executing it via a checkbox change.

Maybe the values 5053 and 5054 just sample value. I don't know what to do or what he want from his snapshot picture. Maybe something like this :

Code:
function chgValue()
t=createTimer(nil)
t.Interval=1000
t.OnTimer=function(t)
  [ENABLE]
   push eax
  mov eax, 01288E80
  lea eax, [eax+1]
   mov eax, [01288E80]
 [DISABLE]
end
t.Enabled=true

b=createTimer(nil)

b.Interval= 20000
b.OnTimer=function(b)
[ENABLE]
  pop eax 
[DISABLE]
end
b.Enabled=true
end

function CECheckbox1Change(sender)
chgValue()
end


Then, maybe the right question is "How I change pointerscan value per 20 seconds and change it back to original value after 1 second using checkbox change".

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

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Dec 29, 2016 7:59 pm    Post subject: Reply with quote

Find the ID of the record containing the pointer you want to change.
Select the record and press Ctrl+C to copy it. Open NotePad and paste.
You can see the ID inside the XML: <ID>0</ID>
Change the "recordId" variable below to match that ID.
Code:
{$lua}
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
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Dec 29, 2016 8:50 pm    Post subject: Reply with quote

Aha, thanks Zanzer sir,

I am also need to learn about this for another case.

So, put your script through AA script or into a function and call it for checkbox change (sender), am I right ?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Dec 29, 2016 9:04 pm    Post subject: Reply with quote

Oh, if you're trying to hook it to a form's checkbox, you could just do:
Code:
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: Thu Dec 29, 2016 10:04 pm    Post subject: Reply with quote

Work great, thank a lot Zanzer sir.
Back to top
View user's profile Send private message
Sting9x
Expert Cheater
Reputation: 0

Joined: 27 Jul 2016
Posts: 124

PostPosted: Fri Dec 30, 2016 7:46 am    Post subject: Reply with quote

Zanzer wrote:
Find the ID of the record containing the pointer you want to change.
Select the record and press Ctrl+C to copy it. Open NotePad and paste.
You can see the ID inside the XML: <ID>0</ID>
Change the "recordId" variable below to match that ID.
Code:
{$lua}
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

Zanzer Hello, thank you for enthusiastic support. I am very grateful for this. But my friend's code unusable. Please help me. Embarassed
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:37 am    Post subject: Reply with quote

Sounds like you have one too many "end" (possibly at line 55)

Also, my code was meant to be entered as an AA script, not in the table Lua section.

If you put it there, you'll need to make adjustments so the timer is only enabled when you want.
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 1, 2  Next
Page 1 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