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 


Getting variables from text file

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Jan 12, 2017 9:40 am    Post subject: Getting variables from text file Reply with quote

Hi there,

Code:
function checkIt()
 tr_check = UDF1.CELabel1.Caption
 if tr_check == "Changeable" then
 f = io.open("TrainerStuffs.txt", "r")
 else
 f = io.open("TrainerFixed.txt", "r")
 end
      -- local f = io.open(file, "rb")
 if f ~= nil then
// ....get variables from opened file
 cekT = f:read("*line")
 UDF1.CELabel1.Caption = cekT
 else
 showMessage("Can't find data file. Trainer properties set to last saved")
 return
 end
 if cekT == "Changeable" then
 UDF1.CEButton1.Enabled = true
 else
 UDF1.CEButton1.Enabled = false
 end
end

checkIt()


Why the function always open "TrainerStuffs.txt" even CELabel1.Caption has change to not equal "Changeable" ?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Thu Jan 12, 2017 10:15 am    Post subject: Reply with quote

add a print(tr_check) and confirm it's not 'Changeable'
_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Jan 12, 2017 2:41 pm    Post subject: Reply with quote

Thanks DB,

Sorry for stupid question. I miss one point, UDF1.CELabel1.Caption has set to "Changeable" as default on form designer, to make CEButton1.Enabled = true or false, of course need to check stored variable for CELabel1.Caption called from text file, Changeable or Fixed.

I am on my work for that

Regards
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