|
Quilana Beginner
Joined: 10 Jan 2008 Posts: 13
|
Posted: Sat Aug 13, 2011 11:48 am
%url: kicking a** and taking names |
Alright! -I'm trying to learn more about coding, this is the more ambitious of my attempts and way out of my comfort zone. I'm trying to recreate a small program that a friend of mine is using on MUSHclient.
Basically, she uses some Lua code to get who is on the game from the website (http://old.lusternia.com/players.php?search=who)
and strains it through this filter:
\<a href\=\'\/players\.php\?lookup\=\w+\'\>(\w+)\<\/a\>
each name is added to a list with the delimiter , between them and then printed to the screen.
I'm trying to do this in Zscript with the %url object creating function.
So far I've got an Alias and it's value is this
(as you can imagine, it's not really working out)
u = %url("http://old.lusternia.com/players.php?search=who")
#SHOW %regex(@u.Get,"\<a href\=\'\/players\.php\?lookup\=\w+\'\>(\w+)\<\/a\>",Name,Message,X)
which prints '0' to the screen
If someone could point me to the newbie friendly tutorial on this I'd greatly appreciate it, some help would also be great. |
|
|
|
Quilana Beginner
Joined: 10 Jan 2008 Posts: 13
|
Posted: Sat Aug 13, 2011 11:49 am |
((I don't know Lua but for those of you who do and this might make the difference here is the code I'm trying to 'translate'))
http = require "socket.http"
webRex=rex.new("\<a href\=\'\/players\.php\?lookup\=\w+\'\>(\w+)\<\/a\>")
function webstalk(filter)
local f = assert(http.request("http://old.lusternia.com/players.php?search=who"))
if f then
local str = ""
local count = 0
webRex:gmatch(f, function(m,t)
if not string.find(string.lower(t[1]), filter) then
return
end
str = str..t[1]..", "
count = count + 1
end)
ColourNote("silver", "", string.sub(str, 0, -3)..".")
ColourNote("silver", "", "Players online: "..count)
end
end |
|
|
|
|
|
|
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
|
|