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 


slider to increase decrease values

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
mordax
Expert Cheater
Reputation: 1

Joined: 16 Apr 2010
Posts: 121

PostPosted: Wed Dec 21, 2011 1:54 am    Post subject: slider to increase decrease values Reply with quote

I don't know much about lua, but it seem to be the only way in CE. what i want to make is a simple trainer with a slider, where slider adjusts value of the address in cheat list.

how would i go about doing that ?
in trainer generator i added the slider, but only option to make it do something is lua, but i don't know how.
any help please ? i would really like someone to post whole script that increases / decerases value using slider. from there i would probably understand the code and modify the value and address (obviously in example these things are just .. examples).
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Dec 21, 2011 12:43 pm    Post subject: Reply with quote

trackbar_getPosition(trackbar) is the main function you will need.
If you add the trackbar with the formdesigner you can set the min and max range there and write an onChange event (click the button with ... two times to open the editor for that code)

I've attached an example with a trackbar. Check the form and component properties and check the code (I left some comments)

ask if you don't get something



trackbarexample.CT
 Description:

Download
 Filename:  trackbarexample.CT
 Filesize:  1.51 KB
 Downloaded:  1823 Time(s)


_________________
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


Last edited by Dark Byte on Wed Dec 21, 2011 2:44 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
BusterNoob
How do I cheat?
Reputation: 0

Joined: 18 Dec 2011
Posts: 5

PostPosted: Wed Dec 21, 2011 2:30 pm    Post subject: Reply with quote

Hey this is something like what i was after... now without taking over this post Dark Byte, how could i make this into just a stand alone speedhack .exe.
I understand this example, but not how to turn it into something else.... an example of turning it into a speedhack would be a great learning curve for me to work from Confused
Thnx
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Wed Dec 21, 2011 2:36 pm    Post subject: Reply with quote

in the onChange event, or the button, use this code:

Code:

newspeed=trackbar_getPosition(TRAINERFORM_CETrackBar1)
speedhack_setSpeed(newspeed)


Note though that the trackbar only returns full integers. If you wish to use floating point values you have to do something like this:
newspeed=trackbar_getPosition(TRAINERFORM_CETrackBar1) / 10
and set the max to 1000 instead of 100

And you can test the trainer by just renaming the .CT to .CETRAINER and run that, no need to go through the trainer script generator or save as a .exe for now (I do recommend adding an onClose event to the window and add closeCE() to the onclose function)
For speedhack your trainer obviously needs to be attached to a process, so you'll need to add that code as well (adding to the autoattach list, automatically generated trainerscripts contain this code that you can look at)

I've uploaded the trackbar example as a .CETRAINER with the needed change(OnClose)



trackbarexample.CETRAINER
 Description:

Download
 Filename:  trackbarexample.CETRAINER
 Filesize:  1.62 KB
 Downloaded:  1757 Time(s)


_________________
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


Last edited by Dark Byte on Wed Dec 21, 2011 3:07 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
BusterNoob
How do I cheat?
Reputation: 0

Joined: 18 Dec 2011
Posts: 5

PostPosted: Wed Dec 21, 2011 3:04 pm    Post subject: Reply with quote

Excellent thanks very much Very Happy
Back to top
View user's profile Send private message
mordax
Expert Cheater
Reputation: 1

Joined: 16 Apr 2010
Posts: 121

PostPosted: Sun Dec 25, 2011 4:36 am    Post subject: Reply with quote

thanks, looks good, but im still confused. i haven't had any experience with lua at all.
lets say i have pointer in my cheat list and its 1 byte value (0 - 255), how could i make trackbar to change that value from 0 to 255 ?

i don't understand where i should put the values and how do i make trackbar to select that specific pointer.

so if i set trackbar somewhere in middle and click "do something" then it would change value on that pointer to 122 (something in middle). or if i put trackbar to maximum, then it would set that value to 255.

or is there option to make "edit" box, where i can write in the value instead of having trackbar ? both would work fine.
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