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 


Trainer that stores a value and can copy it to addresses

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

Joined: 03 Jul 2014
Posts: 15

PostPosted: Thu Jul 03, 2014 8:23 pm    Post subject: Trainer that stores a value and can copy it to addresses Reply with quote

So I'd like to make a simple trainer that has 2 hotkeys '1' would take the value of an address and store it somewhere. Then '2' would take the value you stored when you pressed '1' and set an address to that value.


Basically something like this

Press '1'
(the players current X position value is stored "321" for example)

you move around and your x changes

Press '2'
(the players current X position value changes to what was stored "321")


What I don't know how to do is
1. store the value that is currently at some address
2. set the value of an address to something that was stored (a variable)
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 03, 2014 10:24 pm    Post subject: Reply with quote

Code:
local original_value = 0;
local storeValue = function ()
   original_value = readInteger('address');
end
local restoreValue = function ()
   writeInteger('address', original_value);
end
createHotkey(original_value, VK_CTRL, VK_1) -- Stores value
createHotkey(restoreValue, VK_CTRL, VK_2)   -- Restores value

_________________
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
thebmxbandit11
Newbie cheater
Reputation: 0

Joined: 03 Jul 2014
Posts: 15

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

DaSpamer wrote:
Code:
local original_value = 0;
local storeValue = function ()
   original_value = readInteger('address');
end
local restoreValue = function ()
   writeInteger('address', original_value);
end
createHotkey(original_value, VK_CTRL, VK_1) -- Stores value
createHotkey(restoreValue, VK_CTRL, VK_2)   -- Restores value


Cool thank you now where do i put this code? Sorry I am very new to cheat engine

I have been trying to figure this out for the past 5 hours if u could add me on skype and explain what to do real quick that would be awesome my skype username is thebmxbandit11
Back to top
View user's profile Send private message
STN
I post too much
Reputation: 42

Joined: 09 Nov 2005
Posts: 2672

PostPosted: Fri Jul 04, 2014 5:17 am    Post subject: Re: Trainer that stores a value and can copy it to addresses Reply with quote

thebmxbandit11 wrote:
So I'd like to make a simple trainer that has 2 hotkeys '1' would take the value of an address and store it somewhere. Then '2' would take the value you stored when you pressed '1' and set an address to that value.


Basically something like this

Press '1'
(the players current X position value is stored "321" for example)

you move around and your x changes

Press '2'
(the players current X position value changes to what was stored "321")


What I don't know how to do is
1. store the value that is currently at some address
2. set the value of an address to something that was stored (a variable)


You don't need LUA for this, there are a few ways you can go about this. Here's a quick one

in AA, register a new symbol e.g xcord

newmem:

...your code
mov xcord, (your xcordvalue 321 for example)

newmem+100:
xcord:
dd 0

then simply add an entry in your cheat table, in the address put xcord. Now when you activate your first cheat script, it will update the value in xcord and you can then modify it to whatever you want by assigning a hotkey to it.

_________________
Cheat Requests/Tables- Fearless Cheat Engine
https://fearlessrevolution.com
Back to top
View user's profile Send private message
thebmxbandit11
Newbie cheater
Reputation: 0

Joined: 03 Jul 2014
Posts: 15

PostPosted: Fri Jul 04, 2014 8:16 pm    Post subject: Re: Trainer that stores a value and can copy it to addresses Reply with quote

STN wrote:
thebmxbandit11 wrote:
So I'd like to make a simple trainer that has 2 hotkeys '1' would take the value of an address and store it somewhere. Then '2' would take the value you stored when you pressed '1' and set an address to that value.


Basically something like this

Press '1'
(the players current X position value is stored "321" for example)

you move around and your x changes

Press '2'
(the players current X position value changes to what was stored "321")


What I don't know how to do is
1. store the value that is currently at some address
2. set the value of an address to something that was stored (a variable)


You don't need LUA for this, there are a few ways you can go about this. Here's a quick one

in AA, register a new symbol e.g xcord

newmem:

...your code
mov xcord, (your xcordvalue 321 for example)

newmem+100:
xcord:
dd 0

then simply add an entry in your cheat table, in the address put xcord. Now when you activate your first cheat script, it will update the value in xcord and you can then modify it to whatever you want by assigning a hotkey to it.


that sounds great but i have no idea how to write assembly, use the auto assembler or make all of this into a trainer.

What i really need is just a detailed way to create a trainer that lets you press 1 to save your current x and y position then press 2 to set your x and y to what was saved.

I really do appreciate the comments I just really want to make this trainer and can't find a single good very detailed tutorial on how to make a trainer that runs scripts given certain hotkeys or runs assembly or whatever you were explaining.

Sorry I just really don't know how to figure this out...

okay i figured it out using this lua script given to me by a friend

local savedX = 0;
local savedY = 0;

function savePosition()
savedX = readFloat("[[SuperMeatBoy.exe+002D54BC]+28]+84");
savedY = readFloat("[[SuperMeatBoy.exe+002D54BC]+28]+88");
end

function loadPosition()
writeFloat("[[SuperMeatBoy.exe+002D54BC]+28]+84", savedX);
writeFloat("[[SuperMeatBoy.exe+002D54BC]+28]+88", savedY);
end

createHotkey("savePosition", VK_1);
createHotkey("loadPosition", VK_2);

strings_add(getAutoAttachList(), "SuperMeatBoy.exe");
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