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 


Auto-Untick Checkboxes [Resolved]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Derpicus
Newbie cheater
Reputation: 1

Joined: 30 Mar 2016
Posts: 15

PostPosted: Sat Apr 02, 2016 6:01 am    Post subject: Auto-Untick Checkboxes [Resolved] Reply with quote

Alright, so I want to add error-handling by making it to where when I tick ONE checkbox, it unticks another before enabling the script. I have everything else done, but simply need to know how to untick a box.

I was assuming it was something like CECheckBox1.Checked = False, but that didn't work. Any ideas on how to do this, properly?


Last edited by Derpicus on Sat Apr 02, 2016 7:17 am; edited 5 times in total
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 Apr 02, 2016 6:30 am    Post subject: Reply with quote

False is a variable
false is a literal
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 Apr 02, 2016 6:39 am    Post subject: Reply with quote

Lua is case-sensitive: false is a reserved word, but False and FALSE are two other different identifiers.
_________________
Back to top
View user's profile Send private message MSN Messenger
Derpicus
Newbie cheater
Reputation: 1

Joined: 30 Mar 2016
Posts: 15

PostPosted: Sat Apr 02, 2016 6:48 am    Post subject: Reply with quote

mgr.inz.Player wrote:
Lua is case-sensitive: false is a reserved word, but False and FALSE are two other different identifiers.

My exact code is:
Code:

function CEToggleBox7Change(sender)
  getMemRecByDesc = getAddressList().getMemoryRecordByDescription
  MemoryRecord001 = getMemRecByDesc("PCT")
  showMessage(MemoryRecord001.Value)
  if MemoryRecord001.Value > "0" then

    CECheckBox6.Checked = false

  else
  end
end

What's wrong with this?

I also see that checkbox_setState(checkboxes[1], 0) is a possible solution, though how would it be implemented? (Looked @ the main.lua page).

The error says "Error:[string "function CECheckBox6Change(sender)
..."]:223: attempt to index a nil value (global 'CECheckBox6')"
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 Apr 02, 2016 7:09 am    Post subject: Reply with quote

this
Code:
if MemoryRecord001.Value > "0" then


should be
Code:
if tonumber(MemoryRecord001.Value) > 0 then




this
Code:
CECheckBox6.Checked = false


should be (assuming your form is UDF1)
Code:
UDF1.CECheckBox6.Checked = false

_________________
Back to top
View user's profile Send private message MSN Messenger
Derpicus
Newbie cheater
Reputation: 1

Joined: 30 Mar 2016
Posts: 15

PostPosted: Sat Apr 02, 2016 7:16 am    Post subject: Reply with quote

mgr.inz.Player wrote:
this
Code:
if MemoryRecord001.Value > "0" then


should be
Code:
if tonumber(MemoryRecord001.Value) > 0 then




this
Code:
CECheckBox6.Checked = false


should be (assuming your form is UDF1)
Code:
UDF1.CECheckBox6.Checked = false


It works, perfectly! I normally just stick to using a CT, but now I know how to make decent trainers thanks to all of your help. Thank you.
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