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 


[HELP] select process with ComboBox
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Sun Sep 13, 2020 7:28 am    Post subject: [HELP] select process with ComboBox Reply with quote

hello master....

first thanks for all master
- Corroder
- Aylin


i make trainer with auto shoot script
but its running outside my game

Ask : how to make it only work / lock in my game
and how to make combobox select active process and how to make it work even 2 screen but same game


Code:

CETrainer.CEComboBox1.Items.Add('PUBG')
ETrainer.CEComboBox1.ItemIndex = 0   -- index 'Select Game....'

cb = CETrainer.CEComboBox1
 local idx = cb.ItemIndex

 if idx ~= 1 then CETrainer.CECheckBox1.Enabled = false end

 if idx == 1 then  -- index 'example'
    if getProcessIDFromProcessName("PUBG.exe") ~= nil  then
       openProcess('PUBG.exe')
       showMessage('PUBG.exe  success opened')
       CETrainer.CECheckBox1.Enabled = true
    else
       showMessage('game PUBG.exe not found,open PUBG.exe first')
       return nil
    end



Last edited by vil33 on Sun Sep 13, 2020 8:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1246

PostPosted: Sun Sep 13, 2020 9:11 am    Post subject: Reply with quote

You use processes for one game and why do you do it with "ComboBox"?
I recommend using a function or button.

Example;
Code:
function Process(prcs)
openProcess(prcs)
pid=getProcessIDFromProcessName(prcs)
pid=tonumber(pid)
if pid==nil then
showMessage("game "..prcs.." not found,open "..prcs.." first")
else
showMessage("PID: "..pid.." - "..prcs.."  success opened")
end
end

--Search the process;
CETrainer.CEButton1.OnClick=function()
Process("chrome.exe")
end


Example ComboBox;
Code:
function Process(prcs)
openProcess(prcs)
pid=getProcessIDFromProcessName(prcs)
pid=tonumber(pid)
if pid==nil then
showMessage("game "..prcs.." not found,open "..prcs.." first")
else
showMessage("PID: "..pid.." - "..prcs.."  success opened")
end
end

CETrainer.CEComboBox1.Items.Add('Process Select')
CETrainer.CEComboBox1.Items.Add('PUBG')
CETrainer.CEComboBox1.Items.Add('Chrome')
CETrainer.CEComboBox1.ItemIndex = 0

CETrainer.CEComboBox1.OnChange=function()
local idx=CETrainer.CEComboBox1.ItemIndex
if idx==1 then
Process("PUBG.exe") end
if idx==2 then
Process("chrome.exe") end
end


And I assume that you still don't understand this solution, and I repeat.
Connect "AutoShoot" to the Timer (t) and activate it with the hotkey.
For example; just press the "F8" key on the game screen and run it.
When exiting the game screen, press the "F8" key and close it.

Thus, "automatic shooting" printing will be under your control.

[quote="Aylin"]
Aylin wrote:
Code:

function t_htkey()
if t.Enabled==false then
t.Enabled=true
else
t.Enabled=false
end
end

--A hot key was assigned for the "F8" timer. (stop - start click F8)
if tKey then tKey.destroy() end
tKey=createHotkey(t_htkey, VK_F8)


or

Code:
function t_htkey()
if  CETrainer.CECheckBox1.Checked==false then
--t.Enabled=true
CETrainer.CECheckBox1.Checked = true
else
--t.Enabled=false
CETrainer.CECheckBox1.Checked = false
end
end

if tKey then tKey.destroy() end
tKey=createHotkey(t_htkey, VK_F8)


Don't forget to put the timer assignment first. Wink
Code:
if t then t.destroy() t=nil end
t = createTimer()
t.interval = 10
t.Enabled = false
--t.OnTimer = AutoShoot

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Sep 13, 2020 6:49 pm    Post subject: Reply with quote

Quote:
but its running outside my game
--------
Ask : how to make it only work / lock in my game


My problem is : I am not understand what he meant.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Sun Sep 13, 2020 8:05 pm    Post subject: Reply with quote

Quote:
You use processes for one game and why do you do it with "ComboBox"?
I recommend using a function or button.

Example;
Code:
function Process(prcs)
openProcess(prcs)
pid=getProcessIDFromProcessName(prcs)
pid=tonumber(pid)
if pid==nil then
showMessage("game "..prcs.." not found,open "..prcs.." first")
else
showMessage("PID: "..pid.." - "..prcs.."  success opened")
end
end

--Search the process;
CETrainer.CEButton1.OnClick=function()
Process("chrome.exe")
end


Example ComboBox;
Code:
function Process(prcs)
openProcess(prcs)
pid=getProcessIDFromProcessName(prcs)
pid=tonumber(pid)
if pid==nil then
showMessage("game "..prcs.." not found,open "..prcs.." first")
else
showMessage("PID: "..pid.." - "..prcs.."  success opened")
end
end

CETrainer.CEComboBox1.Items.Add('Process Select')
CETrainer.CEComboBox1.Items.Add('PUBG')
CETrainer.CEComboBox1.Items.Add('Chrome')
CETrainer.CEComboBox1.ItemIndex = 0

CETrainer.CEComboBox1.OnChange=function()
local idx=CETrainer.CEComboBox1.ItemIndex
if idx==1 then
Process("PUBG.exe") end
if idx==2 then
Process("chrome.exe") end
end


And I assume that you still don't understand this solution, and I repeat.
Connect "AutoShoot" to the Timer (t) and activate it with the hotkey.
For example; just press the "F8" key on the game screen and run it.
When exiting the game screen, press the "F8" key and close it.

Thus, "automatic shooting" printing will be under your control.


Aylin wrote:
Aylin wrote:
Code:

function t_htkey()
if t.Enabled==false then
t.Enabled=true
else
t.Enabled=false
end
end

--A hot key was assigned for the "F8" timer. (stop - start click F8)
if tKey then tKey.destroy() end
tKey=createHotkey(t_htkey, VK_F8)


or

Code:
function t_htkey()
if  CETrainer.CECheckBox1.Checked==false then
--t.Enabled=true
CETrainer.CECheckBox1.Checked = true
else
--t.Enabled=false
CETrainer.CECheckBox1.Checked = false
end
end

if tKey then tKey.destroy() end
tKey=createHotkey(t_htkey, VK_F8)


Don't forget to put the timer assignment first. Wink
Code:
if t then t.destroy() t=nil end
t = createTimer()
t.interval = 10
t.Enabled = false
--t.OnTimer = AutoShoot

ok master i'll try later thank for always supporting me
Corroder wrote:
Quote:
but its running outside my game
--------
Ask : how to make it only work / lock in my game


My problem is : I am not understand what he meant.

sorry master i mean when we run the script only work at game not outside game.

Quote:
IN CASE : i have screen mode game not full screen and when i turn on auto shoot the cursor click everywhere, my dekstop,my computer etc Confused


And how to make trainer select different process but same game and only work on select process
Quote:
IN CASE : even we open facebook but script still run in UNITYWAR cause already select UNITYWAR



different_process_but_same_game.png
 Description:
 Filesize:  21.91 KB
 Viewed:  8545 Time(s)

different_process_but_same_game.png


Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Sep 13, 2020 11:32 pm    Post subject: Reply with quote

Quote:
sorry master i mean when we run the script only work at game not outside game


I see, you mean 'The Game Window'. Your autoshoot code only work when the mouse cursor is focus at the game window, right?.

If that the problem then let we find a solution soon.

And for run the game in two instances, how if you open your game trainer twice too?

The right question is: Can CE open same process at the same time?. Is anybody know?

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Mon Sep 14, 2020 2:45 am    Post subject: Reply with quote

Corroder wrote:
Quote:
sorry master i mean when we run the script only work at game not outside game


I see, you mean 'The Game Window'. Your autoshoot code only work when the mouse cursor is focus at the game window, right?.

If that the problem then let we find a solution soon.

And for run the game in two instances, how if you open your game trainer twice too?

The right question is: Can CE open same process at the same time?. Is anybody know?

yep master, same process but different screen game, master
in case : if i open 2 trainer only work for 1screen ,then i ask how to make combobox active process, if we open 1 game detect 1process if we open 2 game detect 2 process etc...
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Sep 14, 2020 7:39 am    Post subject: Reply with quote

Read these:

https://www.cheatengine.org/forum/viewtopic.php?t=550128&sid=f3f49c91b0ad123bf87a554c844d2327

https://cheatengine.org/forum/viewtopic.php?t=611027&sid=df075313790d13c6c7b129eaf482ff44

https://forum.cheatengine.org/viewtopic.php?t=574676&sid=7a7ff1eb69a6a3fd433a467948a8eb1d

https://www.cheatengine.org/forum/viewtopic.php?p=5449780&sid=002a0bf82a49b30f5362f94419fda184

But, I don't know what do you want exactly.
Create multi instances/games in one trainer or a trainer which used to open many instances for the same games or many instances for different games. Honestly, I doubt want to do it.

My suggestion is deep learn how use CE and Lua scripting first before going to advance scripting and hacking levels.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Mon Sep 14, 2020 8:50 pm    Post subject: Reply with quote

Corroder wrote:
Read these:

https://www.cheatengine.org/forum/viewtopic.php?t=550128&sid=f3f49c91b0ad123bf87a554c844d2327

https://cheatengine.org/forum/viewtopic.php?t=611027&sid=df075313790d13c6c7b129eaf482ff44

https://forum.cheatengine.org/viewtopic.php?t=574676&sid=7a7ff1eb69a6a3fd433a467948a8eb1d

https://www.cheatengine.org/forum/viewtopic.php?p=5449780&sid=002a0bf82a49b30f5362f94419fda184

But, I don't know what do you want exactly.
Create multi instances/games in one trainer or a trainer which used to open many instances for the same games or many instances for different games. Honestly, I doubt want to do it.

My suggestion is deep learn how use CE and Lua scripting first before going to advance scripting and hacking levels.

i'am so sorry master if you confuse
i mean create select box recently process
maybe the right question : How to run multiple clients with auto attach
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Sep 15, 2020 12:05 am    Post subject: Reply with quote

Try to run this script.

Code:
getMainForm().sbOpenProcess.doClick()

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Tue Sep 15, 2020 8:59 pm    Post subject: Reply with quote

Corroder wrote:
Try to run this script.

Code:
getMainForm().sbOpenProcess.doClick()


ok master
please correct me if i'm wrong
then the script is

Code:

getMainForm().sbOpenProcess.doClick()
CETrainer.CEComboBox1.Items.Add('PUBG')
CETrainer.CEComboBox1.ItemIndex = 0   -- index 'Select Game....'

cb = CETrainer.CEComboBox1
 local idx = cb.ItemIndex

 if idx ~= 1 then CETrainer.CECheckBox1.Enabled = false end

 if idx == 1 then  -- index 'example'
    if getProcessIDFromProcessName("PUBG.exe") ~= nil  then
       openProcess('PUBG.exe')
       showMessage('PUBG.exe  success opened')
       CETrainer.CECheckBox1.Enabled = true
    else
       showMessage('game PUBG.exe not found,open PUBG.exe first')
       return nil
    end

sorry master i dont know where i must put the code,when i click excute appear but in trainer not appear



sb_OpenProcess.png
 Description:
 Filesize:  168.49 KB
 Viewed:  8391 Time(s)

sb_OpenProcess.png


Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Sep 15, 2020 10:00 pm    Post subject: Reply with quote

I don't know what exactly you want to do.

Let me ask you some questions:

1. You want to make a process list inside your trainer or what?.

Process list in a trainer mean : SHOW what processes running in current time and then let user to select the process he wants to open with cheat engine.
And after the process open by cheat engine then the hacks for that opened game able to access. So, if the process (game) is not running and not open by cheat engine, all hacks code connection to that game will not enabled.

2. How many games you want to hack in one trainer?. If more than one then your trainer structure must be:

-- Game 1
-- open process for the game 1
-- activating hacks for game 1

-- Game 2
-- open process for the game 2
-- activating hacks for game 2
-- let game 1 still running
-- let game 1 hacks running

-- Game 3 ...and so on.

Please note, I don't know if CE can open multi processes via one trainer,
except the trainer re-open in another instance.
That I know CE can open one process via one CE instance. CE able to open another process but must be open new CE instance.

3. Creating multi games with multi hacks, inside one trainer, this is an advance project. Besides, I don't know if someone like to play 2 or 3 games at the same times. If any there, then that is amazing at least for me.

So, please tell us, what exactly you want to do.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
vil33
Cheater
Reputation: 0

Joined: 29 Jul 2020
Posts: 34

PostPosted: Tue Sep 15, 2020 11:35 pm    Post subject: Reply with quote

Corroder wrote:
I don't know what exactly you want to do.

Let me ask you some questions:

1. You want to make a process list inside your trainer or what?.

Process list in a trainer mean : SHOW what processes running in current time and then let user to select the process he wants to open with cheat engine.
And after the process open by cheat engine then the hacks for that opened game able to access. So, if the process (game) is not running and not open by cheat engine, all hacks code connection to that game will not enabled.

2. How many games you want to hack in one trainer?. If more than one then your trainer structure must be:

-- Game 1
-- open process for the game 1
-- activating hacks for game 1

-- Game 2
-- open process for the game 2
-- activating hacks for game 2
-- let game 1 still running
-- let game 1 hacks running

-- Game 3 ...and so on.

Please note, I don't know if CE can open multi processes via one trainer,
except the trainer re-open in another instance.
That I know CE can open one process via one CE instance. CE able to open another process but must be open new CE instance.

3. Creating multi games with multi hacks, inside one trainer, this is an advance project. Besides, I don't know if someone like to play 2 or 3 games at the same times. If any there, then that is amazing at least for me.

So, please tell us, what exactly you want to do.

yep master your point is right
sorry for being your confuse,point 3 not multigame inside one trainer
i mean if we open 2game then detect 2 process at trainer but we only choose 1 game/process to running script
if we want to hack for game2 we must open trainer again

but i dont know what should i do ,yesterday i try your code.
It's work master but the script running outside game hehe
Back to top
View user's profile Send private message
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Wed Sep 16, 2020 10:21 am    Post subject: Reply with quote

I recommend just using openProcess("process name")
But who cares about my recommendations Rolling Eyes Question



vil33 wrote:

but i dont know what should i do ,yesterday i try your code.
It's work master but the script running outside game hehe


you will need to use sendMessage function, but I don't recommend going into that too LOL
But who cares about my recommendations Rolling Eyes Question Laughing
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1246

PostPosted: Wed Sep 16, 2020 10:44 am    Post subject: Reply with quote

I understood what he wanted to do.
CE does not connect to 2 processes at the same time, but if you register 2 processes, it will connect alternately.
You provide this registration with 2 codes.
First of all, you need the "processMemory" code from @ Corroder.
So you see the current pids of the two game windows.
Then you save these pids, "pid1 - pid2".
I will come to the pc in 1 week, I think this can be coded. Wink

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Oxijen
Expert Cheater
Reputation: 0

Joined: 07 May 2020
Posts: 163
Location: On The Moon

PostPosted: Wed Sep 16, 2020 10:50 am    Post subject: Reply with quote

I think he means that he is trying to select the right game.
for example 1 main account and 1 alt account
he don't want to hack on main




Note :
don't forget "I think", it is just an opinion
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
Goto page 1, 2, 3  Next
Page 1 of 3

 
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