 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
mordax Expert Cheater
Reputation: 1
Joined: 16 Apr 2010 Posts: 138
|
Posted: Sun Aug 20, 2023 9:39 pm Post subject: why does CE put a NUL at the end? |
|
|
Hiya, i'm trying to do something different with CE. i'm trying to make so called file editor, like a savegame editor for offline files.
so i open file with CE and wrote a piece of simple code to find things in a config file using AoB, such as damage.
i can easily pull the values in the table, but after i edit and save the file, it puts NUL after the edited part, making files useless, why? how do i get rid of that?
here's example:
in config file everything is comma separated, like so:
| Code: | | ,"damage_weapon_01"=1500, |
so i use AoB to find that part and i enter it as string.
so in CE table i see address with value of 1500,"next_thing_here",
i then edit that 1500 to 5000 without touching anything else in CE, i click OK.
then in CE i choose file > save file and overwrite the file i opened
but when i look into the file, i see:
| Code: | | ,"damage_weapon_01"=5000,"next_tNULing_here" |
where is that NUL coming from? i think it puts NUL after how many byte string i have, in my case that's 12.
if i reduce it to 4 byte string, it will put NUL right after 5000.
how can i get rid of that NUL please?
i know there are easier methods of editing a file, but i'm trying to make automated savegame editor using CE, so i can turn it into .exe with dropboxes, where someone can choose like "weapon 01 damage" and then edit the value in the box, then simply click save.
which also brings me to one other question, is there a way to open and save the file by using a button in trainer generator?
thanks in advance.
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4719
|
Posted: Sun Aug 20, 2023 9:51 pm Post subject: |
|
|
null-terminated strings are the default in most languages. Right click the memory record and uncheck "Zero-Terminate string".
You could attach and detach from a file, but it's probably better to use Lua's file API if you're already using Lua to make a trainer.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
mordax Expert Cheater
Reputation: 1
Joined: 16 Apr 2010 Posts: 138
|
Posted: Mon Aug 21, 2023 3:48 am Post subject: |
|
|
| ParkourPenguin wrote: | null-terminated strings are the default in most languages. Right click the memory record and uncheck "Zero-Terminate string".
You could attach and detach from a file, but it's probably better to use Lua's file API if you're already using Lua to make a trainer. |
duh, thanks, dont know how I missed that option. I assume once i uncheck it, then it will also work in trainer? like if i make an editbox and save button, then it would do it without NUL?
no actually i don't think it would work, because i would insert custom buttons in the trainer UI.
what do you mean lua's file API though? i'm not very good with programming and lua.
also how would i got about attaching to a file, wouldn't i have to open the file in text editor for that and then open text editor itself with CE?
CE is probably not best tool for this job, but i know CE best and i really dont want to learn any new tools just for this. I just want to make a quick config file editor and that's it.
thanks again.
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4719
|
Posted: Mon Aug 21, 2023 9:52 am Post subject: |
|
|
I don't know exactly how CE trainers are implemented, but I'm pretty sure they go through the address list. It should work.
If you're not very good with programming and Lua, how do you plan on making a trainer?
| mordax wrote: | | also how would i got about attaching to a file, wouldn't i have to open the file in text editor for that and then open text editor itself with CE? | You're in over your head.
The easiest thing you can do is to not release a trainer. Instead, make a forum post somewhere else that goes over the details of how to edit save game files. Using your example in the first post, say something like "open up game_folder/data/whatever.sav in notepad and change damage_weapon_01 to whatever you want". People will be able to figure it out from that. Literally no one who has the slightest bit of experience with computers would want to download an exe with something like CE packed into it just to make a change to a text file. Most people would think you're trying to give them a virus. "Want to edit this game file? Just download this exe, run it with administrator privileges, and I'll do it for you!" The more I think about this, the more ridiculous it is.
If you also want to include the people too stupid to edit a file with notepad, you could upload the file itself to some site along with instructions for how to install it. I've seen mods on nexusmods do that. People with the ability to use notepad can figure out the rest themselves with just that.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
mordax Expert Cheater
Reputation: 1
Joined: 16 Apr 2010 Posts: 138
|
Posted: Wed Aug 23, 2023 8:15 pm Post subject: |
|
|
| ParkourPenguin wrote: | I don't know exactly how CE trainers are implemented, but I'm pretty sure they go through the address list. It should work.
If you're not very good with programming and Lua, how do you plan on making a trainer?
| mordax wrote: | | also how would i got about attaching to a file, wouldn't i have to open the file in text editor for that and then open text editor itself with CE? | You're in over your head.
The easiest thing you can do is to not release a trainer. Instead, make a forum post somewhere else that goes over the details of how to edit save game files. Using your example in the first post, say something like "open up game_folder/data/whatever.sav in notepad and change damage_weapon_01 to whatever you want". People will be able to figure it out from that. Literally no one who has the slightest bit of experience with computers would want to download an exe with something like CE packed into it just to make a change to a text file. Most people would think you're trying to give them a virus. "Want to edit this game file? Just download this exe, run it with administrator privileges, and I'll do it for you!" The more I think about this, the more ridiculous it is.
If you also want to include the people too stupid to edit a file with notepad, you could upload the file itself to some site along with instructions for how to install it. I've seen mods on nexusmods do that. People with the ability to use notepad can figure out the rest themselves with just that. |
sorry but i dont need your insults, now i think i remember your name, you're known to insult people when they ask help.
i write trainers for many years. i dont need to write lua language to write trainers. who are you to tell me what i should or shouldn't do?
easiest thing for you is to shut up if you got nothing to say about the topic other than insult people.
you dont even know how to attach CE to a file, you just talk nonsense and when someone calls you out on your nonsense then you start insulting and say its easiest not to do it, because you dont actually know and you just said something that doesn't even exist.
why are you replying if you dont like to help people? just be quiet and dont reply if all you do is insult. i will ignore you from now on.
is there anyone who actually knowns what i'm talking about and has a solution? would much appreciate it. thank you.
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1535
|
Posted: Wed Aug 23, 2023 11:14 pm Post subject: |
|
|
Sorry, not "insulting". You are being very touchy.
Even if the reputation of the master you scolded does not take your attitude into consideration, even if he found a solution and helped thousands of people and spoke a little about the truth, it was perceived as "insulting", which seems strange to me.
Of course, there is a code to help you, and I can give you examples as soon as possible.
Because, I ask you to be a little more thoughtful in your ideas and opinions about the masters and not to reach conclusions without understanding what you want to say.
_________________
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4719
|
Posted: Thu Aug 24, 2023 12:05 am Post subject: |
|
|
| mordax wrote: | | sorry but i dont need your insults | If you're referring to my comment about you being "in over your head," that was a roundabout way of saying your previous comment implies you didn't have enough experience in computer science to effectively resolve the problem you faced. In particular, the "solution" you found has flaws associated with it that you didn't acknowledge. You should acknowledge those flaws and reevaluate the problem to find a better solution.
If you're referring to me declaring that it's ridiculous to use CE to make simple edits to a text file... it is ridiculous. Every tool has its purpose. A text editor is best used to make simple edits to a text file. If you want to automate this process, use a scripting language or upload a modified version of the file.
The part about you being "not very good with programming and Lua" was originally your words.
I don't see anything insulting in my previous comment. Everyone is flawed in some aspect and makes mistakes at some point. It's not an insult to point it out- it's just a part of life.
| mordax wrote: | | i write trainers for many years. i dont need to write lua language to write trainers. who are you to tell me what i should or shouldn't do? | I'm someone with a lot more experience than you using CE and Lua. If I say you probably need Lua to do something, I mean it.
| mordax wrote: | easiest thing for you is to shut up if you got nothing to say about the topic other than insult people.
you dont even know how to attach CE to a file, you just talk nonsense and when someone calls you out on your nonsense then you start insulting and say its easiest not to do it, because you dont actually know and you just said something that doesn't even exist.
why are you replying if you dont like to help people? just be quiet and dont reply if all you do is insult. i will ignore you from now on. | You only read what you want to read and ignore everything else. Sometimes the best help a person can receive is for someone else to tell them they're wrong and should be doing something else.
I've used CE to attach to files before, and I can clearly see the documentation of the relevant Lua functions in celua.txt (in the main CE directory). Not like those are actually good- Lua's IO API is better suited IMO.
Again, if you really want to do this even after reading my explanation of why this is a bad idea, you need to learn the basics of Lua. Saying you're "bad at programming and Lua" isn't an excuse.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Thu Aug 24, 2023 7:07 am Post subject: |
|
|
| ParkourPenguin wrote: | I don't know exactly how CE trainers are implemented, but I'm pretty sure they go through the address list. It should work.
If you're not very good with programming and Lua, how do you plan on making a trainer? | -Just as an FYI, CE has a built-in trainer generator for beginners. I haven't used it in years, but from what I can remember, it allows you to build basic trainers without much, if any, coding knowledge.
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4719
|
Posted: Thu Aug 24, 2023 9:48 am Post subject: |
|
|
True. I think the relevant menu item is "File -> Generate generic trainer lua script from table", so it probably uses Lua somewhere. Users don't need to know how it uses Lua AFAIK.
You need Lua to do what OP wants to do, but OP seemed unwilling to learn and still asked anyway. I was a bit annoyed and could've worded that better.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
++METHOS I post too much
Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Thu Aug 24, 2023 1:44 pm Post subject: |
|
|
| Yes, I believe that it uses Lua. A GUI is provided so that all of the basic stuff can be done without knowing Lua, but as you say, not all things.
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1535
|
Posted: Mon Sep 11, 2023 8:24 am Post subject: Re: why does CE put a NUL at the end? |
|
|
| mordax wrote: |
i know there are easier methods of editing a file, but i'm trying to make automated savegame editor using CE, so i can turn it into .exe with dropboxes, where someone can choose like "weapon 01 damage" and then edit the value in the box, then simply click save.
which also brings me to one other question, is there a way to open and save the file by using a button in trainer generator?
thanks in advance. |
Has this issue reached a solution?
_________________
|
|
| Back to top |
|
 |
|
|
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
|
|