Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Ace of Spades Server Selector (Updated June 1, 2013)


  • Please log in to reply
71 replies to this topic
Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010

A server selection dialog for Ace of Spades, an independent sandbox building/FPS game. Supports BuildAndShoot's configuration.

 

This is not intended for use with the Jagex versions! Use at your own risk.

 

Ace of Spades has an online server selection page, but I've always found it less usable than a dedicated launcher and server browser. This script is meant as a complete replacement for the server selection webpage.

 

Why should I use this?

  • Automatic joining: if the server is currently full, the launcher offers to keep trying to join until successful. You can also retry joining a server if the connection fails.
  • Better ping: ping from your own machine to get the best possible idea of how well your connection will perform.
  • Username changing: change your username right from the bottom bar!
  • Better availability: server listings are sourced from three different places, so if one goes down, you won't even notice.
  • Map and server name while playing: if you play in windowed mode, the name of the server and the current map will be shown in the title bar, just in case you need that information.
  • Fast browsing with hotkeys: press Alt + R to refresh, Enter to join, Up or Down to move up or down, or start typing to select a server by name.
  • Connect to an IP or localhost easily: any IP address, even your own machine!
  • Fast and light: start playing in seconds!

What are the latest changes?

  • Window minimum size updated.

  • Status indicator for retrieving server lists.

  • More reasonable timeouts for list retrieval so the program doesn't freeze while updating.

What does it look like?

Ace%20of%20Spades%20Server%20Selector.pn

Where do I get this?

 

Use this one if you have AutoHotkey installed:
Script

 

Use this one if you do not have or want to install AutoHotkey:

EXE



zzzooo10
  • Members
  • 237 posts
  • Last active: Apr 14 2015 01:57 AM
  • Joined: 19 Dec 2010
Interesting game, I'll have to check it out.
Your not the only one who wrote a server manager in ahk, and you might want to add yours here.

tidbit
  • Administrators
  • 2709 posts
  • Hates playing Janitor
  • Last active: Jan 15 2016 11:37 PM
  • Joined: 09 Mar 2008
Well, that wasn't on your todo list very long.... Great!

here is an idea:
also show the current AOS version number on the website.

rawr. be very afraid
*poke*
. Populate the AutoHotkey city. Pointless but somewhat fun. .


nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
With a quick change, this works with AOS Portable too! :)
Now I can remove my hotkey which sent a rightclick, arrow keys, and ran aos with the clipboard :p

Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010

you might want to add yours here.


Done!

also show the current AOS version number on the website.


Done!

Redownload to see the changes.

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
Broken as of 0.70! Needs an update :wink:

Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010
Fixed (small RegEx tweak) :).

Redownload to get the changes.

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
figured I'd share:
SetTitleMatchMode RegEx
Loop
{
 run aos://NNNNNNNNN ; replace with server's address
 WinWait ^(ERROR|Ace of Spades)$
 WinGetTitle, T
 If T = ERROR
  WinClose
 Else ExitApp
}
Useful for joining full servers.

Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010
Update:

[*:2kar3p9e]Error dialog boxes are recognized and properly handled.
[*:2kar3p9e]Retrying connections if they fail.
[*:2kar3p9e]Error checking improved.
Thanks for the connection retrying idea, nimda!

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
You're welcome and thanks for the update, Uberi! :)

It had gotten to the point where I would position the selection dialog so that I could click the server and the OK on the ERROR box without moving the mouse :O
Then I realized AHK could do it faster and even in the background :)
Now with it built in, I don't even need to type in the address each time :D

Can't wait to try it out ;)

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
WAIT! There's no "auto-connect" option :(
I tried with something like this
#NoEnv

URL := "http://ace-spades.com/play/"

SetTitleMatchMode, RegEx

Gui, Font, s16 Bold, Arial
Gui, Add, Text, x10 y0 h30 vTitle Center, Server List
Gui, Font, s8 Norm
Gui, Add, ListView, x10 y30 vServerList gSelectServer, Name|Players|Ping|Address
Gui, Font, Bold
Gui, Add, Text, x10 w80 h20 vServerCount
Gui, Add, Button, w80 h20 vRefreshList gRefreshList Default, Refresh
Gui, +Resize +MinSize200x150

Gosub, RefreshList
Gosub, GuiSize

Gui, Show, w490 h350
Return

GuiEscape:
GuiClose:
ExitApp

GuiSize:
GuiControl, Move, Title, % "w" . (A_GuiWidth - 20)
GuiControl, Move, ServerList, % "w" . (A_GuiWidth - 20) . " h" . (A_GuiHeight - 70)
GuiControl, Move, ServerCount, % "y" . (A_GuiHeight - 30)
GuiControl, Move, RefreshList, % "x" . (A_GuiWidth - 90) . " y" . (A_GuiHeight - 30)
WinSet, Redraw
Return

SelectServer:
If (A_GuiEvent != "DoubleClick")
 Return
Row := LV_GetNext()
LV_GetText(Address,Row,4) ;retrieve the address from the fourth column of the selected row
Gui, Hide

Run %A_ScriptDir%\AoS.ahk

Loop
{
 ;open Ace of Spades
 Run, %Address%,, UseErrorLevel
 If ErrorLevel
  MsgBox, 16, Error, Could not open address "%Address%".
 WinWait, Ace of Spades|ERROR ahk_class Ace of Spades|#32770

 ;check for connection errors
 WinGetClass, WindowClass
 If (WindowClass != "Ace of Spades") ;error dialogue
 {
  WinClose
  LV_GetText(ServerName,Row,1) ;retrieve the server name from the first column of the selected row
[color=red]  MsgBox, 26,, Could not connect to "%ServerName%": server is full or misconfigured.`nPress 'Continue' to auto-join.[/color]
  IfMsgBox, Cancel
   Break
  [color=red]IfMsgBox, Continue
  {
   Loop
   {
    Run %Address%
    WinWait, Ace of Spades|ERROR ahk_class Ace of Spades|#32770,, 3
    WinGetTitle, T
    If T = ERROR
     WinClose
    Else break 2
   }[/color]
  }
 }
 Else If !ErrorLevel ;operation did not time out
  WinWaitClose
}

Gui, Show
Return

RefreshList:
;request the server selection page
Try
{
 WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
 WebRequest.Open("GET",URL) ;open request
 WebRequest.Send() ;send request
 ServerPage := WebRequest.ResponseText ;retrieve response
 WebRequest := "" ;free request
}
Catch Error
{
 WebRequest := "" ;free request
 If (Error.Extra = "Send")
  MsgBox, 16, Error, Could not request server list.
 Else If (Error.Extra = "ResponseText")
  MsgBox, 16, Error, Could not retrieve server list.
 ServerPage := ""
}

RegExMatch(ServerPage,"iS)<div\b[^<]*<a\b[^>]*>[^<]*?([\d\.]+)",Output), Version := (Output1 = "") ? "Unknown Version" : ("Version " . Output1) ;find the current version

;retrieve the server list
ServerPage := SubStr(ServerPage,InStr(ServerPage,"<pre>") + 5) ;remove everything before the server list
ServerPage := SubStr(ServerPage,1,InStr(ServerPage,"</pre>") - 1) ;remove everything after the server list
StringReplace, ServerPage, ServerPage, `r,, All ;remove carriage returns
ServerPage := Trim(ServerPage,"`n") ;trim off leading and trailing newlines
ServerPage := SubStr(ServerPage,InStr(ServerPage,"`n") + 1) ;remove the header row

GuiControl, -Redraw, ServerList ;prevent redrawing of the ListView

LV_Delete() ;remove all listview entries

;populate the ListView
Loop, Parse, ServerPage, `n
{
 RegExMatch(A_LoopField,"S)\s*(\d+\s*/\s*\d+)\s*(\d+)\s*[^>]*>\s*[^""]*""([^""]+)[^>]*>([^<]+)",Output)
 LV_Add("Auto",Output4,Output1,Output2,Output3)
}

;adjust column widths to suit their headers and contents
LV_ModifyCol(1,"AutoHdr")
LV_ModifyCol(2,"AutoHdr Integer")
LV_ModifyCol(3,"AutoHdr Integer")
LV_ModifyCol(4,"AutoHdr")

GuiControl, +Redraw, ServerList ;allow the ListView to be redrawn

GuiControl,, ServerCount, % LV_GetCount() . " servers." ;update the server count
Gui, Show,, Ace of Spades (%Version%) Servers
Return
But for some reason the script hits the MsgBox line and there's no MsgBox...

053: if (WindowClass != "Ace of Spades")
055: WinClose (0.13)
056: LV_GetText(ServerName,Row,1)
057: MsgBox,26,,Could not connect to "%ServerName%": server is full or misconfigured.
Press 'Continue' to auto-join. (18.33)

Press [F5] to refresh.


Could you please add an Auto-join option?

Uberi
  • Moderators
  • 1119 posts
  • Last active: May 02 2015 06:05 PM
  • Joined: 23 Aug 2010
Done.

nimda
  • Members
  • 4368 posts
  • Last active: Aug 09 2015 02:36 AM
  • Joined: 26 Dec 2010
Thanks :D

gamax92lazy
  • Guests
  • Last active:
  • Joined: --
This is pretty nice. works just like it says and i can actually sort the servers by players connected!

Strelok
  • Guests
  • Last active:
  • Joined: --
Okay, I'm new to this, how do I download this?