| View previous topic :: View next topic |
| Author |
Message |
Wiccaan I post too much
Reputation: 79
Joined: 25 Jan 2006 Posts: 4827 Location: 127.0.0.1
|
Posted: Thu Jan 13, 2011 11:20 pm Post subject: Minesweeper Lua Trainer Example |
|
|
This is a simple +2 options trainer example showing off how to create a small gui using Cheat Engine 6's new Lua engine integration. The trainer is not meant to be advanced, this is mearly a demonstration showing off the new features of Cheat Engine 6 with Lua scripting.
| Code: | --[[
Winmine.exe (Windows XP Minesweeper) Lua Trainer Example
by atom0s [Wiccaan]
This is a demonstrational Lua script showing off
what Cheat Engine 6.0 can do with Lua.
]]--
--
-- DO NOT EDIT BELOW THIS LINE!!
--
local Trainer_Example = { }
----------------------------------------------------------------------------------
-- func: InitButton( .. )
-- desc: Wraps button creation and setup functions for smaller code.
----------------------------------------------------------------------------------
function InitButton( form, caption, x, y, w, h, func )
local button = createButton( form );
if( button == nil ) then
return nil;
end
control_setCaption( button, caption );
control_setPosition( button, x, y );
control_setSize( button, w, h );
control_onClick( button, func );
return button;
end
----------------------------------------------------------------------------------
-- func: InitLabel( .. )
-- desc: Wraps label creation and setup functions for smaller code.
----------------------------------------------------------------------------------
function InitLabel( form, x, y, text )
local label = createLabel( form );
if( label == nil ) then
return nil;
end
control_setCaption( label, text );
control_setPosition( label, x, y );
return label;
end
----------------------------------------------------------------------------------
-- func: Trainer_Example.Main( .. )
-- desc: Prepares script for overall actions.
----------------------------------------------------------------------------------
function Trainer_Example.Main( )
-- Main trainer form pointer.
Trainer_Example.Form = createForm( true );
-- Create buttons.
Trainer_Example.btnFlags = InitButton( Trainer_Example.Form, "Toggle Inf. Flags", 1, 1, 150, 30, Trainer_Example.OnFlagsClicked );
Trainer_Example.btnTimer = InitButton( Trainer_Example.Form, "Toggle Unlimited Time", 155, 1, 150, 30, Trainer_Example.OnTimeClicked );
-- Create info label.
Trainer_Example.lblInfo = InitLabel( Trainer_Example.Form, 5, 175,
"This is an example Lua trainer written using Cheat Engine 6.\n" ..
"Coded by: atom0s [Wiccaan]"
);
-- Create option booleans.
Trainer_Example.bFlagsEnabled = false;
Trainer_Example.bTimerEnabled = false;
-- Set form caption.
control_setCaption( Trainer_Example.Form, "Minesweeper Lua Trainer Example" );
return true;
end
----------------------------------------------------------------------------------
-- func: Trainer_Example.OnFlagsClicked( .. )
-- desc: Toggles infinite flags when flag button is clicked.
----------------------------------------------------------------------------------
function Trainer_Example.OnFlagsClicked()
Trainer_Example.bFlagsEnabled = not Trainer_Example.bFlagsEnabled;
if( Trainer_Example.bFlagsEnabled == true ) then
autoAssemble( "winmine.exe+346E:\n" ..
"db 90 90 90 90 90 90"
);
else
autoAssemble( "winmine.exe+346E:\n" ..
"db 01 05 94 51 00 01"
);
end
end
----------------------------------------------------------------------------------
-- func: Trainer_Example.OnTimeClicked( .. )
-- desc: Toggles unlimited time when time button is clicked.
----------------------------------------------------------------------------------
function Trainer_Example.OnTimeClicked()
Trainer_Example.bTimerEnabled = not Trainer_Example.bTimerEnabled;
if( Trainer_Example.bTimerEnabled == true ) then
autoAssemble( "winmine.exe+2FF5:\n" ..
"db 90 90 90 90 90 90"
);
else
autoAssemble( "winmine.exe+2FF5:\n" ..
"db FF 05 9C 57 00 01"
);
end
end
-- Execute our script.
Trainer_Example.Main(); |
_________________
- Retired. |
|
| Back to top |
|
 |
Recifense Grandmaster Cheater Supreme
Reputation: 70
Joined: 17 Mar 2008 Posts: 1739 Location: Recife - Pernambuco - Brazil
|
Posted: Fri Jan 14, 2011 7:02 pm Post subject: |
|
|
Congratulations.
It is a very nice script. I am gonna use part of it in my next table.
Cheers!
|
|
| Back to top |
|
 |
Popinman32 Cheater
Reputation: 0
Joined: 23 Jul 2010 Posts: 29
|
|
| Back to top |
|
 |
Wiccaan I post too much
Reputation: 79
Joined: 25 Jan 2006 Posts: 4827 Location: 127.0.0.1
|
|
| Back to top |
|
 |
kingjordy3 How do I cheat?
Reputation: 0
Joined: 21 Jul 2011 Posts: 1
|
Posted: Thu Jul 21, 2011 1:08 am Post subject: |
|
|
damn u people are really talented i dont understand anything bout this script lol.. and i dont understand most tuts eighter =/ the only things i know how to do is like change values for like hp or infinit ammo or stuff like that .
|
|
| Back to top |
|
 |
DrWeazle How do I cheat?
Reputation: -1
Joined: 15 Feb 2012 Posts: 7
|
Posted: Wed Feb 15, 2012 5:03 pm Post subject: |
|
|
| What's the "db 90 90 90 90 90 90", is that the value your writing? and if i wanted to write the value of radioGroup's current index what would be the code for that?
|
|
| Back to top |
|
 |
booingthetroll Advanced Cheater
Reputation: 0
Joined: 30 Aug 2011 Posts: 73 Location: ::1
|
Posted: Sun Apr 22, 2012 3:50 pm Post subject: |
|
|
@Dr
db 90 90 90 90 90 90 writes NOP 6 at where you're injecting.
@Wiccaan
Nice script. My one inquiry is, why did you add form as a parameter? Why can you not make it default, creating the form before those functions?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 181
Joined: 09 May 2003 Posts: 13596 Location: The netherlands
|
Posted: Sun Apr 22, 2012 5:59 pm Post subject: |
|
|
It doesn't really matter if the functions are declared before form is defined, if form becomes a global variable, once the function is executed it know what form is.
But the main point here is that it's object oriented and supports multiple forms without having to write separate functions for each form
_________________
Do not ask me about online cheats. I don't know any and wont help finding them. |
|
| Back to top |
|
 |
majmun Newbie cheater
Reputation: 0
Joined: 22 Dec 2012 Posts: 11
|
Posted: Wed Dec 05, 2012 3:30 pm Post subject: Re: Minesweeper Lua Trainer Example |
|
|
What to say...Briliant! You're da man Wiccaan
|
|
| Back to top |
|
 |
|