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 


Override a table entires value change/display.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
MindCaged
Newbie cheater
Reputation: 0

Joined: 25 Apr 2013
Posts: 10

PostPosted: Tue Apr 28, 2015 8:52 am    Post subject: Override a table entires value change/display. Reply with quote

Okay, so say you're playing a game where a given value is say the actual value + 10 to prevent cheaters or something, is there a way to maybe put code in the cheat table where even though the value in that address is say 110, it'll display 100? And vice versa, where if somebody changes it to 100 it'll set the value in the address to 110? I realize a custom type could maybe do this, but is there a way to make one specific to a cheat list and not globally defined, or just not use a custom type and like have events or something? So it'll call certain functions to figure out what to display and call another function when the value is attempted to be set. I'm not sure if there's any events for this because there's quite a few details of CE that aren't properly documented and if they are documented it's hard to find the documentation.

Idealiy it'd be cool if you could assign a getValue and setValue function to a cheat entry or something.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue Apr 28, 2015 2:50 pm    Post subject: Reply with quote

Right-click the address and click select Set/Change dropdown selection options

Enable:
Disallow manual user input
Only show the description part
Make the record display values like the dropdown list

The all you have to do is add every possible value Smile
Code:
100:110
101:111
102:112
Back to top
View user's profile Send private message
MindCaged
Newbie cheater
Reputation: 0

Joined: 25 Apr 2013
Posts: 10

PostPosted: Tue Apr 28, 2015 7:39 pm    Post subject: Reply with quote

Okay, all I can say is /ouch/, that'd be really tedious, also what if it was like a 4 byte integer? That'd be pretty much impossible to set every value.

Zanzer wrote:
Right-click the address and click select Set/Change dropdown selection options

Enable:
Disallow manual user input
Only show the description part
Make the record display values like the dropdown list

The all you have to do is add every possible value Smile
Code:
100:110
101:111
102:112
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Tue Apr 28, 2015 7:43 pm    Post subject: Reply with quote

Yea, it was more a joke. Smile

Only way I know of would be to create a custom form and use Lua.
Add 10 before writing the value to memory.
Subtract 10 before displaying the value to the user.

Edit: You know, I've never actually heard of CE's custom types before. Wink
But, this seems like it should work if you do decide to go with that approach.
Code:
typename="My Type"
bytecount=4
functionbasename="mytype"

function mytype_bytestovalue(b1,b2,b3,b4)
  return byteTableToDword({b1, b2, b3, b4}) - 10

end

function mytype_valuetobytes(i)
  return unpack(dwordToByteTable(i + 10))
end
return typename,bytecount,functionbasename


Edit 2: And I see your problem. The custom type isn't saved to the table.
I'm not even certain where it was saved. Not seeing any other modified files in CE's folder.
Back to top
View user's profile Send private message
MindCaged
Newbie cheater
Reputation: 0

Joined: 25 Apr 2013
Posts: 10

PostPosted: Wed Apr 29, 2015 9:03 am    Post subject: Reply with quote

It's saved in the registry I believe.

Edit:There's a regsiterCustomTypeLua function for registering a custom type, I'm not sure if it only works in the main file or if you could put it in a table, and I'm not sure how it'd react to the code not being there when you start CE. I don't know if it could save just those functions to the registry, or if it'd expire when the table was closed or CE was restarted.
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Apr 29, 2015 10:59 pm    Post subject: Reply with quote

That function appears to only register the custom type until you close Cheat Engine.
So if you execute the Lua script on load or in some table script, you can provide your users with the type.

Code:
registerCustomTypeLua("CustType", 4,
function(b1,b2,b3,b4)
  return byteTableToDword({b1, b2, b3, b4}) - 10
end,
function(i)
  return unpack(dwordToByteTable(i + 10))
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