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 


Script to paste contents from a URL and refresh the page

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

Joined: 21 Feb 2016
Posts: 115

PostPosted: Sun Feb 04, 2018 3:12 pm    Post subject: Script to paste contents from a URL and refresh the page Reply with quote

Hello Lua section it's been a while, I'm a bit rusty with scripting these days so I could use some help on how to get started with a script like this.

What I want to do is have a script go to a webpage that has one line of text in it, copy that text to a list (most likely will use Luas io file methods for this), and then refresh the page and repeat that process until the script is stopped. The page would be something like this: https://puu.sh/zgFNX/d0a425a4ef.txt
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sun Feb 04, 2018 4:06 pm    Post subject: Reply with quote

not really my expertise but perhaps something basic will get you pointed in the right direction

Code:
local net = getInternet()

local lines = {}
function doStuffWithContents(contents)
  lines[#lines+1] = contents
end

for i=0, 10 do -- some loop until you decide to stop eg. "while doStuff do .. end"
  -- contents will be string of result, or nil if it failed
  local contents = net.getURL('https://puu.sh/zgFNX/d0a425a4ef.txt')
  doStuffWithContents(contents)
end

-- do whatever with stuff afterwards
print(table.concat(lines, '\r\n'))
Back to top
View user's profile Send private message
usernotfound
Expert Cheater
Reputation: 0

Joined: 21 Feb 2016
Posts: 115

PostPosted: Sun Feb 04, 2018 5:59 pm    Post subject: Reply with quote

Thanks this is what I needed, cheers.
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