This was working last night, but it decided to stop working for some reason. The problem is inside the for loop, when it echoes the page I see the last line perfectly fine.
function ZapkCRPG_HTTP::onDisconnect(%this)
{
%page = %this.page;
echo(%page);
for(%a = 1; %a < getLineCount(%page); %a++)
{
%line = getLine(%page, %a);
if(firstWord(%line) $= "<latestVersion>")
{
$ZapkCRPG_HTTP_latestVersion = restWords(%line);
//echo("\c4Downloaded Version:" SPC $ZapkCRPG_Version);
//echo("\c4Latest Version:" SPC $ZapkCRPG_HTTP_latestVersion);
}
if(firstWord(%line) $= "<releaseDate>")
{
$ZapkCRPG_HTTP_releaseDate = restWords(%line);
//echo("\c4Update Released:" SPC $ZapkCRPG_HTTP_releaseDate);
}
if(firstWord(%line) $= "<downloadLink>")
{
$ZapkCRPG_HTTP_downloadLink = restWords(%line);
//echo("\c4Download Link:" SPC $ZapkCRPG_HTTP_downloadLink);
}
if(firstWord(%line) $= "<rtbID>")
{
$ZapkCRPG_HTTP_rtbID = restWords(%line);
//echo("\c4RTB ID:" SPC $ZapkCRPG_HTTP_rtbID);
}
}
if($ZapkCRPG_Version != $ZapkCRPG_HTTP_latestVersion)
{
%mcText = "A new version (" @ $ZapkCRPG_HTTP_latestVersion @ ") was released on" SPC $ZapkCRPG_HTTP_releaseDate @ ".";
clientCmdZapkCRPG_mc("Update Available!", %mcText);
if(isObject(RTBMM_TransferQueue) && $ZapkCRPG_HTTP_rtbID !$= "")
{
//Thanks Greek2Me for the notification code <3
if(isObject(RTBCC_NotificationManager))
{
RTBCC_NotificationManager.push("Zapk's City RPG", "Downloading client updates.", "new", "", 5000);
}
RTB_ModManager.setVisible(1);
RTBMM_TransferView_Init();
RTBMM_TransferQueue.addItem($ZapkCRPG_HTTP_rtbID);
}
}
else
{
echo("\c4Client up-to-date.");
}
}
When I try to echo $ZapkCRPG_HTTP_rtbID, it doesn't return anything. Obviously my for loop isn't recognizing the last line. When I force it to go higher, it says Index out of rande (0-3, 4), when there is obviously a fifth line there.
Oh, and here's the page it's reading off of.
http://pastebin.com/raw.php?i=jmvwzy58It isn't recognizing the <rtbID> line inside the for loop.