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 


[C.E Extension] Trainer Tracer

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

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Jul 18, 2013 1:44 pm    Post subject: [C.E Extension] Trainer Tracer This post has 1 review(s) Reply with quote

Hey guys,
Here's a small extension for your cheat engine!

Allowing you to show and hide LUA trainers that you've create.
Its allowing you to recover 'closed by mistake' trainer (happened to me a lot).
Because, it stores the trainer in a global table, and sets onClose function to hide the form so Cheat Engine won't destroy automatically it.

You may download the LUA script and put it in your cheat engine Auto Run folder.

Thanks for Dark Byte with helping me out with the ListView stuff.

Hope you guys will get a great use of it,
It's pretty simple.
Here's a preview


Full script.

Code:
if oldcreateForm==nil then
   oldcreateForm = createForm
   createForm = nil
end
GlobalFormTable = {}
function createForm(Visible)
   if Visible==nil then
      Visible = true
   end
   GlobalFormTable[#GlobalFormTable+1] = oldcreateForm(Visible)
   GlobalFormTable[#GlobalFormTable].onClose = function (sender)  -- Closing the form itself,
                                       return sender.hide() -- will result an error in function of the Form Tracer
                                    end
   return GlobalFormTable[#GlobalFormTable]
end

EasyFormAccess = {
               _fheight = 310 ;
               _fwidth = 300 ;
               _bheight = 20 ;
               _bwidth = 70 ;
               _lvheight = 250 ;
               _lvwidth = 290 ;
               _lvccaption = "Form Caption" ;
               _lvcolumwidth = 286 ;
               _caption = "Form tarcer" ;
               _title = "All user defined forms :" ;
               _bcaption1 = "initialize" ;
               _bcaption2 = "show/hide" ;
            }
function EasyFormAccess:Start()
   TrainerTracerClose = 1
   self.MainForm = oldcreateForm(false)
   setProperty(self.MainForm, "BiDiMode", "bdLeftToRight")
   self.MainForm.height = self._fheight
   self.MainForm.width = self._fwidth
   self.MainForm.Caption = self._caption
   self.FormLv = createListView(self.MainForm)
   setProperty(self.FormLv, 'ViewStyle', 'vsReport')
   setProperty(self.FormLv, 'RowSelect', 'True')
   setProperty(self.FormLv, 'ReadOnly', 'True')
   setProperty(self.FormLv, 'HideSelection', 'False')
   self.FormLv.height = self._lvheight
   self.FormLv.width = self._lvwidth
   self.FormLvC = self.FormLv.getColumns()
   self.FormLvColum = self.FormLvC.add()
   self.FormLvColum.Width = self._lvcolumwidth
   self.FormLvColum.Caption = self._lvccaption
   self.FormLvI = self.FormLv.getItems()
   self.Title = createLabel(self.MainForm)
   self.Title.caption = self._title
   self.IntB = createButton(self.MainForm)
   self.IntB.height = self._bheight
   self.IntB.width = self._bwidth
   self.IntB.caption = self._bcaption1
   self.IntB.OnClick = function( ) self:Initialize() end
   self.ShowB = createButton(self.MainForm)
   self.ShowB.height = self._bheight
   self.ShowB.width = self._bwidth
   self.ShowB.caption = self._bcaption2
   self.ShowB.enabled = false
   self.ShowB.OnClick = function( ) self:ShowSelect() end
   self.MainForm.centerScreen()
   self.Title.top  = 5
   self.Title.left = math.floor((self.MainForm.width - self.Title.width - 50) / 2)
   self.FormLv.top = self.Title.top + self.Title.height + 5
   self.FormLv.left = 5
   self.IntB.top = self.FormLv.top + self.FormLv.height + 5
   self.IntB.left = math.floor(self.MainForm.width - (self.IntB.width + self.ShowB.width + self.ShowB.width) - 2.5)
   self.ShowB.top = self.FormLv.top + self.FormLv.height + 5
   self.ShowB.left = math.ceil(self.IntB.left + self.ShowB.width + 2.5)
end
function EasyFormAccess:AddItemsLv(FormCaption)
   local Temp
   Temp = self.FormLvI.add()
   Temp.Caption = FormCaption
end
function EasyFormAccess:Initialize()
   self.FormLv.clear()
   if #GlobalFormTable < 1 then
      return
   end
   if #GlobalFormTable > 12 then
      self.FormLvColum.Width = 269
   end
   for i = 1,#GlobalFormTable do
      self:AddItemsLv(GlobalFormTable[i].caption)
   end
    self.ShowB.enabled = true
end
function EasyFormAccess:ShowSelect()
   local index
   index = self.FormLv.getItemIndex() + 1
   if GlobalFormTable[index] ~= nil then
      if GlobalFormTable[index].getVisible() then
         GlobalFormTable[index].hide()
      else
         GlobalFormTable[index].show()
      end
   end
end
EasyFormAccess:Start()
function TrainerTracerMenu()
   if EasyFormAccess.MainForm.getVisible() then
      EasyFormAccess.MainForm.hide()
   else
      EasyFormAccess.MainForm.show()
   end
end

CEMenu = menu_getItems(form_getMenu(getMainForm()))
TrainerTracer = createMenuItem(CEMenu)
menuItem_add(CEMenu, TrainerTracer)
menuItem_setCaption(TrainerTracer, "Trainer Tracer")
menuItem_onClick(TrainerTracer, TrainerTracerMenu)



CETrainerTracer.lua
 Description:
Put this file inside your cheat engine auto run folder :).

Download
 Filename:  CETrainerTracer.lua
 Filesize:  3.74 KB
 Downloaded:  918 Time(s)


_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Jul 19, 2013 8:10 am    Post subject: Reply with quote

Well, I think I don't need this (I save my work very often).

Still, it is very helpful for newbies who accidentally close form while trainer testing.

_________________
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25287
Location: The netherlands

PostPosted: Fri Jul 19, 2013 8:35 am    Post subject: Reply with quote

Newbies probably use the form designer,and those forms will show in the table menu
But it might be useful if you create forms with code and then accidentally delete the code and close the form

_________________
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
View user's profile Send private message MSN Messenger
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Jul 19, 2013 8:44 am    Post subject: Reply with quote

Yes. But still, with this script CE won't close after accidentally closed form (form with onClose and closeCE pair).

CE doesn't ask for saving changed cheat table when closeCE function is called.

_________________
Back to top
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Fri Jul 19, 2013 9:14 am    Post subject: Reply with quote

I'm using it for my project..
Very useful as a shortcut :p.
for opening trainers (I require attaching to game process first).

And I tested the self Lua command and Listview (I never used it before).

I mean,
The project is using only createForm(),
So it's create for me.



TrainerTracer.png
 Description:
 Filesize:  40.21 KB
 Viewed:  18993 Time(s)

TrainerTracer.png



_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Jul 19, 2013 9:32 am    Post subject: Reply with quote

Btw. I noticed dots in above screenshoot. Steganography ?

Edit:
Quote:
your UFO script

Ohh, my "moving stars" script Razz What's your initUniverse() parameters ?

_________________


Last edited by mgr.inz.Player on Fri Jul 19, 2013 9:50 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Fri Jul 19, 2013 9:46 am    Post subject: Reply with quote

your UFO script Wink.
I have created in total 42 forms (trainers,attaching,extra tools).
so meh this is useful for me Smile.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
dudial
Newbie cheater
Reputation: 0

Joined: 15 Jul 2013
Posts: 16

PostPosted: Wed Jul 24, 2013 6:13 am    Post subject: Reply with quote

i'm getting this lua error:

Error:[string "if oldcreateForm==nil then..."]:35: attempt to index field 'MainForm' (a userdata value)
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Jul 24, 2013 7:47 am    Post subject: Reply with quote

Dudial what's your cheat engine version?
Also did you modify the script? (Don't modify it).

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
dudial
Newbie cheater
Reputation: 0

Joined: 15 Jul 2013
Posts: 16

PostPosted: Wed Jul 24, 2013 11:38 pm    Post subject: Reply with quote

i am using CE 6.2. and havent modified the script.

i thought that CE 6.2 is the problem Wink

anyway, is there a chance to get it running with 6.2 please ?
i can't use CE 6.3 atm.
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Thu Jul 25, 2013 12:45 am    Post subject: Reply with quote

Grrr, it's much longer Neutral
Anyway,
Here's one that should work with C.E 6.2.
Code:
if oldcreateForm==nil then
   oldcreateForm = createForm
   createForm = nil
end
GlobalFormTable = {}
function createForm(Visible)
   if Visible==nil then
      Visible = true
   end
   GlobalFormTable[#GlobalFormTable+1] = oldcreateForm(Visible)
   form_onClose(GlobalFormTable[#GlobalFormTable], function (sender)  -- Closing the form itself,
                                       return sender.hide() -- will result an error in function of the Form Tracer
                                    end)
   return GlobalFormTable[#GlobalFormTable]
end

EasyFormAccess = {
               _fheight = 310 ;
               _fwidth = 300 ;
               _bheight = 20 ;
               _bwidth = 70 ;
               _lvheight = 250 ;
               _lvwidth = 290 ;
               _lvccaption = "Form Caption" ;
               _lvcolumwidth = 286 ;
               _caption = "Form tarcer" ;
               _title = "All user defined forms :" ;
               _bcaption1 = "initialize" ;
               _bcaption2 = "show/hide" ;
            }
function EasyFormAccess:Start()
   self.MainForm = oldcreateForm(false)
   setProperty(self.MainForm, "BiDiMode", "bdLeftToRight")
   control_setSize(self.MainForm, self._fwidth, self._fheight)
   control_setCaption(self.MainForm, self._caption)
   self.FormLv = createListView(self.MainForm)
   setProperty(self.FormLv, 'ViewStyle', 'vsReport')
   setProperty(self.FormLv, 'RowSelect', 'True')
   setProperty(self.FormLv, 'ReadOnly', 'True')
   setProperty(self.FormLv, 'HideSelection', 'False')
   control_setSize(self.FormLv, self._lvwidth, self._lvheight)
   self.FormLvC = listview_getColumns(self.FormLv)
   self.FormLvColum = listcolumns_add(self.FormLvC)
   listcolumn_setWidth(self.FormLvColum, self._lvcolumwidth)
   listcolumn_setCaption(self.FormLvColum, self._lvccaption)
   self.FormLvI = listview_getItems(self.FormLv)
   self.Title = createLabel(self.MainForm)
   control_setCaption(self.Title, self._title)
   self.IntB = createButton(self.MainForm)
   control_setSize(self.IntB, self._bwidth,self._bheight)
   control_setCaption(self.IntB , self._bcaption1)
   control_onClick(self.IntB, function() self:Initialize() end)
   self.ShowB = createButton(self.MainForm)
   control_setSize(self.ShowB, self._bwidth, self._bheight)
   control_setCaption(self.ShowB, self._bcaption2)
   control_setEnabled(self.ShowB, false)
   control_onClick(self.ShowB, function() self:ShowSelect() end)
   form_centerScreen(self.MainForm)
   local W1,W2 = control_getSize(self.MainForm)
   local W3,W4 = control_getSize(self.Title)
   control_setPosition(self.Title, math.floor((W1 -W4 - 100 ) / 2 ), 5)
   local W1,W2 = control_getPosition(self.Title)
   local W3,W4 = control_getSize(self.Title)
   control_setPosition(self.FormLv, 5 , (W2 + W4) + 5)
   local W1,W2 = control_getPosition(self.FormLv)
   local W3,W4 = control_getSize(self.FormLv)
   local W5,W6 = control_getSize(self.MainForm)
   local W7,W8 = control_getSize(self.IntB)
   local W9,W10 = control_getSize(self.ShowB)
   control_setPosition(self.IntB, math.floor(W5 - (W7 + W9 + W9) - 2.5) , (W2 + W4) + 5)
   local W5,W6 = control_getPosition(self.IntB)
   local W7,W8 = control_getSize(self.ShowB)
   control_setPosition(self.ShowB, math.ceil(W5 + W7 + 2.5) , (W2 + W4) + 5)
end
function EasyFormAccess:AddItemsLv(FormCaption)
   local Temp
   Temp = self.FormLvI.add()
   Temp.Caption = FormCaption
end
function EasyFormAccess:AddItemsLv(FormCaption)
   local Temp
   Temp = listitems_add(self.FormLvI)
   listitem_setCaption(Temp, FormCaption)
end


function EasyFormAccess:Initialize()
   listview_clear(self.FormLv)
   if #GlobalFormTable < 1 then
      return
   end
   if #GlobalFormTable > 12 then
      listcolumn_setWidth(self.FormLvColum, 269)
   end
   for i = 1,#GlobalFormTable do
      self:AddItemsLv(control_getCaption(GlobalFormTable[i]))
   end
    control_setEnabled(self.ShowB, true)
end
function EasyFormAccess:ShowSelect()
   local index
   index = listview_getItemIndex(self.FormLv) + 1
   if GlobalFormTable[index] ~= nil then
      if control_getVisible(GlobalFormTable[index]) then
         form_hide(GlobalFormTable[index])
      else
         form_show(GlobalFormTable[index])
      end
   end
end
EasyFormAccess:Start()
function TrainerTracerMenu()
   if control_getVisible(EasyFormAccess.MainForm) then
      form_hide(EasyFormAccess.MainForm)
   else
      form_show(EasyFormAccess.MainForm)
   end
end

CEMenu = menu_getItems(form_getMenu(getMainForm()))
TrainerTracer = createMenuItem(CEMenu)
menuItem_add(CEMenu, TrainerTracer)
menuItem_setCaption(TrainerTracer, "Trainer Tracer")
menuItem_onClick(TrainerTracer, TrainerTracerMenu)

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
dudial
Newbie cheater
Reputation: 0

Joined: 15 Jul 2013
Posts: 16

PostPosted: Thu Jul 25, 2013 2:35 am    Post subject: Reply with quote

thanks ! working great Very Happy
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