View previous topic :: View next topic |
Author |
Message |
Michaelc Cheater Reputation: 0
Joined: 15 May 2016 Posts: 47
|
Posted: Tue Dec 06, 2016 3:17 pm Post subject: Automation with Lua |
|
|
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
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Tue Dec 06, 2016 4:10 pm Post subject: |
|
|
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 |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Tue Dec 06, 2016 4:21 pm Post subject: |
|
|
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 |
|
|
Michaelc Cheater Reputation: 0
Joined: 15 May 2016 Posts: 47
|
Posted: Tue Dec 06, 2016 4:46 pm Post subject: |
|
|
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 |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Tue Dec 06, 2016 7:19 pm Post subject: |
|
|
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 |
|
|
Michaelc Cheater Reputation: 0
Joined: 15 May 2016 Posts: 47
|
Posted: Fri Dec 09, 2016 11:51 am Post subject: |
|
|
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 |
|
|
|