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 


"getSettings" not working in .EXE (save/load)

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

Joined: 27 Aug 2014
Posts: 36

PostPosted: Sat Feb 18, 2017 4:55 pm    Post subject: "getSettings" not working in .EXE (save/load) Reply with quote

I'm having an issue where all of my settings aren't being saved/loadable once i export the cheat table to .CETRAINER or .exe. They work fine in a regular .CT file. Do i have to specify a file location now that it's an .exe or anything like that?

Here's what they look like for my two main objects, checkboxes and editboxes:
Code:
function Save()
settings=getSettings('test')

if s1  == 1 then settings.Value['checkbox'] =1 else    settings.Value['checkbox'] = 0 end // another function sets s1 to 1 when the checkbox is ticked

settings.Value['editbox'] = editbox.text //just record the current value in the box
return
end

function Load()
settings=getSettings('test')

if settings.Value[checkbox'] == '1' then checkbox_setState(checkbox,1)     else checkbox_setState(checkbox,0) end  //a timer calls a function every second which acts based on whether the checkbox is ticked or not

if settings.Value['editbox.text'] ~= nil then editbox.text =      settings.Value['editbox.text'] end //just write the value in the edit box
return
end


I've tried to search and look around, but i can't really find anything pertaining to my problem. And i think once i tried to export it to an .exe and ran it, my .CT saves/loads stopped working as well, and i had to change getSettings('test') to ('test1') to get them to load again. I've also tried using a new getSettings name as well for the .exe, and running it as admin, but nothing doing. This code works perfectly for me in the regular .CT.

I'm not really sure how i would go about fixing this. I don't know lua well enough to try read.io to save/load my settings.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Sat Feb 18, 2017 5:07 pm    Post subject: Reply with quote

Try outputting some information with print and see what the results are, and if it prints anything at all
_________________
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
beagle
Cheater
Reputation: 0

Joined: 27 Aug 2014
Posts: 36

PostPosted: Sat Feb 18, 2017 5:15 pm    Post subject: Reply with quote

This is really strange. My regular .CT's normally save/load just fine, but now it's only working on the second time i click execute script. The first time, i get no response inside the save/load functions from print, and then i click run script again so another trainer pops up, and they work, but only on the new trainer window. When i close out CE fully and then reload the .CT it starts all over again.

Now i'm really confused.
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 Feb 18, 2017 5:25 pm    Post subject: Reply with quote

Quote:
...
settings.Value['editbox'] = editbox.text
...
if settings.Value['editbox.text'] ~= nil then editbox.text = settings.Value['editbox.text'] end
...


So, what is it? "editbox" or "editbox.text", you have to pick only one.



Just tested this script, everything works (as CT, CETRAINER and EXE):
Code:
function CECheckbox1Change(sender)
  if sender.Checked then s1=1 else s1=0 end
end


settings=getSettings('test')

function Save()
  settings.Value['checkbox'] = s1==1 and '1' or '0'
  settings.Value['editbox'] = UDF1.CEEdit1.Text
end

function Load()
  UDF1.CECheckbox1.Checked = settings.Value['checkbox']=='1'
  if settings.Value['editbox'] ~= nil then
    UDF1.CEEdit1.Text = settings.Value['editbox']
  end
end

function FormClose(sender)
  Save()
  closeCE()
  return caFree --Possible options: caHide, caFree, caMinimize, caNone
end

Load()

UDF1.show()

_________________
Back to top
View user's profile Send private message MSN Messenger
beagle
Cheater
Reputation: 0

Joined: 27 Aug 2014
Posts: 36

PostPosted: Sat Feb 18, 2017 5:39 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
Quote:
...
settings.Value['editbox'] = editbox.text
...
if settings.Value['editbox.text'] ~= nil then editbox.text = settings.Value['editbox.text'] end
...


So, what is it? "editbox" or "editbox.text", you have to pick only one.



Just tested this script, everything works (as CT, CETRAINER and EXE):


Oops sorry i made a typo, i was trying to simplify all of my stuff. They are correct at least in consistency. Thank you for confirming they are supposed to work, i'll check over all of my code.

Edit: Ok it's working perfectly now, thanks a ton! I think what happened is i ended up shifting my button code up too far, or i had an extra whole timer function in there that i forgot to remove, but it wasnt calling save/load buttons, so i'm still unsure, but its working either way. :)
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