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 


How can I do this using one edit instead of two?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Autem
Expert Cheater
Reputation: 1

Joined: 30 Jan 2023
Posts: 156

PostPosted: Mon Feb 20, 2023 3:56 pm    Post subject: How can I do this using one edit instead of two? Reply with quote

I guess maybe the right way to ask this if I have the terminology right for CE lua/aa, is to ask how can I make ChangeValues(10045439899972134, 99999999999999999) and the commented-out lines just above/below it be globally accessible by multiple scripts?

I have two different AA scripts that are nearly identical and look like the example at the bottom of this post. Typically what I do is I open them both, and I manually change the "ChangeValues" at the bottom of the script on both (or sometimes will comment out a line and uncomment out a different, etc). Is there a way to have there be a "ChangeValues" source that I only edit once and both scripts can read from? (But have it still be within the addresslist, and not in the "Table>ShowCheatTableLuaScript")

For example if I need to change
Code:
--ChangeValues(10045439899972166, 77777777777777777)
--ChangeValues(10045439899979999, 99999999999988889)
ChangeValues(100454398999721344 99999999999999999)
--ChangeValues(10045439899972134, 99999999999999000)

into
Code:
ChangeValues(10045439899972166, 55555555555555555)
--ChangeValues(10045439899979999, 99999999999988889)
--ChangeValues(100454398999721344 99999999999999999)
--ChangeValues(10045439899972134, 99999999999999000)

...so ideally the place I make the edits would be a form/script and not just a singular allocated entry in the addresslist. Because I often go back and uncomment/comment out previous entries on the fly.
I always open both scripts and change the line in both. Is there a way to pull the "ChangeValues" info from just one instance for both scripts?

The reason I have two very similar scripts reading/changing the same values is because one of them spends extra time doing additional steps (such as also pausing the exe, changing utf-8 and utf-16 strings, and printing extra info), while the first script (shown below) is very fast and has no pausing or printing. But, both of them will always need to be reading/changing the same value at any given time.

Since I find myself needing to edit the values dozens of times a day, it would be a huge time saver if I only need to edit one instead of two each time.

Code:
[ENABLE]
{$lua}

function ChangeValues(v, v2)
local MemScan = createMemScan()
MemScan.firstScan(soExactValue, vtDword, nil, v, nil, '0', '7fffffffffff', '+W-C-X', nil, '0', false, true, false, false)
MemScan.waitTillDone()
local Results = createFoundList(MemScan)
Results.initialize()
for i=0,Results.Count-1 do
   print('replacing', Results[i], v)
   writeInteger(Results[i],v2)
end
MemScan.destroy()
Results.destroy()
end

--ChangeValues(10045439899972166, 77777777777777777)
--ChangeValues(10045439899979999, 99999999999988889)
ChangeValues(100454398999721344 99999999999999999)
--ChangeValues(10045439899972134, 99999999999999000)

[DISABLE]
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