Game Development Community

dev|Pro Game Development Curriculum

Getting Information From A Web Server?

by Taylor Suchan · 10/19/2001 (8:05 am) · 3 comments

First I have Created a GUI Object:
new ShellScrollCtrl() {
	profile = "NewScrollCtrlProfile";
	horizSizing = "left";
	vertSizing = "top";
	position = "19 35";
	extent = "602 227";
	minExtent = "24 52";
	visible = "1";
	hideCursor = "0";
	bypassHideCursor = "0";
	helpTag = "0";
	willFirstRespond = "1";
	hScrollBar = "alwaysOff";
	vScrollBar = "alwaysOn";
	constantThumbHeight = "0";
	defaultLineHeight = "15";
	childMargin = "4 2";
	fieldBase = "gui/shll_field";

	new GuiScrollContentCtrl(ShifterNewsScroller) {
		profile = "GuiDefaultProfile";
		horizSizing = "right";
		vertSizing = "bottom";
		position = "8 6";
		extent = "570 215";
		minExtent = "8 8";
		visible = "1";
		hideCursor = "0";
		bypassHideCursor = "0";
		helpTag = "0";

		new GuiMLTextCtrl(ShifterNewsText) {
			profile = "GuiMessageEditHudTextProfile";
			horizSizing = "right";
			vertSizing = "bottom";
			position = "0 0";
			extent = "567 3360";
			minExtent = "8 8";
			visible = "1";
			hideCursor = "0";
			bypassHideCursor = "0";
			helpTag = "0";
			lineSpacing = "2";
			allowColorChars = "0";
			maxChars = "-1";
			deniedSound = "InputDeniedSound";
		};
	};
};

Then code pulls from the web site:
(PERL - Runs After SQL Statement)
$art = 0;
while($db->FetchRow() && $art < 15)
{
	%Data = $db->DataHash();

	$id		= $Data{"Col001"};
	$date		= localtime($Data{"Col001"});
	$postedby	= $Data{"Col003"};
	$title 		= $Data{"Col002"};
	$guts 		= $Data{"Col007"};
	$link		= $Data{"Col008"};
	$linkname 	= $Data{"Col010"};

	$newguts = "";	
	my $p = new HTML::TokeParser ($guts);
	while ($_ = $p->get_token){ $newguts .= @$_[1] if @$_[0] eq 'T'; }


	$line  = qq~<spush><Font:Univers Condensed:22><color:00AAFF>$title<spop>\n~;
	$line .= qq~<spush><color:ffffff><font:impact:18>$date<spop>\t~;
	$line .= qq~<spush><color:aaffff><font:impact:18>  Post By : $postedby<spop>\n~;

	if ($link gt "")
	{
		$line .= qq~LINK: [$link] \n~;
	}

	$line .= qq~$newguts\n\n~;
	print "$line";
	$art++;
}

This reads my news from inside Tribes2
function GetShifterNews()
{
	$ShifterNewsLine = 0;
	ShifterNewsText.setText ("");
	%server = "www.webserver.com:80";
	%serverpath = "/";
	%requeststring = "/cgi-bin/cgi.pl?getshifternews";
	%upd = new SecureHTTPObject(ShifterNews){};
	%upd.post(%server, %serverpath @ %requeststring, "", %upd);
}

function ShifterNews::onLine( %this, %line )
{
	ShifterNewsText.setText (ShifterNewsText.getValue() @ "\n" @ %line);
}

#1
10/19/2001 (8:09 am)
Pretty cool :) I thought I'd mention that in 1.1 the GuiScrollContentCtlr class was removed and all it's functionality moved into GuiScrollCtrl. To port this, or any 1.0 script over to 1.1, simply remove the GuiScrollContentCtrl from your gui scripts.
#2
01/27/2002 (1:48 pm)
I also believe that SecureHTTPObject is no longer there, HTTPObject is though. I could be wrong. Just an FYI if SecureHTTPObject doesn't work.
#3
07/29/2005 (7:03 am)
it's better to get info with mysql (look up that resource)