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 


How can I do this?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Roman012
!BEWARE! Deletes post on answer
Reputation: 0

Joined: 25 Dec 2022
Posts: 24

PostPosted: Tue Jan 03, 2023 6:36 am    Post subject: How can I do this? Reply with quote

how do I make it so that when I hold down the left mouse button on the CEButton1 buttons, the value is added?

If you can tell me please

function UDF1_CEButton1Click(sender)
UDF1_CELabel1.Caption = math.floor(UDF1_CELabel1.Caption + 1)
end



1.png
 Description:
 Filesize:  415 Bytes
 Viewed:  1333 Time(s)

1.png




Last edited by Roman012 on Tue Jan 03, 2023 8:25 am; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Tue Jan 03, 2023 7:00 am    Post subject: Re: How can I do this? Reply with quote

Roman012 wrote:
how do I make it so that when I hold down the left mouse button on the CEButton1 buttons, the value is added?

If you can tell me please

function UDF1_CEButton1Click(sender)
UDF1_CELabel1.Caption = math.floor(UDF1_CELabel1.Caption + 1)
end


use a timer.
On mousedown start the timer that will increase the valje every half a second or faster (you can update it runtime)

and on mouseup stop the timer

_________________
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
Roman012
!BEWARE! Deletes post on answer
Reputation: 0

Joined: 25 Dec 2022
Posts: 24

PostPosted: Tue Jan 03, 2023 8:19 am    Post subject: Reply with quote

That's about how it works

is it possible in another way so as not to create a bunch of timers?


function UDF1_CETimer1Timer(sender)
if (isKeyPressed(VK_LBUTTON)) then
UDF1_CELabel1.Caption = math.floor(UDF1_CELabel1.Caption + 1)
end
end
function UDF1_CETimer2Timer(sender)
if (isKeyPressed(VK_LBUTTON)) then
UDF1_CELabel1.Caption = math.floor(UDF1_CELabel1.Caption - 1)
end
end

---XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX--
function UDF1_CEButton1MouseEnter(sender)
UDF1_CETimer1.Enabled = true
end
function UDF1_CEButton1MouseLeave(sender)
UDF1_CETimer1.Enabled = false
end
function UDF1_CEButton2MouseEnter(sender)
UDF1_CETimer2.Enabled = true
end
function UDF1_CEButton2MouseLeave(sender)
UDF1_CETimer2.Enabled = false
end



1.png
 Description:
 Filesize:  23.82 KB
 Viewed:  1300 Time(s)

1.png


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

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

PostPosted: Tue Jan 03, 2023 6:43 pm    Post subject: Reply with quote

you just need 1 timer and a variable to remind you which button is the active one
_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Jan 03, 2023 9:03 pm    Post subject: Reply with quote

I did it without a timer.

Code:
UDF1.Show()

current_value = 0

function UDF1_CEButton1Click(sender)
 current_value = current_value - 1
 UDF1.CELabel1.Caption = current_value
end

function UDF1_CEButton2Click(sender)
 current_value = current_value + 1
 UDF1.CELabel1.Caption = current_value
end

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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