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 


Writing Value 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
Quarter187
Newbie cheater
Reputation: 0

Joined: 13 Aug 2022
Posts: 13

PostPosted: Wed Aug 17, 2022 12:47 am    Post subject: Writing Value From Text File Reply with quote

With this script I can successfully write a value to a text file from an address and have it constantly update itself.

Code:
{$lua}
if syntaxcheck then return end
[ENABLE]
function writefile(path, content)
      local file = io.open(path,"w+b")
      if file then
        file:write(content)
        file:close()
        return true
      else
        return false
      end
end
Timer=createTimer(MainForm)
Timer.Interval=100
Timer.OnTimer= function(timer)
writefile('shared.txt',readInteger ("21CEAD45E80")..'\n')
end
[DISABLE]
Timer.Enabled=false
Timer.destroy()


Read with this:
Code:
local file = io.open("shared.txt", "r")

local read = file:read("*all")

file:close()

print(read)

My question is how do I reverse this action? I want to make a script that will read this value from the text file, write it to a different address, and constantly update itself as well.
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