Page 1 of 1

Any idea why this doesn't work?

Posted: May 18th, 2010, 4:42 pm
by Rezil

Code: Select all

start()

{
	for(;;)
	
	{
	
		players = getentarray("player", "classname");
		for(i = 0; i < players.size; i++) 
		
		{
			
		if ((!isdefined(players[i].reset)) && (isalive(players[i])))
			
			{
				
			players[i].reset = true;
			players[i].have_messhall_key = false;
			players[i] thread CruiseHUDStuff();
				
			}
		}
		wait 0.5;
	}
}

CruiseHUDStuff()

{

	if(!isdefined(self.objective_one))
	{
		
		self.objective_one = newclienthudelem(self);
		self.objective_one.x = 36;
		self.objective_one.y = 100;
		self.objective_one.allignx = "center";
		self.objective_one.alligny = "middle"; 
		self.objective_one.alpha = 1;
		self.objective_one.fontScale = 1; 	
		self.objective_one.color = (1, 1, 1);
		self.objective_one settext(&"blah.");
	}


	else if(!isdefined(self.objective_two))
	{

		self.objective_two = newclienthudelem(self);
		self.objective_two.x = 10;
		self.objective_two.y = 265;
		self.objective_two.allignx = "center";
		self.objective_two.alligny = "middle";
		self.objective_one.alpha = 1;
		self.objective_two.fontScale = 1; 	
		self.objective_two.color = (1, 1, 1);
		self.objective_two settext(&"blah2");
	}
}
Any clue as to why this doesn't display any text on the screen?

Re: Any idea why this doesn't work?

Posted: May 18th, 2010, 5:09 pm
by Drofder2004
try doing "setValue(999)" to test if the HUD is being displayed correctly.
Not sure, but you may need to precache text.

Re: Any idea why this doesn't work?

Posted: May 18th, 2010, 5:13 pm
by Rezil
Drofder2004 wrote:try doing "setValue(999)" to test if the HUD is being displayed correctly.
Not sure, but you may need to precache text.
Tried both, it DOES display value, it can also display shaders, tried precaching strings and they do show(as .label = &"text";), but that means I cannot change them via script anymore which is what I want.

What's more, using level.blah settext("text"); displays text correctly, setting it for one person doesn't...

Re: Any idea why this doesn't work?

Posted: May 18th, 2010, 5:23 pm
by Drofder2004
level.hudtext = "Text";
self.hud setText(level.hudtext);

That is basically how it is done with the voting hud for the CJ mod.

Re: Any idea why this doesn't work?

Posted: May 18th, 2010, 5:26 pm
by Rezil
Right, but the variable hudtext is global in your case, I want a variable only for one player.

Re: Any idea why this doesn't work?

Posted: May 18th, 2010, 9:28 pm
by Drofder2004
Rez|l wrote:Right, but the variable hudtext is global in your case, I want a variable only for one player.
The make it self.hudtext?

Re: Any idea why this doesn't work?

Posted: May 18th, 2010, 11:57 pm
by Rezil
Tried it, doesn't work. I've made a workaround so it doesn't matter anymore. Thanks for trying to help.

Re: Any idea why this doesn't work?

Posted: May 19th, 2010, 12:33 am
by Drofder2004
No probs.