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 


[HELP] I need help to write a LUA Script

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

Joined: 13 Jul 2017
Posts: 8

PostPosted: Thu Jul 13, 2017 6:58 am    Post subject: [HELP] I need help to write a LUA Script Reply with quote

Hello iam new in LUA Scripting, i finished alot things self and via help these AMAZING forums, where a found in some threads the answer (mostly Darkbytes answers ve help me^^) But now i must ask self to get some help, because idont find anything about this Sad


I need help to write a script that can:
1. Put a value in Editbox->
2. Scan Address->
3. (maybe)Create a foundlist->
4. Put a new value in Editbox(2)->
5. Change all Address that i found with the new value->
6. Change ALL address back manually via Button (or via timer)->


((Sorry for my bad english))
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 Jul 13, 2017 5:13 pm    Post subject: Reply with quote

Retrieve all addresses with a specific value
Code:
local find_this = "19791800" -- whatever
local memscan = createMemScan()
local foundlist = createFoundList(memscan)
memscan.firstScan(
  soExactValue, vtDword, rtRounded,
  find_this, nil, 0, 0xffffffffffffffff, "+W-C",
  fsmAligned, "4", false, false, false, false)
memscan.waitTillDone()
foundlist.initialize()
saved_values = {}
local value = foundlist.Value
local address = foundlist.Address
for i = 0, foundlist.Count - 1 do
  saved_values[address[i]] = value[i]
end
foundlist.destroy()
memscan.destroy()

Set all found values
Code:
local replace_with = 1000 -- whatever
for i in pairs(saved_values) do
  writeInteger(i, replace_with)
end

Restore all original values
Code:
for i, v in pairs(saved_values) do
  writeInteger(i, v)
end
Back to top
View user's profile Send private message
Shirabrixx
How do I cheat?
Reputation: 0

Joined: 13 Jul 2017
Posts: 8

PostPosted: Fri Jul 14, 2017 1:41 pm    Post subject: Reply with quote

Hello thank you, for your answer!

I saw your name as credit in a trainer by GTA5 Very Happy
I have some questions and I hope so, that you can help me by this. I try so many things out, but nothing will work. I wasted 10h on this.
I try to create a trainer that can change a 4 byte value in a new 4 byte value and that I can restore all via buttonclick back.

1. I have write a script with aobscan, where i get the value what i want to change. //address from my script ("_vhmod+208")
2. This value should send to the scanner, (like in your example "19791800").
3. Create a scan+foundlist and change all values to another value that I can choice via ComboBox.
4. Lastly should it restore the old value back.

[this i ve already]
|--> Activate script
--> Read value from ("_vhmod+208")
--> Found the one value from ("_vhmod+208")

[now the new script from you]
|--> Buttonclick
--> Read value from ("_vhmod+208")
--> Scan value and store it in foundlist

|--> Select a new value from ComboBox
|--> Change the value via Buttonclick
|--> Restore the old value back via Buttonclick


...and I am sorry for my bad english knowledge, I am working on it!

Retrieve all addresses with a specific value
Code:

local find_this = "19791800" -- whatever
local memscan = createMemScan()
local foundlist = createFoundList(memscan)
memscan.firstScan(
  soExactValue, vtDword, rtRounded,
  find_this, nil, 0, 0xffffffffffffffff, "+W-C",
  fsmAligned, "4", false, false, false, false)
memscan.waitTillDone()
foundlist.initialize()
saved_values = {}
local value = foundlist.Value
local address = foundlist.Address
for i = 0, foundlist.Count - 1 do
  saved_values[address[i]] = value[i]
end
foundlist.destroy()
memscan.destroy()

Set all found values
Code:

local replace_with = 1000 -- whatever
for i in pairs(saved_values) do
  writeInteger(i, replace_with)
end   

Restore all original values
Code:

for i, v in pairs(saved_values) do
  writeInteger(i, v)
end
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