Aulis wrote:
Please gtfo, Redditfags aren't welcome on the forums.
Also, Good job on the server browser, it's nice.
Aulis wrote:
gamax92 wrote:You gave no credit to Uberi, the one who wrote the thing!
http://www.autohotkey.com/forum/topic77584.html
Also what did you modify in it?
BrotherCarnage wrote:Definitely helpful. Loving these [Tool]s. Continue with these!
superkickass wrote:I love the crap out of this server browser. a favorites tab would be nice. or maybe a simple rating system that you could then organize your servers by. maybe even have flags you could put up like lots of hacking or no hacking support, vote bans not enabled ect stuff that is just a click box you could put next to the servers. maybe even ones for what game mode type it is like ctf tc other. would be very nice. just some suggestions. over all pleased with what i got.
#NoEnv
;Path := """%A_ScriptDir%\client.exe"" ""%Server%""" ;use this for portable installations
Path := "%Server%" ;use this for normal installations
URL := "http://aos.mp2.dk/"
SetTitleMatchMode, RegEx
AutoJoin := 0
Gui, Font, s16 Bold, Arial
Gui, Add, Text, x10 y0 h30 vTitle Center, Server List
Gui, Font, s8 Norm
SortColumns := [0,0,0,0,0]
Gui, Add, ListView, x10 y30 vServerList gListViewEvent, Name|Players|Capacity|Ping|Server|Address|Port
Gui, Font, Bold
Gui, Add, Text, x10 w80 h20 vServerCount
Gui, Add, Button, w80 h20 vLocalServer gLocalServer, &Local Server
Gui, Add, Button, w80 h20 vRefreshList gRefreshList Default, &Refresh
Gui, +Resize +MinSize270x150
Gosub, RefreshList
Gui, Show, Center w630 h650
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, LocalServer, % "x" . (A_GuiWidth - 180) . " y" . (A_GuiHeight - 30)
GuiControl, Move, RefreshList, % "x" . (A_GuiWidth - 90) . " y" . (A_GuiHeight - 30)
WinSet, Redraw
Return
LocalServer:
Gui, Hide
JoinServer("aos://16777343",Path,"Local Server")
Gui, Show
Return
ListViewEvent:
If (A_GuiEvent = "ColClick")
Gosub, SortColumns
If (A_GuiEvent != "DoubleClick")
Return
Gosub, SelectServer
Return
SelectServer:
Row := LV_GetNext()
LV_GetText(Server,Row,5) ;retrieve the server from the fifth column of the selected row
LV_GetText(Name,Row,1) ;retrieve the server name from the first column of the selected row
Gui, Hide
JoinServer(Server,Path,Name)
Gui, Show
Return
SortColumns:
If SortColumns[A_EventInfo]
SortColumns[A_EventInfo] := (SortColumns[A_EventInfo] & 1) + 1 ;toggle sorting types between ascending and descending
Else
SortColumns[A_EventInfo] := (A_EventInfo = 2 || A_EventInfo = 3) ? 2 : 1 ;enable sorting for the column
For Index In SortColumns ;disable sorting on all other columns
{
If (Index != A_EventInfo)
SortColumns[Index] := 0
}
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.
Else
MsgBox, 16, Error, Could not obtain 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,"<table>") + StrLen("<table>")) ;remove everything before the server list
ServerPage := SubStr(ServerPage,InStr(ServerPage,"<tbody>") + StrLen("<tbody>")) ;remove everything before the server list
ServerPage := SubStr(ServerPage,1,InStr(ServerPage,"</tbody>") - 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,"</tr>") + 5) ;remove the header row
StringReplace, ServerPage, ServerPage,</tr>,|, All ;remove carriage returns
GuiControl, -Redraw, ServerList ;prevent redrawing of the ListView
LV_Delete() ;remove all listview entries
;populate the ListView
Loop, Parse, ServerPage, |
{
Loop, Parse, A_LoopField, `n
{
; MsgBox, %A_Index% - %A_LoopField%
If (A_Index = 5)
{
RegExMatch(A_LoopField,">(.*?)<",match)
StringSplit, Slot, match1,/
}
If (A_Index = 6)
RegExMatch(A_LoopField,">(.*?)<",Ping)
If (A_Index = 10)
{
RegExMatch(A_LoopField,"href=\""(.*?)\""",Server)
Port := SubStr(Server1,6)
Port := SubStr(Port,Instr(Port, ":") + 1)
RegExMatch(A_LoopField,Server1 . "\"">(.*?)</a>",Name)
}
}
ServerAddress1 := SubStr(Server1,7,StrLen(Server1)-StrLen(Port)-7)
Address := (ServerAddress1 & 0xFF) . "." . ((ServerAddress1 & 0xFF00) >> 8) . "." . ((ServerAddress1 & 0xFF0000) >> 16) . "." . ((ServerAddress1 & 0xFF000000) >> 24)
LV_Add("",Name1,Slot1,Slot2,Ping1,Server1,Address,Port)
}
;adjust column widths to suit their headers and contents
LV_ModifyCol(1,"AutoHdr") ;server name
LV_ModifyCol(2,"AutoHdr Integer Desc") ;players
LV_ModifyCol(3,"AutoHdr Integer Desc") ;capacity
LV_ModifyCol(4,"AutoHdr Integer") ;ping
LV_ModifyCol(5,"AutoHdr") ;server
LV_ModifyCol(6,"AutoHdr") ;IP address
LV_ModifyCol(7,"AutoHdr Integer") ;port
For Index, Value In SortColumns
{
If Value
{
LV_ModifyCol(Index,"Sort" . ((Value = 1) ? "" : "Desc"))
Break
}
}
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
JoinServer(Server,Path,Name)
{
global AutoJoin
Transform, Path, Deref, %Path%
Loop
{
;open Ace of Spades
Run, %Server%,, UseErrorLevel
If ErrorLevel
{
MsgBox, 16, Error, Could not open server "%Server%".
Return, 1
}
WinWait, Ace of Spades|ERROR ahk_class Ace of Spades|#32770,, 5
;check for connection errors
WinGetClass, WindowClass
If (WindowClass != "Ace of Spades") ;error dialogue
{
WinClose
If !AutoJoin
{
MsgBox, 22, Error, Could not connect to "%Name%": server is full or misconfigured.`n`nSelect "Try Again" to retry the connection`, or "Continue" to automaticially join.
IfMsgBox, Cancel
{
Gosub, StopAutoJoin
Break
}
IfMsgBox, Continue
{
AutoJoin := 1
ToolTip, Press Esc to stop automatic retrying.
Hotkey, Esc, StopAutoJoin, On
}
}
}
Else
{
Gosub, StopAutoJoin
If ErrorLevel ;window wait operation timed out
Return, 1
WinSetTitle, Ace of Spades ahk_class Ace of Spades,, Ace of Spades - %Name%
WinWaitClose
Break
}
}
Return, 0
StopAutoJoin:
AutoJoin := 0
ToolTip
Hotkey, Esc, StopAutoJoin, Off
Return
}
#If ListViewFocused()
ListViewFocused()
{
GuiControlGet, CurrentFocus, FocusV
Return, CurrentFocus = "ServerList" && LV_GetNext()
}
Enter::Gosub, SelectServer
#If
gamax92 wrote:Just letting you know, the new /play update broke this.
So until Uberi properly fixes this program, heres my fix
- Code: Select all
#NoEnv
;Path := """%A_ScriptDir%\client.exe"" ""%Server%""" ;use this for portable installations
Path := "%Server%" ;use this for normal installations
URL := "http://www.ace-spades.com/play/"
SetTitleMatchMode, RegEx
AutoJoin := 0
Gui, Font, s16 Bold, Arial
Gui, Add, Text, x10 y0 h30 vTitle Center, Server List
Gui, Font, s8 Norm
SortColumns := [0,0,0,0,0]
Gui, Add, ListView, x10 y30 vServerList gListViewEvent, Name|Players|Capacity|Ping|Server|Address|Port
Gui, Font, Bold
Gui, Add, Text, x10 w80 h20 vServerCount
Gui, Add, Button, w80 h20 vLocalServer gLocalServer, &Local Server
Gui, Add, Button, w80 h20 vRefreshList gRefreshList Default, &Refresh
Gui, +Resize +MinSize270x150
Gosub, RefreshList
Gui, Show, Center w630 h650
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, LocalServer, % "x" . (A_GuiWidth - 180) . " y" . (A_GuiHeight - 30)
GuiControl, Move, RefreshList, % "x" . (A_GuiWidth - 90) . " y" . (A_GuiHeight - 30)
WinSet, Redraw
Return
LocalServer:
Gui, Hide
JoinServer("aos://16777343",Path,"Local Server")
Gui, Show
Return
ListViewEvent:
If (A_GuiEvent = "ColClick")
Gosub, SortColumns
If (A_GuiEvent != "DoubleClick")
Return
Gosub, SelectServer
Return
SelectServer:
Row := LV_GetNext()
LV_GetText(Server,Row,5) ;retrieve the server from the fifth column of the selected row
LV_GetText(Name,Row,1) ;retrieve the server name from the first column of the selected row
Gui, Hide
JoinServer(Server,Path,Name)
Gui, Show
Return
SortColumns:
If SortColumns[A_EventInfo]
SortColumns[A_EventInfo] := (SortColumns[A_EventInfo] & 1) + 1 ;toggle sorting types between ascending and descending
Else
SortColumns[A_EventInfo] := (A_EventInfo = 2 || A_EventInfo = 3) ? 2 : 1 ;enable sorting for the column
For Index In SortColumns ;disable sorting on all other columns
{
If (Index != A_EventInfo)
SortColumns[Index] := 0
}
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.
Else
MsgBox, 16, Error, Could not obtain 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,"<table class=""sortable"" style=""table-layout:fixed;"">") + StrLen("<table class=""sortable"" style=""table-layout:fixed;"">")) ;remove everything before the server list
ServerPage := SubStr(ServerPage,InStr(ServerPage,"<tbody style=""border:1px dotted grey;"">") + StrLen("<tbody style=""border:1px dotted grey;"">")) ;remove everything before the server list
ServerPage := SubStr(ServerPage,1,InStr(ServerPage,"</tbody>") - 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
StringReplace, ServerPage, ServerPage,</tr>,|, All ;remove carriage returns
GuiControl, -Redraw, ServerList ;prevent redrawing of the ListView
LV_Delete() ;remove all listview entries
;populate the ListView
ServerPage := "`n" . ServerPage
Loop, Parse, ServerPage, |
{
Loop, Parse, A_LoopField, `n
{
If (A_Index = 3)
{
RegExMatch(A_LoopField,">(.*?)<",match)
StringSplit, Slot, match1,/
}
If (A_Index = 4)
RegExMatch(A_LoopField,">(.*?)<",Ping)
If (A_Index = 9)
{
RegExMatch(A_LoopField,"href=\""(.*?)\""",Server)
Port := SubStr(Server1,6)
Port := SubStr(Port,Instr(Port, ":") + 1)
RegExMatch(A_LoopField,Server1 . "\"">(.*?)</a>",Name)
Name1 := UnHTM(Name1)
}
}
ServerAddress1 := SubStr(Server1,7,StrLen(Server1)-StrLen(Port)-7)
Address := (ServerAddress1 & 0xFF) . "." . ((ServerAddress1 & 0xFF00) >> 8) . "." . ((ServerAddress1 & 0xFF0000) >> 16) . "." . ((ServerAddress1 & 0xFF000000) >> 24)
LV_Add("",Name1,Slot1,Slot2,Ping1,Server1,Address,Port)
}
;adjust column widths to suit their headers and contents
LV_ModifyCol(1,"AutoHdr") ;server name
LV_ModifyCol(2,"AutoHdr Integer Desc") ;players
LV_ModifyCol(3,"AutoHdr Integer Desc") ;capacity
LV_ModifyCol(4,"AutoHdr Integer") ;ping
LV_ModifyCol(5,"AutoHdr") ;server
LV_ModifyCol(6,"AutoHdr") ;IP address
LV_ModifyCol(7,"AutoHdr Integer") ;port
For Index, Value In SortColumns
{
If Value
{
LV_ModifyCol(Index,"Sort" . ((Value = 1) ? "" : "Desc"))
Break
}
}
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
UnHTM( HTM ) { ; Remove HTML formatting / Convert to ordinary text by SKAN 19-Nov-2009
Static HT,C=";" ; Forum Topic: www.autohotkey.com/forum/topic51342.html Mod: 16-Sep-2010
IfEqual,HT,, SetEnv,HT, % "ááââ´Â´ææàà &åÃ¥ãã&au"
. "mlä&bdquo„¦Â¦&bull•çç¸Â¸¢Â¢&circˆ©Â©¤Â¤&dagger†&dagger‡°"
. "°÷÷ééêêèèððëë&euro€&fnofÆ’½Â½¼Â¼¾Â¾>>&h"
. "ellip…íÃîî¡Â¡ìì¿Â¿ïï«Â«&ldquo“&lsaquo‹&lsquo‘<<&m"
. "acr¯&mdash—µÂµ·Â·  &ndash–¬Â¬ññóóôô&oeligÅ“òò&or"
. "dfªºÂºøøõõöö¶Â¶&permil‰±Â±£Â£"""»Â»&rdquo‮"
. "®&rsaquo›&rsquo’&sbquo‚&scaronÅ¡§Â§­ ¹Â¹²Â²³Â³ßßþþ&tildeËœ&tim"
. "es×&tradeâ„¢úúûûùù¨Â¨üüýý¥Â¥ÿÿ"
$ := RegExReplace( HTM,"<[^>]+>" ) ; Remove all tags between "<" and ">"
Loop, Parse, $, &`; ; Create a list of special characters
L := "&" A_LoopField C, R .= (!(A_Index&1)) ? ( (!InStr(R,L,1)) ? L:"" ) : ""
StringTrimRight, R, R, 1
Loop, Parse, R , %C% ; Parse Special Characters
If F := InStr( HT, L := A_LoopField ) ; Lookup HT Data
StringReplace, $,$, %L%%C%, % SubStr( HT,F+StrLen(L), 1 ), All
Else If ( SubStr( L,2,1)="#" )
StringReplace, $, $, %L%%C%, % Chr(((SubStr(L,3,1)="x") ? "0" : "" ) SubStr(L,3)), All
Return RegExReplace( $, "(^\s*|\s*$)") ; Remove leading/trailing white spaces
}
JoinServer(Server,Path,Name)
{
global AutoJoin
Transform, Path, Deref, %Path%
Loop
{
;open Ace of Spades
Run, %Server%,, UseErrorLevel
If ErrorLevel
{
MsgBox, 16, Error, Could not open server "%Server%".
Return, 1
}
WinWait, Ace of Spades|ERROR ahk_class Ace of Spades|#32770,, 5
;check for connection errors
WinGetClass, WindowClass
If (WindowClass != "Ace of Spades") ;error dialogue
{
WinClose
If !AutoJoin
{
MsgBox, 22, Error, Could not connect to "%Name%": server is full or misconfigured.`n`nSelect "Try Again" to retry the connection`, or "Continue" to automaticially join.
IfMsgBox, Cancel
{
Gosub, StopAutoJoin
Break
}
IfMsgBox, Continue
{
AutoJoin := 1
ToolTip, Press Esc to stop automatic retrying.
Hotkey, Esc, StopAutoJoin, On
}
}
}
Else
{
Gosub, StopAutoJoin
If ErrorLevel ;window wait operation timed out
Return, 1
WinSetTitle, Ace of Spades ahk_class Ace of Spades,, Ace of Spades - %Name%
WinWaitClose
Break
}
}
Return, 0
StopAutoJoin:
AutoJoin := 0
ToolTip
Hotkey, Esc, StopAutoJoin, Off
Return
}
#If ListViewFocused()
ListViewFocused()
{
GuiControlGet, CurrentFocus, FocusV
Return, CurrentFocus = "ServerList" && LV_GetNext()
}
Enter::Gosub, SelectServer
#If
gamax92 wrote:Working?
And then the play page got changed and broke the Server Browser. So I created a temporary fix until Uberi fixes it.
The fix uses the pyspades server list, so its less likely to break entirely unless a new version gets released.
Users browsing this forum: No registered users and 3 guests