Note: This forum is merely an archive. It is no longer possible to register or post. - StackOverflow
New Ace of Spades Forums: http://buildandshoot.com/

Rainmeter server list

Got a great new idea for the game?

Rainmeter server list

Postby Dropbear » Wed May 23, 2012 7:58 am

Hey, I'm new to the forums but I've been playing AoS for a few patches now, I was wondering if it would be possible to create a rainmeter server list, dont know what rainmeter is? Google it, I think it would be a good substitute to going onto the main site then to play or opening your browser every time you want to play a game or two of AoS, I searched but if this has already been suggested then please redirect me to the original thread.

Thanks, Dropbear.

Also, on a side note, not sure if this is the right forum I assume it would be because this is the suggestions thread but it could technically be for the off topic board.
User avatar
Dropbear
Member
 
Posts: 8
Joined: Wed May 23, 2012 7:13 am
Location: Australia

Re: Rainmeter server list

Postby Gorman » Wed May 23, 2012 12:15 pm

Yup, very possible. After all, all it has to do is read a webpage and display one part of it, that's pretty ez.
You could use one of the webpage scripts and just scroll it to the part you want, or you can use more complex regex to cut out all except the table:
/<table class="sortable" style="table-layout:fixed;">(.*)</table>/s
Assuming multi-line matching mode.
Image
User avatar
Gorman
[LDR] Member
 
Posts: 1170
Joined: Sat Dec 10, 2011 9:10 pm

Re: Rainmeter server list

Postby Dropbear » Wed May 23, 2012 12:55 pm

Thanks for the fast response, tomorrow I will look into it, for now I'm too tired.

EDIT; If anyone wants to do this I won't stop you it saves me learning HTML and C++/C#
User avatar
Dropbear
Member
 
Posts: 8
Joined: Wed May 23, 2012 7:13 am
Location: Australia

Re: Rainmeter server list

Postby Gorman » Thu May 24, 2012 3:31 am

Don't worry about learning any of that, you just need to follow this tutorial:
http://rainmeter.net/cms/Tips-WebParserPrimer

I'll help you out by saying this:
Code: Select all
[MeasureServerList]
Measure=Plugin
Plugin=Plugins\WebParser.dll
UpdateRate=1800
Url=http://www.ace-spades.com/play/
RegExp="(?siU)<table class="sortable" style="table-layout:fixed;">(.*)</table>"

With that you have almost everything you need, read the tutorial to find the lasts little bit (it's best to read the tutorial anyway so you can understand what this code does)
Image
User avatar
Gorman
[LDR] Member
 
Posts: 1170
Joined: Sat Dec 10, 2011 9:10 pm

Re: Rainmeter server list

Postby Dropbear » Thu May 24, 2012 8:30 am

You are my 15th best friend, I will be back with a small server list for Rainmeter, then I will sign up to the rainmeter forums and post it there too.
User avatar
Dropbear
Member
 
Posts: 8
Joined: Wed May 23, 2012 7:13 am
Location: Australia

Re: Rainmeter server list

Postby Gorman » Thu May 24, 2012 9:04 am

Some day I'll make it into the top 10! :D

Good luck.
Image
User avatar
Gorman
[LDR] Member
 
Posts: 1170
Joined: Sat Dec 10, 2011 9:10 pm

Re: Rainmeter server list

Postby Dropbear » Thu May 24, 2012 12:54 pm

quick update; I have to use LUA code to return a table of values which I will get with string.gmatch (I have some experience with LUA) but for now i have assignments, don't expect anything even remotely done until the weekend.
User avatar
Dropbear
Member
 
Posts: 8
Joined: Wed May 23, 2012 7:13 am
Location: Australia

Re: Rainmeter server list

Postby LASTofS » Sat May 26, 2012 4:40 pm

Good luck! I'm looking forward to this.
ImageImageImage
Join the [LoS] (last of spades) clan here | my greatest contribution: Image icon on openGL client
User avatar
LASTofS
News Reporter
 
Posts: 852
Joined: Sat Jan 21, 2012 6:34 pm
Location: pls there are kids in here

Re: Rainmeter server list

Postby Gorman » Sat May 26, 2012 4:44 pm

I think you are significantly over-complicating things :P

Whatever you are trying to do can probably be done with regex ;)
Image
User avatar
Gorman
[LDR] Member
 
Posts: 1170
Joined: Sat Dec 10, 2011 9:10 pm

Re: Rainmeter server list

Postby Zakski » Mon May 28, 2012 10:55 am

See the first reply on this Stack Overflow post to know why parsing html with regex is bad http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
Zakski
Member
 
Posts: 1
Joined: Mon May 28, 2012 10:34 am

Re: Rainmeter server list

Postby Dropbear » Mon May 28, 2012 1:26 pm

I have about 2 years experience with LUA where as I have about 1 week with Rainmeter and I'm reading HTML as if it was XML, LUA is simple and easy for me to use, thanks for the input though. On a side note, block exams in 2 weeks lots of assignments, when I finally do get this out dont expect updates or revisions for a few weeks.
EDIT: Nice Cirno display picture.
User avatar
Dropbear
Member
 
Posts: 8
Joined: Wed May 23, 2012 7:13 am
Location: Australia

Re: Rainmeter server list

Postby Gorman » Mon May 28, 2012 4:07 pm

Zakski wrote:See the first reply on this Stack Overflow post to know why parsing html with regex is bad http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags

If you read my solution, you will see that my solution is fine - we are not looking to build a parse, we are just pattern matching, so this usage is fine.
Image
User avatar
Gorman
[LDR] Member
 
Posts: 1170
Joined: Sat Dec 10, 2011 9:10 pm

Re: Rainmeter server list

Postby Dropbear » Tue May 29, 2012 9:50 am

The current problem I'm having now is actually creating buttons, I can create text get all the data and tabulate it, I just can't make a list of buttons or text objects that matches the exact amount of servers I have, I could do it if there was a LUA function like say, SKIN:CreateMeasure("MeasureType","X","Y","W","H","VALUE(/S)"), but alas, there is not.

EDIT: Grammar error and posting my script, I hardly feel it is over complicating it;
Code: Select all
function Update()
   L=SKIN:GetMeasure("MeasureServerList"):GetStringValue()
   for M in string.gmatch(L,[[<td style="border:1px dotted grey;"><a href="(.-)</td>]]) do
      for S in string.gmatch(M,[[(.-)">]]) do print(S) end
      for N in string.gmatch(M,[[">(.-)</a>]]) do print(N) end
   end
end

That spams the Rainmeter log with:
SERVER NAME
aos://XXXXXXXXXXXXXX
User avatar
Dropbear
Member
 
Posts: 8
Joined: Wed May 23, 2012 7:13 am
Location: Australia

Re: Rainmeter server list

Postby Gorman » Wed May 30, 2012 3:11 pm

Sorry, don't know how to do that, try the official rainmeter forums, they will probably be able to help you a lot.
Image
User avatar
Gorman
[LDR] Member
 
Posts: 1170
Joined: Sat Dec 10, 2011 9:10 pm

Re: Rainmeter server list

Postby Dropbear » Sun Jun 03, 2012 2:07 pm

Yeah the current Rainmeter API only allows me to change values stored in measures and variables, I cant create meters, maybe with a plugin I can do it, either way I have lots of exams so ill be like atleast a few more days, thanks for all your help.

EDIT: I guess I could just make a large list of like say 50 buttons and make it display a max of 50 servers but that would be limited, its how they do RSS feeds. :|
User avatar
Dropbear
Member
 
Posts: 8
Joined: Wed May 23, 2012 7:13 am
Location: Australia


Return to Game



Who is online

Users browsing this forum: No registered users and 1 guest

cron