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 


Building new trainer

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

Joined: 08 Oct 2012
Posts: 577

PostPosted: Mon Apr 25, 2022 11:26 am    Post subject: Building new trainer Reply with quote

I'm building a new trainer from old trainers.
Code:
trainer =    {
             };
function trainer:start()

   self.form = createForm(false);
   setProperty(self.form , "BiDiMode", "bdLeftToRight");
   self.form.Caption = 'Cheat Panel';
   self.form.Width = 400;
   self.form.Height = 470;
   self.form.Left = 760;
   self.form.Top =5;
   end;

   trainer:start();


But nothing is created? This portion of code works in other codes. No errors just nothing?
Back to top
View user's profile Send private message Yahoo Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 32

Joined: 16 Feb 2017
Posts: 1257

PostPosted: Mon Apr 25, 2022 11:56 am    Post subject: Reply with quote

Code:
trainer =    {
             };
function trainer:start()

   self.form = createForm(); -- Create - visible ? not false ..
   setProperty(self.form , "BiDiMode", "bdLeftToRight");
   self.form.Caption = 'Cheat Panel';
   self.form.Width = 400;
   self.form.Height = 470;
   self.form.Left = 760;
   self.form.Top =5;
   end;

   trainer:start();

_________________
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
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Mon Apr 25, 2022 11:59 am    Post subject: Reply with quote

Be careful with how you're using colon vs. dot calling and function naming. As is that is not the correct format. As for the form not showing, you aren't telling it to. You need to add 'self.form:Show()'.

Code:
trainer = {};

function trainer.start(self)
    self.form = createForm(false);
    setProperty(self.form, 'BiDiMode', 'bdLeftToRight');
    self.form.Caption = 'Cheat Panel';
    self.form.Width = 400;
    self.form.Height = 470;
    self.form.Left = 760;
    self.form.Top = 5;
    self.form:Show();
end

trainer:start();


Notice the period being used for the 'object.funcname' and the 'self' parameter being defined. Also notice the colon being used for the actual call which tells Lua to automatically pass the calling object as the first parameter.

Otherwise, you would call this like:

Code:
trainer.start(trainer);


For more info, see: https://www.lua.org/pil/16.html

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
bknight2602
Grandmaster Cheater
Reputation: 0

Joined: 08 Oct 2012
Posts: 577

PostPosted: Mon Apr 25, 2022 12:20 pm    Post subject: Reply with quote

atom0s wrote:
Be careful with how you're using colon vs. dot calling and function naming. As is that is not the correct format. As for the form not showing, you aren't telling it to. You need to add 'self.form:Show()'.

Code:
trainer = {};

function trainer.start(self)
    self.form = createForm(false);
    setProperty(self.form, 'BiDiMode', 'bdLeftToRight');
    self.form.Caption = 'Cheat Panel';
    self.form.Width = 400;
    self.form.Height = 470;
    self.form.Left = 760;
    self.form.Top = 5;
    self.form:Show();
end

trainer:start();


Notice the period being used for the 'object.funcname' and the 'self' parameter being defined. Also notice the colon being used for the actual call which tells Lua to automatically pass the calling object as the first parameter.

Otherwise, you would call this like:

Code:
trainer.start(trainer);


For more info, see: https://www.lua.org/pil/16.html

duh: Laughing
Thanks.
Back to top
View user's profile Send private message Yahoo Messenger
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