| View previous topic :: View next topic |
| Author |
Message |
Tsyal How do I cheat?
Reputation: 0
Joined: 10 Nov 2019 Posts: 8
|
Posted: Fri Jan 31, 2020 10:30 am Post subject: Standalone trainer (.exe) parameters ? |
|
|
Can I start my trainer with a .bat like that :
"start mytrainer.exe param1 param2"
and have access of "param1" and "param2" in the lua script ?
|
|
| Back to top |
|
 |
DanyDollaro Master Cheater
Reputation: 3
Joined: 01 Aug 2019 Posts: 334
|
|
| Back to top |
|
 |
Tsyal How do I cheat?
Reputation: 0
Joined: 10 Nov 2019 Posts: 8
|
Posted: Fri Jan 31, 2020 11:02 am Post subject: |
|
|
Thank you for the answer.
I already tried, but the arg variable does not seem to exist
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Fri Jan 31, 2020 2:51 pm Post subject: |
|
|
This has no error handling etc. but this should allow you to pull local params:
| Code: |
local p = executeCodeLocal('GetCommandLineA');
local s = readStringLocal(p, 512);
print(s);
|
_________________
- Retired. |
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1532
|
Posted: Fri Jan 31, 2020 8:19 pm Post subject: |
|
|
Here are some examples.
You can use the following codes as 2 ".bat" files.
How to: Open notebook, paste the first code, "save file as", "closeTrainer.bat" or startTrainer.bat "ok.
or: https://forum.cheatengine.org/viewtopic.php?t=610493 (File name script.vbs or Close.bat )
Close: (.bat)
| Code: | @echo off
taskkill /F /IM notepad.exe |
Start: (.bat)
| Code: | @echo off
start C:\Windows\notepad.exe |
Here is a command for LuaScript:
Close:
| Code: | | os.execute("taskkill /F /IM notepad.exe") |
Start:
| Code: | | os.execute("start C:\\Windows\\notepad.exe") |
Enjoy it!
EDIT:
If you are going to start 2 programs:
(.bat)
| Code: | @echo off
start C:\Windows\notepad.exe
start C:\Windows\notepad.exe |
_________________
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Sun Feb 02, 2020 1:55 am Post subject: |
|
|
The arg argument is for Lua 5.0 only. Since Lua 5.1, the var arg expression ... is used instead.
Example:
| Code: | function bar(...)
for k, v in ipairs{...} do
print(k, v)
end
end
bar('cheat', 'engine')
|
or
| Code: | -- double.lua
local input = ... --- to get command line parameter
if input then
local Double
Double = function(input)
return 2 * input
end
return print(Double(input))
end
--- to run:
lua.exe double.lua 15 |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Last edited by Corroder on Sun Feb 02, 2020 5:32 am; edited 2 times in total |
|
| Back to top |
|
 |
Tsyal How do I cheat?
Reputation: 0
Joined: 10 Nov 2019 Posts: 8
|
Posted: Sun Feb 02, 2020 5:01 am Post subject: |
|
|
| atom0s wrote: | This has no error handling etc. but this should allow you to pull local params:
| Code: |
local p = executeCodeLocal('GetCommandLineA');
local s = readStringLocal(p, 512);
print(s);
|
|
I try your code with this .bat :
| Code: |
start CETestParams_2.EXE test
|
and here is the output :
C:\Users\.....\AppData\Local\Temp\cetrainers\CETB318.tmp\extracted\CETestParams_2.EXE "C:\Users\.....\AppData\Local\Temp\cetrainers\CETB318.tmp\extracted\CET_TRAINER.CETRAINER" "-ORIGIN:C:\Users\.....\Desktop\TestParams\"
It seems to be going through a temporary folder and params are lost
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Feb 02, 2020 12:06 pm Post subject: |
|
|
Looks like the trainer generator is ignoring params or restarting itself and dropping them. You could make a issue/request on the GitHub for CE and request that feature be added.
_________________
- Retired. |
|
| Back to top |
|
 |
|