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 do I properly gray out buttons ect?

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

Joined: 05 Nov 2014
Posts: 130

PostPosted: Sat Oct 31, 2015 3:04 pm    Post subject: How do I properly gray out buttons ect? Reply with quote

Let's say I have 2 Buttons called CEButtonGrayout and CEButtonRestore and a text field (is that how you call it?) called CEEditHP.

Code:
function CEButtonGrayoutClick(sender)
  setProperty(UDF1.CEEditHP,"Enabled", False)
end
function CEButtonRestoreClick(sender)
  setProperty(UDF1.CEEditHP,"Enabled", True)
end


If I now press the grayout button the text field gets grayed out as it should. But pressing the restore button afterwards doesn't revert the change.
Even more weird is the fact that if I press the restore button without having pressed the grayout button before, it grays out the text flied although it's the exact opposite of what it should do. Am I doing something wrong or is that a bug?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Oct 31, 2015 3:10 pm    Post subject: Reply with quote

Launch "Lua Engine" window and paste this and click "Execute"
Code:
return type(True), type(False), type(true), type(false)




Then try this:
Code:
return tostring(True), tostring(False), tostring(true), tostring(false)



I've got this:
Code:
return type(True), type(False), type(true), type(false)
:nil
:nil
:boolean
:boolean


return tostring(True), tostring(False), tostring(true), tostring(false)
:nil
:nil
:true
:false


And that means, True is a variable, in this case uninitialized variable, true is a keyword.






Also, properties can be easily accessed since CE6.4:
Code:
function CEButtonGrayoutClick(sender)
  UDF1.CEEditHP.Enabled=false
end

function CEButtonRestoreClick(sender)
  UDF1.CEEditHP.Enabled=true
end

_________________


Last edited by mgr.inz.Player on Sat Oct 31, 2015 3:16 pm; edited 2 times in total
Back to top
View user's profile Send private message MSN Messenger
LastExceed
Expert Cheater
Reputation: 1

Joined: 05 Nov 2014
Posts: 130

PostPosted: Sat Oct 31, 2015 3:14 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
Launch Lua engine and paste this and click "Execute"
Code:
return type(True), type(False), type(true), type(false)


Didn't change anything, problem still persists.

Code:

:nil
:nil
:boolean
:boolean

This is the output of the LUA engine. Can you explain what that means (both your code and the output)?
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat Oct 31, 2015 3:16 pm    Post subject: Reply with quote

He's trying to tell you that "True" is not the proper syntax.
"True" is a variable name. The word you want to use is "true".
Lowercase!
Back to top
View user's profile Send private message
LastExceed
Expert Cheater
Reputation: 1

Joined: 05 Nov 2014
Posts: 130

PostPosted: Sat Oct 31, 2015 3:19 pm    Post subject: Reply with quote

Zanzer wrote:
He's trying to tell you that "True" is not the proper syntax.
"True" is a variable name. The word you want to use is "true".
Lowercase!


aaaaah, now I get it! A good joke actually, too bad newbies won't understand it.

Anyway thanks for clearing this up, works now Smile
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Oct 31, 2015 3:22 pm    Post subject: Reply with quote

yeah. Also, you don't need setProperty if you use CE6.4 or newer.
_________________
Back to top
View user's profile Send private message MSN Messenger
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