View previous topic :: View next topic |
Author |
Message |
Derpicus Newbie cheater Reputation: 1
Joined: 30 Mar 2016 Posts: 15
|
Posted: Sat Apr 02, 2016 6:01 am Post subject: Auto-Untick Checkboxes [Resolved] |
|
|
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 |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sat Apr 02, 2016 6:30 am Post subject: |
|
|
False is a variable
false is a literal
|
|
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: Sat Apr 02, 2016 6:39 am Post subject: |
|
|
Lua is case-sensitive: false is a reserved word, but False and FALSE are two other different identifiers.
_________________
|
|
Back to top |
|
|
Derpicus Newbie cheater Reputation: 1
Joined: 30 Mar 2016 Posts: 15
|
Posted: Sat Apr 02, 2016 6:48 am Post subject: |
|
|
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 |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Apr 02, 2016 7:09 am Post subject: |
|
|
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 |
|
|
Derpicus Newbie cheater Reputation: 1
Joined: 30 Mar 2016 Posts: 15
|
Posted: Sat Apr 02, 2016 7:16 am Post subject: |
|
|
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 |
|
|
|