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 


Nil Value Error

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
iGuzmonJ
How do I cheat?
Reputation: 0

Joined: 24 Oct 2014
Posts: 9

PostPosted: Sat Feb 21, 2015 3:53 pm    Post subject: Nil Value Error Reply with quote

Everytime i click on my button to toggle on and off the cheat, all i get is a nil value error. I am not sure on how to fix this. Here is my code, and yes, i do have all of my stuff named correctly.

Code:
function CEToggleBox1Change(sender)
         if (checkbox_getState(UDF1.CEToggleBox1) == 1) then
         autoAssemble([[
                        aobscan(grenaderange, 00 00 B4 42 00 00 00 00 00 00 00 00 00 00 00 00)
                        label(_grenaderange)
                        registersymbol(_grenaderange)
                        grenaderange:
                        _grenaderange:
                        db FF E3 0B 54
                        ]])
         else
         autoAssemble([[
                        _grenaderange:
                        db 00 00 B4 42
                        unregistersymbol(_grenaderange)
                        ]])
         end
end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Feb 21, 2015 3:58 pm    Post subject: Reply with quote

make sure that lua script has executed before you toggle the button. (and that the eventname function matches the function name)
If you don't execute the lua script before accessing the form, you'll get nil errors

hint: instead of UDF1.CEToggleBox1 you can use sender as well. e.g: if (sender.Checked) then ...

_________________
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
iGuzmonJ
How do I cheat?
Reputation: 0

Joined: 24 Oct 2014
Posts: 9

PostPosted: Sat Feb 21, 2015 4:24 pm    Post subject: Reply with quote

Sorry for wasting your time, it appears that i slightly spelled one of the functions wrong haha. Thank you anyways. Well since you're here now, could ya help me with this last thing? I took your example for the code to put for the custom crosshair.
Code:
h=createD3DHook()
p=createPicture()
p.loadFromFile([[‪C:\Users\iGuzmonJ\Desktop\KTng66gTq.png]])
t=h.createTexture(p)
s=h.createSprite(t)
s.x=-1
s.y=-1


Everything is typed right, i double checked this time xD. When i click execute, i get an error saying it can't open the file. Any ideas why?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Feb 21, 2015 4:32 pm    Post subject: Reply with quote

‪C:\Users\iGuzmonJ\Desktop\KTng66gTq.png really exists?
_________________
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
iGuzmonJ
How do I cheat?
Reputation: 0

Joined: 24 Oct 2014
Posts: 9

PostPosted: Sat Feb 21, 2015 4:44 pm    Post subject: Reply with quote

Yeah it does, was just too lazy to rename the file atm. I renamed it and still no success. I went to the properties for it copied the location of it also and pasted it. Still no results.
Back to top
View user's profile Send private message
Bjarnevk
How do I cheat?
Reputation: 0

Joined: 11 Feb 2015
Posts: 1

PostPosted: Mon Feb 23, 2015 8:11 am    Post subject: Reply with quote

Where is the source file saved of your script?

What I do is, put the picture in the same directory as the script and do
p.loadFromFile([[KTng66gTq.png]])
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