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 


Anyone able to give a quick example?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Valatros
Cheater
Reputation: 1

Joined: 21 Nov 2015
Posts: 31

PostPosted: Tue Jan 24, 2017 2:38 pm    Post subject: Anyone able to give a quick example? Reply with quote

I'm slowly working on learning what I'm doing with CE, and have come across a code that I assume I need LUA to accomplish.

What I want to do is, set it so that the value at Pointer1, is set equal to the value at Pointer2. Doing this in an effort to create a "Recover between combat" code. Trouble is my extremely minimal code experience is only with visual basic.

Basically I want to create a code that does the following

GetValue from Pointer2

Write value at Pointer1 that was at Pointer2.

I don't mind doing this for each pointer myself, but I'd just like a general example of how to create a variable using a value at a pointer address, then use the value of that variable into the value of a seperate one. If you know a cheat table with a script that does something similar that would be great too; it's just easier to learn that way.
Back to top
View user's profile Send private message
Greenhouse
Cheater
Reputation: 0

Joined: 20 Aug 2016
Posts: 47

PostPosted: Tue Jan 24, 2017 2:54 pm    Post subject: Reply with quote

Try using the code I use for my trainer.

Code:
local value=readFloat("Pointer2")
writeFloat("Pointer1",value)

You can use it for a button If you need to.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 344

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

PostPosted: Tue Jan 24, 2017 3:35 pm    Post subject: Reply with quote

easiest is just freeze pointer1 and set set the value to
Code:

(descriptionofpointer2)


ce will take that notation as that it should get the value from pointer2 and set it to that of pointer1.

and because it's frozen, it will constantly do that

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Back to top
View user's profile Send private message MSN Messenger
Valatros
Cheater
Reputation: 1

Joined: 21 Nov 2015
Posts: 31

PostPosted: Tue Jan 24, 2017 3:50 pm    Post subject: Reply with quote

Okay, I'm 90% sure I'm doing some stupid mistake due to my unfamiliarity with lua, so I'ma post what I've got.

Code:
local value = readFloat(["citra-qt.exe"+0032AB88]+E74)
writeFloat(["citra-qt.exe"+0032AB88]+E9A, value)


Whenever I click execute, I get the error

Quote:
[string "local value=
readFloat(["citra-qt.exe"+0032A..."):1: unexpected
symbol near '['


I assume that's a formatting problem, but
wiki.cheatengine.org/index.php?title=CEAddressString
from the wiki makes me think that's the right format? You mind linking me to your trainer so I can use its code for examples?

Sorry for the unlinked URL; Apparently I can't post those yet.

To Darkbyte, because it said not to double post edited it into this one:

Dark Byte wrote:
easiest is just freeze pointer1 and set set the value to
Code:

(descriptionofpointer2)


ce will take that notation as that it should get the value from pointer2 and set it to that of pointer1.

and because it's frozen, it will constantly do that


Probably a stupid question, but are you saying there's some way to just set the value to Pointer2 without going into the LUA, as though I was just editing the value normally? Because I'd be down with that. Though, making something of a project of this to learn lua, so a working script is still desirable. I tried putting ["citra-qt.exe"+0032AB88]+E74 in as the value for the cheat table line (my pointer) but it couldn't parse it, probably because I am doing something stupid.[/code]
Back to top
View user's profile Send private message
Greenhouse
Cheater
Reputation: 0

Joined: 20 Aug 2016
Posts: 47

PostPosted: Tue Jan 24, 2017 4:22 pm    Post subject: Reply with quote

[quote="Valatros"]Okay, I'm 90% sure I'm doing some stupid mistake due to my unfamiliarity with lua, so I'ma post what I've got.

Code:
local value = readFloat(["citra-qt.exe"+0032AB88]+E74)
writeFloat(["citra-qt.exe"+0032AB88]+E9A, value)


Whenever I click execute, I get the error

Quote:
[string "local value=
readFloat(["citra-qt.exe"+0032A..."):1: unexpected
symbol near '['


Here you have an example:
writeFloat("[[[[HelloNeighborReborn-Win64-Shipping.exe+02650AC0]+358]+0]+E8]+140",value)
Pointer:


Last edited by Greenhouse on Tue Jan 24, 2017 7:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
Valatros
Cheater
Reputation: 1

Joined: 21 Nov 2015
Posts: 31

PostPosted: Tue Jan 24, 2017 5:02 pm    Post subject: Reply with quote

Thank you, that's exactly what I needed to see. I had the order of the quotes and the brackets fucked up. Got timer events working to do an effectively-constant write, too, so just need to fiddle with it a bit and all will be well.

Since I've got you here, how do I create an LUA script as a box, similar to a Shinkansen script? I've been going over how he set it to do things on Enable and stop on Disable, which I hope to implement, but I don't even know how to make an entry on my table a script instead of an address.

Edit/Update: Nevermind! Figured that out after screwing around in the memory viewer.
Back to top
View user's profile Send private message
Radagast
How do I cheat?
Reputation: 0

Joined: 25 Mar 2014
Posts: 1

PostPosted: Tue Mar 21, 2017 4:26 pm    Post subject: Reply with quote

Sorry for the OT.
Valatros, can you please send me a pm? I'd like to ask about your Etryan tables, but i'm unable to send a pm directly

Thank you
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