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 to send 00 equivalent in text (ascii)?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Drivium
Advanced Cheater
Reputation: 0

Joined: 16 Apr 2013
Posts: 97

PostPosted: Thu Jun 20, 2019 4:41 pm    Post subject: How to send 00 equivalent in text (ascii)? Reply with quote

I'm working on a dropdown list for a game to swap inventory. One cool thing about this game is the inventory is viewable in memory as text in CE, so you can literally change the in memory name of the item there and it reflects in game.

My drop down list shows the value on the right (real world name), but writes the value on the left (in memory name).

"Weapon_Bow_015": "Golden Bow",
"Weapon_Bow_016": "Swallow Bow",
"Weapon_Bow_017": "Falcon Bow",
"Weapon_Bow_023": "Ancient Bow",
"Weapon_Bow_026": "Mighty Lynel Bow",
"Weapon_Bow_027": "Dragon Bone Boko Bow",
"Weapon_Bow_028": "Great Eagle Bow",
"Weapon_Sword_041": "Eightfold Blade",
"Weapon_Sword_042": "Spring-Loaded Hammer",
"Weapon_Sword_043": "Torch",
"Weapon_Sword_044": "Tree Branch",
"Weapon_Sword_047": "Royal Guard's Sword",
"Weapon_Sword_048": "Meteor Rod",
"Weapon_Sword_049": "Blizzard Rod",
"Weapon_Sword_050": "Thunderstorm Rod",
"Weapon_Sword_051": "Boomerang",

The problem I'm facing is when I want to write a new item whose name is shorter than the previous.

For example, if I'm writing from a sword to a bow:
Weapon_Sword_041 becomes Weapon_Bow_02841, since the bow string is two characters less than the sword. This item is invalid, obviously.

So, how can I tell CE to send a null string in text? My thought is I'd create a buffer at the end of each item string of empty spaces. The bytes show 00 for empty string, but I cannot find a way to send that in text. Even a space or a 0 has a non null byte value.

Complete list of item names in case it helps:
https://github.com/MrCheeze/botw-tools/blob/master/botw_names.json


Last edited by Drivium on Fri Jun 21, 2019 8:49 am; edited 2 times in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Thu Jun 20, 2019 5:01 pm    Post subject: Reply with quote

Code:
local s = '\x00\x00\x00'
print(#s)            -- prints 3
print(s:byte(1,#s))  -- prints 0 0 0

Other character escape sequences are documented here:
https://www.lua.org/manual/5.3/manual.html#3.1

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Jun 20, 2019 8:44 pm    Post subject: Reply with quote

Code:
function padString(target,source) -- expects 2 strings
   if(#source < #target) then
      error('you cannot write a longer string');
   end
   return target..string.rep('\x00',#source-#target);
end

local s1 = 'some long string';
local s2 = 'shorter one';
print(#s1,#s2,#getPaddedString(s1,s2)) -- 16; 11; 16;

_________________
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
Drivium
Advanced Cheater
Reputation: 0

Joined: 16 Apr 2013
Posts: 97

PostPosted: Fri Jun 21, 2019 8:55 am    Post subject: Reply with quote

ParkourPenguin wrote:
Code:
local s = '\x00\x00\x00'
print(#s)            -- prints 3
print(s:byte(1,#s))  -- prints 0 0 0

Other character escape sequences are documented here:
https://www.lua.org/manual/5.3/manual.html#3.1


DaSpamer wrote:
Code:
function padString(target,source) -- expects 2 strings
   if(#source < #target) then
      error('you cannot write a longer string');
   end
   return target..string.rep('\x00',#source-#target);
end

local s1 = 'some long string';
local s2 = 'shorter one';
print(#s1,#s2,#getPaddedString(s1,s2)) -- 16; 11; 16;


So, theoretically, could I append all of my drop down list strings with something like:

Weapon_Sword_041\x00\x00\x00\x00\x00\x00
Weapon_Bow_028\x00\x00\x00\x00\x00\x00

...and CE will know how to interpret?

**EDIT: Just tried a test to implement it, but it's literally writing: "\x00" I guess I'm not understanding how to apply this solution to my case. I've already got hundreds of inventory slot addresses created, each with hundreds of drop down list items. Hoping I'd just be able to open the .ct file in something like Notepad++ and append (find/replace) each item with a trailing buffer.



Example.png
 Description:
 Filesize:  237.72 KB
 Viewed:  6990 Time(s)

Example.png


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

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Fri Jun 21, 2019 11:29 am    Post subject: Reply with quote

oh did not know you're using dropdown, might tell us how exactly you select the value or how you set the value? also try perhaps \0 instead
_________________
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
Drivium
Advanced Cheater
Reputation: 0

Joined: 16 Apr 2013
Posts: 97

PostPosted: Fri Jun 21, 2019 11:38 am    Post subject: Reply with quote

DaSpamer wrote:
oh did not know you're using dropdown, might tell us how exactly you select the value or how you set the value? also try perhaps \0 instead


It's as simple as the image shows. I have a dropdown list with hundreds of entries. I have a playerbase cheat that once enabled, finds the beginning of each item string and populates the address list with current inventory items. The user double clicks the item in the list and selects a new one. This overwrites the string to the address. Doing all edits in string form. Pretty simple.

*Edit: Tried \0, but it also get's written literally.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri Jun 21, 2019 12:32 pm    Post subject: Reply with quote

Yeah, I realized CE probably doesn't send that through a Lua interpreter.

I'd use the AoB type instead. Lua can automate changing the drop down lists. Exactly how you'd do this depends on how you have the lists set up.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Drivium
Advanced Cheater
Reputation: 0

Joined: 16 Apr 2013
Posts: 97

PostPosted: Fri Jun 21, 2019 12:40 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Yeah, I realized CE probably doesn't send that through a Lua interpreter.

I'd use the AoB type instead. Lua can automate changing the drop down lists. Exactly how you'd do this depends on how you have the lists set up.


Yea, I've considered using that, but the problem is that then the user won't know which item they're changing. The address value doesn't reflect the real world name when the address values are initially populated. It shows the string value...which is still pretty easily interpretable. If I switch to AOB type, it won't be.

For example, now, using string type, an address may show a value of: Weapon_Sword_070. The user will know this is a sword in their inventory and can change it. However, if I switch to AOB, it will just show: 57 65 61 70 6F 6E 5F 53 77 6F 72 64 5F 30 37 30. The user would have no clue what this is. Hope this is making sense.... I appreciate the help!


Last edited by Drivium on Fri Jun 21, 2019 1:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Fri Jun 21, 2019 1:07 pm    Post subject: Reply with quote

Drivium wrote:
ParkourPenguin wrote:
Yeah, I realized CE probably doesn't send that through a Lua interpreter.

I'd use the AoB type instead. Lua can automate changing the drop down lists. Exactly how you'd do this depends on how you have the lists set up.


Yea, I've considered using that, but the problem is that then the user won't know which item they're changing. The address value doesn't reflect the real world name when the address values are initially populated. It shows the string value...which is still pretty easily interpretable. If I switch to AOB type, it won't be.

For example, now, using string type, an address may show: Weapon_Sword_070. The user will know this is a sword in their inventory and can change it. However, if I switch to AOB, it will just show: 57 65 61 70 6F 6E 5F 53 77 6F 72 64 5F 30 37 30. The user would have no clue what this is. Hope this is making sense.... I appreciate the help!

Add perhaps a child memoryRecord with string type, or try and move this to lua end;

_________________
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
Drivium
Advanced Cheater
Reputation: 0

Joined: 16 Apr 2013
Posts: 97

PostPosted: Fri Jun 21, 2019 1:09 pm    Post subject: Reply with quote

DaSpamer wrote:
Drivium wrote:
ParkourPenguin wrote:
Yeah, I realized CE probably doesn't send that through a Lua interpreter.

I'd use the AoB type instead. Lua can automate changing the drop down lists. Exactly how you'd do this depends on how you have the lists set up.


Yea, I've considered using that, but the problem is that then the user won't know which item they're changing. The address value doesn't reflect the real world name when the address values are initially populated. It shows the string value...which is still pretty easily interpretable. If I switch to AOB type, it won't be.

For example, now, using string type, an address may show: Weapon_Sword_070. The user will know this is a sword in their inventory and can change it. However, if I switch to AOB, it will just show: 57 65 61 70 6F 6E 5F 53 77 6F 72 64 5F 30 37 30. The user would have no clue what this is. Hope this is making sense.... I appreciate the help!

Add perhaps a child memoryRecord with string type, or try and move this to lua end;


I populated the dropdowns using lua...it was a one and done thing, though. How are you suggesting I use lua to solve this problem?


This is the lua script framework I used in case anyone is interested:
https://forum.cheatengine.org/viewtopic.php?t=591755
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Fri Jun 21, 2019 2:39 pm    Post subject: Reply with quote

Something like this:
https://pastebin.com/amU1iYr8
(using pastebin because captchas are eating the post otherwise)

See celua.txt for documentation.

Also, just set the memory records to show the dropdown description instead of the actual value. Users never see the AoBs.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Drivium
Advanced Cheater
Reputation: 0

Joined: 16 Apr 2013
Posts: 97

PostPosted: Mon Jun 24, 2019 8:04 am    Post subject: Reply with quote

Thank you. I'll play with this.
Back to top
View user's profile Send private message
Drivium
Advanced Cheater
Reputation: 0

Joined: 16 Apr 2013
Posts: 97

PostPosted: Tue Jul 02, 2019 11:24 am    Post subject: Reply with quote

ParkourPenguin wrote:
Something like this:
https://pastebin.com/amU1iYr8
(using pastebin because captchas are eating the post otherwise)

See celua.txt for documentation.

Also, just set the memory records to show the dropdown description instead of the actual value. Users never see the AoBs.


Ok, trying to apply this, but getting this error:

Error:[string "-- Cheat Engine Lua script snippet
..."]:15: attempt to get length of a nil value (field '?')

The way I'm trying to run it is I'm just opening a new LUA editor, pasting your code, and clicking "Execute script"
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Tue Jul 02, 2019 2:43 pm    Post subject: Reply with quote

Make sure you're using the latest version of Cheat Engine.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Drivium
Advanced Cheater
Reputation: 0

Joined: 16 Apr 2013
Posts: 97

PostPosted: Tue Jul 02, 2019 2:54 pm    Post subject: Reply with quote

ParkourPenguin wrote:
Make sure you're using the latest version of Cheat Engine.


6.7. I'll try again with newer version.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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