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 


Testing login form in a local computer

 
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: Wed Nov 18, 2015 8:16 pm    Post subject: Testing login form in a local computer Reply with quote

Hi, cheat engine forum members

I try to make a login form for a local computer using CE Lua.
It work, but some part does not go as desired.
e,q : after check user detail (registered or not), script still running to show next messages. I think i made wrong put "if ..end" logic statement.
Please, someone give help to fix it.

Next, if everything work properly, is it possible store the text file as database file into CE stream file, so when the script running, it should be read and write file from/to a CE stream file.


Code:

function checkUserLogin()
 local a = control_getCaption(UDF1.CEEdit1)
 a = tostring(a)
 if a == "" or b == "" then
  showMessage("You must input an email and password")
 else
  fh = io.open("test.txt")   ---- path to test.txt
  while true do
   line = fh:read()
   if line == nil then break end
   -- print (line)
   if string.find(line,a) then
   showMessage("Login accepted !")
   break
   else
   showMessage("You must register first!")
   break
   end
   end
 fh:close()
  end
end

function getUserDetail()
local a = control_getCaption(UDF1.CEEdit1)
local b = control_getCaption(UDF1.CEedit2)
a = tostring(a)
b = tostring(b)
if a == "" or b == "" then
 showMessage("Please input your email and password")
else
 fh = io.open("test.txt")    --- path to test.txt
  while true do
   line = fh:read()
   if line == nil then break end
   -- print (line)      --- to test result
   if string.find(line,a) then
   showMessage("You already registered")
   control_setCaption(UDF1.CEEdit1,"")
   control_setCaption(UDF1.CEEdit2,"")
   break
  end
end
local file = io.open("test.txt", "a")   -- path to test.txt
file:write(a.."/"..b, "\n")
file:close()
showMessage("Registering Complete !")
beep()
showMessage("Please login with your email and password")
control_setCaption(UDF1.CEEdit1,"")
control_setCaption(UDF1.CEEdit2,"")
end
end
--


function CEButton1Click(sender)
checkUserLogin()
end
--
function CEButton2Click(sender)
getUserDetail()
end
--
function CEButton3Click(sender)
closeCE();
return caFree
end


Thank you in advance and regards
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Wed Nov 18, 2015 8:31 pm    Post subject: Reply with quote

Sounds like you just want to delete
Code:
showMessage("Please login with your email and password")
control_setCaption(UDF1.CEEdit1,"")
control_setCaption(UDF1.CEEdit2,"")
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Nov 19, 2015 8:36 am    Post subject: Reply with quote

Thanks Zanzer,

Now all work properly, just need to find how to put the database (text file) as stream file in CE if possible.

regards
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Thu Nov 19, 2015 3:06 pm    Post subject: Reply with quote

I doubt you'll be able to write the file directly. There may be some function call to mimic the "Table > Add file" functionality.
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