|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
alanze Advanced Cheater Reputation: 3
Joined: 03 Oct 2012 Posts: 50
|
Posted: Wed Oct 03, 2012 2:04 pm Post subject: CETrainer Graphical Interface bug? |
|
|
Please check out this test script (it's a .frm and .lua).
The trainer interface is not updated while a lua script is running.
I have a text and I change it's color to red, then I do a sleep
for 4 seconds and I change the color back to default.
The interface wil show only the default color, but the red should
be displayed for 4 seconds.
How could I workaround this problem?
(CE 6.2)
(Test.frm.cea, this is not a cea file, it's a form file so delete the .cea extension)
(form files are not allowed as attachments.)
This is the lua:
infoMessage=[[By showing this message the script
will pause (script real sleep) and the
graphical interface will get updated,
now the font color is red
and the checkbox is checked.]]
labelFont=control_getFont(CETrainer_CELabel)
function CEButtonClick(sender)
font_setColor(labelFont, 0x0000ff)
checkbox_setState(CETrainer_CECheckbox, cbChecked)
--control_setEnabled(CETrainer_CECheckbox, false) --uncoment this two lines to
--control_setEnabled(CETrainer_CECheckbox, true) --update the checkbox current state
--showMessage(infoMessage) --uncoment this to update the font color and the checkbox state
sleep(4000)
checkbox_setState(CETrainer_CECheckbox, cbUnchecked)
font_setColor(labelFont, 0x000000)
end
Description: |
This is the form (delete the .cea extension) |
|
Download |
Filename: |
Test.frm.cea |
Filesize: |
716 Bytes |
Downloaded: |
1090 Time(s) |
Description: |
|
Download |
Filename: |
Test.lua |
Filesize: |
748 Bytes |
Downloaded: |
919 Time(s) |
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Thu Oct 04, 2012 2:40 am Post subject: |
|
|
add a "ProcessMessages()" Line in front of the sleep so the gui gets updated
Note though that ProcessMessages() can cause a click on objects in the gui if the user is fast enough , so it's recommended to disable the objects before calling this (or add in code to take care of that rare occasion)
_________________
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 |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Thu Oct 04, 2012 5:09 am Post subject: |
|
|
@alanze
can be handy (paste2.org for Syntax Highlighting):
Code: | infoMessage=[[By showing this message the script
will pause (script real sleep) and the
graphical interface will get updated,
now the font color is red
and the checkbox is checked.]]
labelFont=control_getFont(CETrainer_CELabel)
function changeColorTimer(objTimer)
-- change font color
font_setColor(labelFont, 0x000000)
-- CECheckbox enabled and Unchecked
control_setEnabled(CETrainer_CECheckbox, true)
checkbox_setState(CETrainer_CECheckbox, cbUnchecked)
-- enable CEButton
control_setEnabled(CETrainer_CEButton,true)
--destroy timer
object_destroy(objTimer)
end
function CEButtonClick(sender)
--change font color
font_setColor(labelFont, 0x0000ff)
-- CECheckbox disabled and Checked
checkbox_setState(CETrainer_CECheckbox, cbChecked)
control_setEnabled(CETrainer_CECheckbox, false)
-- disable CEButton
control_setEnabled(CETrainer_CEButton,false)
-- create timer
local timer = createTimer(nil,false)
timer_setInterval(timer,4000)
timer_onTimer(timer,changeColorTimer)
timer_setEnabled(timer,true)
end
|
_________________
|
|
Back to top |
|
|
alanze Advanced Cheater Reputation: 3
Joined: 03 Oct 2012 Posts: 50
|
Posted: Thu Oct 04, 2012 1:15 pm Post subject: CETrainer Graphical Interface |
|
|
Thanks for the answers.
They've solved my problem.
This is my lua using DarkByte's method:
Code: |
labelFont=control_getFont(CETrainer_CELabel)
function CEButtonClick(sender)
font_setColor(labelFont, 0x0000ff)
checkbox_setState(CETrainer_CECheckbox, cbChecked)
processMessages()
sleep(4000)
checkbox_setState(CETrainer_CECheckbox, cbUnchecked)
font_setColor(labelFont, 0x000000)
end
|
And using mgr.inz.Player's method:
Code: |
labelFont = control_getFont(CETrainer_CELabel)
function changeColorTimer(objTimer)
checkbox_setState(CETrainer_CECheckbox, cbUnchecked)
font_setColor(labelFont, 0x000000)
object_destroy(objTimer)
end
function CEButtonClick(sender)
font_setColor(labelFont, 0x0000ff)
checkbox_setState(CETrainer_CECheckbox, cbChecked)
local timer = createTimer(nil,false)
timer_setInterval(timer,4000)
timer_onTimer(timer,changeColorTimer)
timer_setEnabled(timer,true)
end
|
The first method is very simple and elegant,
the second is longer and more comlicated,
however I will use the second one because,
while the sleep() function is running the trainer stays freezed
(even the window cannot be dragged).
|
|
Back to top |
|
|
|
|
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
|
|