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 


Form-Color Button with simple codes

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sun Feb 02, 2020 10:11 pm    Post subject: Form-Color Button with simple codes Reply with quote

I am updating this topic from the beginning again.
Version: 2

Add and use colored buttons to your trainer.

To use the code, you need to process the following data respectively;
Code:
createColorButton(form,hg,wd,lf,tp,cpt,pct1,pct2,pctShd,onclk)


form: Your form name. (UDF1, CETrainer etc.)
hg: Height of the button.
wd: The width of the button.
lf: The left of the button.
tp: The top of the button.
pct1: The picture that should be in the "on" position.
pct2: The picture that should be in the "off" position.
pctShd: Shadow effect for button (image)
onclk: The name of the function that should be activated when the button is clicked.

( A small image archive is shared below.
Download it and add it to Trainer via CE >> Table >> Add file. )

Here is a usage example;
Code:
f1 = createForm(true)
f1.Position = poDesktopCenter
f1.Width = 320
f1.Height = 200
f1.caption = "Color Button"

function createColorButton(form,hg,wd,lf,tp,cpt,pct1,pct2,pctShd,onclk)
local owner = { }
owner.img1 = createImage(form)
owner.img1.Height=hg owner.img1.Width=wd
owner.img1.Left=lf owner.img1.Top=tp
owner.img1.Stretch = true
owner.img1.Picture=pct1
owner.Picture =owner.img1.Picture

owner.img2 = createImage(form)
owner.img2.Height=tonumber(hg) + 3
owner.img2.Width=wd
owner.img2.Left=lf
owner.img2.Top=tp
owner.img2.Stretch = true
owner.img2.Picture=pctShd

owner.lbl1 = createLabel(form)

owner.lbl1.AutoSize = false
owner.lbl1.Alignment= "taCenter"
owner.lbl1.Height=owner.img1.Height - 16
owner.lbl1.Width=owner.img1.Width - 8
owner.lbl1.Left=owner.img1.Left + 4
owner.lbl1.Top=owner.img1.Top + 8
owner.lbl1.Font.Size=11
owner.lbl1.Font.Style="fsBold"
owner.lbl1.OptimalFill = true
owner.lbl1.caption=(cpt.." OFF") owner.lbl1.Cursor= -21
owner.lbl1.bringToFront()

owner.lbl1.OnClick=function(sender)
if owner.lbl1.caption==(cpt.." OFF") then
owner.lbl1.caption=(cpt.." ON")
owner.img1.Picture=pct2
onclk(sender)
else
owner.lbl1.caption=(cpt.." OFF")
owner.img1.Picture=pct1
onclk(sender)
end
end
end

function crtPicture(pct)
local p = createPicture()
fstream = findTableFile(pct).Stream
p.loadFromStream(fstream)
return p
end
--##################################################

aa1 = 1
aa2 = 1
aa3 = 1

function printer1(sender)
 if aa1==1 then
  print(1,sender.Caption)
  aa1=2
 else
  print(2,sender.Caption)
  aa1=1
 end
end

function printer2(sender)
 if aa2==1 then
  print(11,sender.Caption)
  aa2=2
 else
  print(12,sender.Caption)
  aa2=1
 end
end

function printer3(sender)
 if aa3==1 then
  print(21,sender.Caption)
  aa3=2
 else
  print(22,sender.Caption)
  aa3=1
 end
end

p1 = crtPicture("Btn1.png")
p2 = crtPicture("Btn2.png")
p3 = crtPicture("BtnShdw1.png")

createColorButton(f1,30,100,30,40,"Hack 1",p1,p2,p3,printer1)
createColorButton(f1,40,120,180,60,"Hack 2",p1,p2,p3,printer2)
createColorButton(f1,50,110,30,90,"Hack 3",p1,p2,p3,printer3)




If you want more variety for the buttons, feel free to write in the comments.

Enjoy it! Wink



BtnShdw1.png
 Description:
 Filesize:  2.74 KB
 Viewed:  1780 Time(s)

BtnShdw1.png



Btn3.png
 Description:
 Filesize:  59.69 KB
 Viewed:  1780 Time(s)

Btn3.png



Btn1.png
 Description:
 Filesize:  53.15 KB
 Viewed:  1780 Time(s)

Btn1.png



Btn2.png
 Description:
 Filesize:  33.35 KB
 Viewed:  1780 Time(s)

Btn2.png



Ek1.png
 Description:
 Filesize:  31.13 KB
 Viewed:  7253 Time(s)

Ek1.png



_________________
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
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sun Dec 31, 2023 9:06 am    Post subject: Reply with quote

Update: V2
_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions 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