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 


Requesting a Tutorial...

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

Joined: 31 Oct 2010
Posts: 70
Location: New Zealand

PostPosted: Thu Sep 01, 2016 9:47 pm    Post subject: Requesting a Tutorial... Reply with quote

So Lately with cheat engine trainer maker I have been trying to insert a timer to my trainer that will look for the process and then if change a label to say game found or game not found(if game is not running).

So I've looked around here and all the code I tried every time It executes I get Lua going nuts saying error attempting to use a nil value or something even though the game was attached.

If someone could write up a nice tutorial show how to do this it would be helpful to everyone. I sort of wish there was a automated process but that would require some magic and a cheat engine update.

The only other way Is I found a tutorial for making a trainer in C# but the guy doing it only uses addresses plus pointers. So id need to find how to write to process memory and read it in C#.

Also this would teach people LUA so far I'm not a very big fan of it. Plus all over Youtube the only tutorials for making trainers are in C# or C++.

_________________
I know you're reading this, Jiehfeng. Smile


http://forum.cheatengine.org/viewtopic.php?t=533625
Back to top
View user's profile Send private message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Fri Sep 02, 2016 8:27 am    Post subject: Re: Requesting a Tutorial... Reply with quote

It is a game for only one process ?, ie it is not browser
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Sep 02, 2016 11:28 am    Post subject: Reply with quote

Code:
if mytimer == nil then
  mytimer = createTimer(nil, false)
end
mytimer.Interval = 1000
mytimer.OnTimer = function(timer)
  if readInteger("game.exe") == nil then
    UDF1.CELabel1.Caption = "Game Not Found"
  else
    UDF1.CELabel1.Caption = "Game Found"
  end
end
mytimer.Enabled = true
Back to top
View user's profile Send private message
satanrules666
Advanced Cheater
Reputation: 0

Joined: 31 Oct 2010
Posts: 70
Location: New Zealand

PostPosted: Fri Sep 02, 2016 2:21 pm    Post subject: Reply with quote

Quote:

Filipe_Br
It is a game for only one process ?, ie it is not browser


Yes

Quote:


if mytimer == nil then
mytimer = createTimer(nil, false)
end
mytimer.Interval = 1000
mytimer.OnTimer = function(timer)
if readInteger("game.exe") == nil then
UDF1.CELabel1.Caption = "Game Not Found"
else
UDF1.CELabel1.Caption = "Game Found"
end
end
mytimer.Enabled = true



Thanks Zanzer Ill try this in the LUA script does this go anywhere or does it go within a timers function if you add one..

also do you need to change game.exe to the process exe.

Edit I tried this code though it says something about indexing a Nil value or something.

I've never used one of these before so any sort of explanation as to how this works and what I need to change if anything would be good.

_________________
I know you're reading this, Jiehfeng. Smile


http://forum.cheatengine.org/viewtopic.php?t=533625


Last edited by satanrules666 on Fri Sep 02, 2016 2:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Sep 02, 2016 2:34 pm    Post subject: Reply with quote

If you're inserting a timer object in the form, then just add the OnTimer event and populate the function it generates.
Yes, you'll need to change game.exe to your process name. Just like you need to change the form and label names to match your trainer.
Code:
function CETimer1Timer(sender)
  if readInteger("game.exe") == nil then
    UDF1.CELabel1.Caption = "Game Not Found"
  else
    UDF1.CELabel1.Caption = "Game Found"
  end
end
Back to top
View user's profile Send private message
satanrules666
Advanced Cheater
Reputation: 0

Joined: 31 Oct 2010
Posts: 70
Location: New Zealand

PostPosted: Fri Sep 02, 2016 3:01 pm    Post subject: Reply with quote

Zanzer

You legend...

Done it after messing around for a bit

Just added it to my CEListView1Data

Code:

if mytimer == nil then                         --Leave this
mytimer = createTimer(nil, false)         --Leave this
end                                                    --Leave this
mytimer.Interval = 1000                      --Leave this
mytimer.OnTimer = function(timer)       --Leave this
if readInteger("farcry3_d3d11.exe") == nil then --change ("whateverishere to your games name")

CETrainer.lbl_process.Caption = "Game Not Found" --Change CETrainer to the name of your first form default is this. CETrainer its the form right at the top of the Components list. change lbl_process to the name you have given your Label not its caption its name.

else --Leave this
CETrainer.lbl_process.Caption = "Game Found" -- same as above
end --Leave this
end -- Leave this
mytimer.Enabled = true --Leave this.


You know tonight as I can stay up I was half way through a tutorial on coding a DLL injector and making a trainer for it in C++ following a tutorial on Youtube. Coding up all the cheat is time consuming when Cheat engine blissfully does it for you.

Though ill prob still go though with the tutorial I was following later as learning a programing language is good.


_________________
I know you're reading this, Jiehfeng. Smile


http://forum.cheatengine.org/viewtopic.php?t=533625
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