Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
soundcheck
Newbie


Joined: 21 Nov 2009
Posts: 5

PostPosted: Sun Jan 24, 2010 9:45 am   

Extracting data off an online text document.
 
Hey there.

I was wondering if it was possible for zmud to read a webpage and extract information out of it. I've tried playing around with the DDE commands but so far have been unsuccessful at coming up with anything remotely useful. Anyone have any idea how I could do this in anyway not necessarily involving DDE?

Thanks!
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Mon Jan 25, 2010 11:00 pm   
 
Check out http://forums.zuggsoft.com/forums/viewtopic.php?p=97215 for ideas.
_________________
Taz :)
Reply with quote
soundcheck
Newbie


Joined: 21 Nov 2009
Posts: 5

PostPosted: Tue Jan 26, 2010 12:33 am   
 
Thanks for the help!

Unfortunately, I'm not familiar with VBScript at all. Is there any tutorial you could point me to so that I could get myself acquainted with the language? I tried looking online but couldn't find anything useful for a beginner like myself.
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Tue Jan 26, 2010 4:47 am   
 
I removed the website this is from to avoid undue spam there. Basically gets the armour values and reports them

#lua {if not http then http = require("socket.http") end
local page = http.request("http://website/pSearch=" .. zs.params(1))
local nextpage = string.match(page,"http://website/pID=(%d+).*" .. zs.func.proper(zs.params(1)))
if nextpage then
nexturl = "http://website/pID=" .. nextpage
local page = http.request(nexturl)
page = string.sub(page, string.find(page,"#CCCCCC"), string.find(page,"span style"))
page = string.sub(page, string.find(page,"<tr>"), string.find(page,"</table>"))
zs.var.results = page
else
echo("Doesn't exist")
zs.var.results = ""
end
}
#if (@results) {results = %subregex(@results, "</td>","|")
edged = %subregex(%item(@results,2),".*>")
blunt = %subregex(%item(@results,3),".*>")
fire = %subregex(%item(@results,4),".*>")
cold = %subregex(%item(@results,5),".*>")
acid = %subregex(%item(@results,6),".*>")
elec = %subregex(%item(@results,7),".*>")
mind = %subregex(%item(@results,8),".*>")
energy = %subregex(%item(@results,9),".*>")
poison = %subregex(%item(@results,10),".*>")
radiation = %subregex(%item(@results,11),".*>")
overall = %subregex(%item(@results,12),".*>")
#print {%-1}
#show %ansi(high,cyan)"Edged Blunt Fire Ice Acid Elec Mind Energy Poison Radiation Overall"
#print { @edged @blunt @fire @cold @acid @elec @mind @energy @poison @radiation @overall}} {}
Reply with quote
soundcheck
Newbie


Joined: 21 Nov 2009
Posts: 5

PostPosted: Tue Jan 26, 2010 6:02 am   
 
Thanks chris! Sadly, if I'm not wrong, I can't use LUA in zMUD, so that probably won't work for me.
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Tue Jan 26, 2010 6:36 am   
 
right you are. Sorry, I didn't check what forum this was for
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Jan 26, 2010 8:50 am   
 
http://www.quackit.com/vbscript/tutorial/
_________________
Taz :)
Reply with quote
soundcheck
Newbie


Joined: 21 Nov 2009
Posts: 5

PostPosted: Wed Jan 27, 2010 12:36 am   
 
Thanks a lot Taz!
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Wed Jan 27, 2010 1:18 am   
 
See how you get on. If you get stuck post what is causing an issue and I'll see if I can help.
_________________
Taz :)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4549
Location: Pensacola, FL, USA

PostPosted: Thu Jan 28, 2010 12:19 pm   
 
you could set a variable to %clip and then do an expression trigger for whenever its value changes and have it parse the variable for the info you want
then all you would need to do is select all and copy on each webpage you wanted to check
_________________
Discord: Shalimar#3679
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net