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 


[Easy question]Changing an address with Lua

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

Joined: 15 Jul 2014
Posts: 6

PostPosted: Tue Jul 15, 2014 7:12 pm    Post subject: [Easy question]Changing an address with Lua Reply with quote

Hello,

I've been pulling my hair out for over 4 hours now on one of the simplest things you can do with Lua, tried so many different ways, looked up tutorials and other threads both on CEF and google, but no luck. So I gave up and made an account, I hope my dumb question won't bother anyone.


Could someone tell me how to change an address' value with an Lua script? I'm pretty sure it's as simple as "writeBytes(address,byte) but I just couldn't get it to work. I think the problem here comes from the address: I literally could not figure out what to put there, it would always return me an error or do nothing at all.

The goal I'm trying to achieve here is to make it so a certain value changes when I open a CE table, so I would put it in the table Lua script of course.

Thank you!
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Jul 16, 2014 6:53 am    Post subject: Reply with quote

Went to cheat engine search page.
Wrote 3 words (Lua change value)
In first page found the solution.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
mw3137
How do I cheat?
Reputation: 0

Joined: 15 Jul 2014
Posts: 6

PostPosted: Wed Jul 16, 2014 10:28 am    Post subject: Reply with quote

DaSpamer wrote:
Went to cheat engine search page.
Wrote 3 words (Lua change value)
In first page found the solution.


These are the exact keywords I used, and while I did find results that seemed to fit what I want I'm too dumb to get them to work somehow on my table, even though they're basically pre-made.

As I've said, the part that doesn't seem to work whatever I do is the address, and unsurprisingly it seems I'm the only one silly enough to not figure it out on my own, which is why I was looking for more of a personal aid there.

Sorry for being kind of thick.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Wed Jul 16, 2014 11:33 am    Post subject: Reply with quote

are you changing code or data ?
If it's code you may have to make it writable fist

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Jul 16, 2014 12:16 pm    Post subject: Reply with quote

Code:
writeInteger("Address or 48F129",1)

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
mw3137
How do I cheat?
Reputation: 0

Joined: 15 Jul 2014
Posts: 6

PostPosted: Wed Jul 16, 2014 9:26 pm    Post subject: Reply with quote

Dark Byte wrote:
are you changing code or data ?
If it's code you may have to make it writable fist


I think it's just data. I'm trying to change the code for equipped weapons in the game, to get one that is locked, but that means it'll reset every time I boot the game, which is why I'm trying to make the script run when starting up the table.

Which brings me to DaSpamer's code which seems to work fine when I execute it manually as a Lua script but can't find a way to make it autorun as the table opens. I had taken the wild guess that putting it in the table Lua script would make that happen somehow but I believe I'm mistaken on that.

Thank you again for your help!
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Jul 17, 2014 5:09 am    Post subject: Reply with quote

save your script as .lua and place it in the auto run dir.
_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Thu Jul 17, 2014 7:02 am    Post subject: Reply with quote

make your lua script target the process.
If you have no process open, you can't write to it

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
mw3137
How do I cheat?
Reputation: 0

Joined: 15 Jul 2014
Posts: 6

PostPosted: Thu Jul 17, 2014 10:55 pm    Post subject: Reply with quote

DaSpamer wrote:
save your script as .lua and place it in the auto run dir.


That wouldn't stick to the table though, which is what I'm trying to do.

Dark Byte wrote:
make your lua script target the process.
If you have no process open, you can't write to it


On a standalone script or the table lua script?

If table, I already have an autoattach to the process of the game, is that not enough?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Fri Jul 18, 2014 2:32 am    Post subject: Reply with quote

Autoattach just registers the processname to be opened when CE feels like it.
It doesn't mean the process will be open right after that line
Use the onOpenProcess callack function, or use a timer that checks if the process is open,or call openProcess yourself

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
mw3137
How do I cheat?
Reputation: 0

Joined: 15 Jul 2014
Posts: 6

PostPosted: Sat Jul 19, 2014 6:39 am    Post subject: Reply with quote

Dark Byte wrote:
Autoattach just registers the processname to be opened when CE feels like it.
It doesn't mean the process will be open right after that line
Use the onOpenProcess callack function, or use a timer that checks if the process is open,or call openProcess yourself


Thank you so much, it finally worked!
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