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 


Automation with Lua

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

Joined: 15 May 2016
Posts: 47

PostPosted: Tue Dec 06, 2016 3:17 pm    Post subject: Automation with Lua Reply with quote

Hi all:

I am trying to integrate Cheat engine into my project. I am trying to use CE to acquire the addresses of some values and then pass the address, when found, to my python script. So,


Is it possible for my python or my c++ code to call CE and perform searches?
If not, can I use the Lua of CE somehow to do the same thing?

thanks Smile
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Tue Dec 06, 2016 4:10 pm    Post subject: Reply with quote

you can launch ce with a table that launches the luaserver pipe, and then your python script can connect to the pipe and issue commands. (look at luaclient dll for examples)
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Tue Dec 06, 2016 4:21 pm    Post subject: Reply with quote

Example from db, in case the post not easy to search
http://forum.cheatengine.org/viewtopic.php?p=5687454

Inside the zip, Form1cs has this function:
Code:

...
        private UInt64 doCommand(String cmdstring)
        {
            NamedPipeClientStream s = new NamedPipeClientStream("something");
            s.Connect();
            if (s.IsConnected)
            {
                byte[] result = new byte[8];
                byte[] command = System.Text.Encoding.ASCII.GetBytes(cmdstring);
                byte[] size = BitConverter.GetBytes((int)command.Length);
                byte[] fullcommand = new byte[1];
                fullcommand[0] = 1; //execute string.  Perhaps I add new functions in the future
                fullcommand = fullcommand.Concat(size).ToArray();
                fullcommand = fullcommand.Concat(command).ToArray();
                fullcommand = fullcommand.Concat(BitConverter.GetBytes((long)0)).ToArray(); //the 'parameter' value
                s.Write(fullcommand, 0, fullcommand.Length);
                s.Read(result, 0, 8);
                s.Close();
                return BitConverter.ToUInt64(result, 0);
            }
            else
                return 0;
        }
....
// line edited


Should be an example using the pipe thing, using csharp not python though.

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
Michaelc
Cheater
Reputation: 0

Joined: 15 May 2016
Posts: 47

PostPosted: Tue Dec 06, 2016 4:46 pm    Post subject: Reply with quote

Dark Byte wrote:
you can launch ce with a table that launches the luaserver pipe, and then your python script can connect to the pipe and issue commands. (look at luaclient dll for examples)


If I don't have the table, and that's given for the time being, is it possible to use python to start CE somehow and command CE to search? I mean, I got the search down to a science: search between 0-90, then 90-180, and so on, it takes less than 4 tries and just under two and a half minute to do.

So here is what I would like to do: when needed, my python calls CE and issues the search commands (it's always the same) and then CE/Lua returns the addresses.

also, can I have lua output the addreses to a .txt file instead of this "pipe" thing? is it difficult to learn and use?

thanks!
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Tue Dec 06, 2016 7:19 pm    Post subject: Reply with quote

A simple test.

CE 6.6 side:
Code:

openLuaServer('something9')



python 3.3 side from an admin cmd.exe console:
Code:

import struct
f = open(r'\\.\pipe\something9','wb')

lua = b"print(_VERSION)"

csz = len(lua)

tosend = struct.pack("<bi"+str(csz)+"sq", 1, csz, lua, 0)

print(len(tosend))
ret = f.write(tosend)
f.flush()
f.close()
print("sent",ret)


Running the python, then CE side will print "Lua 5.3".

I don't know how to use namedpipe in python, so the example has not receive the result.

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
Michaelc
Cheater
Reputation: 0

Joined: 15 May 2016
Posts: 47

PostPosted: Fri Dec 09, 2016 11:51 am    Post subject: Reply with quote

I have clue what that is >_<

I'll read about Lua on Cheat engine for now, maybe there is a way to do what I described?
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