ScreenText()

From Hack Wars Wiki

Jump to: navigation, search

This function is designed to draw text across the screen over time, as if someone were typing it. It looks cool and can be very useful for certain types of games.

Code

void screenText(string text, int stop, int x, int y) {
	if (getGlobal("screenTextTime")!="true") {
		setGlobal("screenTextB", 0);
		setGlobal("screenTextContent", "");
		createTimeStamp("screenText"); setGlobal("screenTextTime", "true");
	}
	int bb=0;
	int aa=getGlobal("screenTextB");
	int checkit=checkTimeStamp("screenText");
	if (aa<strlen(text) && aa<=stop) {
		if (checkit>=20) { setGlobal("screenTextB", aa+1); aa++; }
	}
int line=1;
int oldbb=0;
 
	while (bb<aa && bb<stop) {
		oldbb=bb;
		bb=indexOf(text, char(10), bb+1);
		if (bb==-1 || bb>aa) bb=aa;
		drawText(substr(text, oldbb, bb),"Lucida Console",10,x,y,255,255,255,255);
		line++;
		y=y+10;
	}
	//lastline=y;
}


For more information, see the following:

getGlobal()

setGlobal()

createTimeStamp()

checkTimeStamp()

indexOf()

drawText()

substr()


--Surfpup 19:42, 23 November 2008 (UTC)

Personal tools