GUIText not displaying

Heyo; so encountering a rather weird problem.

So I’ve got GuiText that is supposed to be spoken dialogue and is being triggered by booleans in several separate scripts. How it’s being triggered is that when the text is being triggered, I’m using .enabled to display the text. Then a function is called using yield Waitforseconds after 3 seconds, the Guitext is being told to disable using .enabled.

Problem I keep running into is that the first two parts of text are triggered, and I can see them find. After the first two, then suddenly the other text isn’t being displayed. I do have print statements in place that tell me if they’re being triggered or not. And I’m getting the print statements, but for some reason the text still isn’t being displayed?

Ideas?

(and yeah, using javascript for this one)

var Convo : GUIText ; 
static var fishMonger : boolean = false;
static var fishStart : boolean = false; 
static var read : boolean = false; 
static var houseCounter : int = 0; 

function Start () {

	Convo.enabled = true;
	Convo.text = "Damn, it's Tuesday...

time to go back to the old slog";

	//Convo.text = "*phew* Almost done for today! Gotta get at least 3 more seashells";
	conKiller();
}

function Update () {


	if(houseCounter == 1){ 
		
		Convo.enabled = true;
		Convo.text = "First I gotta check in with Mr Sage to go to work";
		conKiller();
		
	}
	
	if(fishStart == true){ 
		
		Convo.enabled = true;
		Convo.text = " 'Ah, there you are!' 

‘Well, you know the drill: collect as many shellfish as you can’ ";
conKiller();
}

	if(SeaShellController.seaShells == 1){ 
		
		Convo.enabled = true;
		Convo.text = "Ok, that's 1 shell. Need 2 more";
		conKiller();
	} 
	
	if(SeaShellController.seaShells == 2){ 
		
		Convo.enabled = true;
		Convo.text = "That's 2. One more to go...";
		conKiller();
	}
	
	if(SeaShellController.seaShells == 3){ 
		
		Convo.enabled = true;
		Convo.text = "And 3! ";
		conKiller();
	} 
	
	/*if(BottleController.bottleUp == true){ 
		Convo.text = "What is this bottle? And why is it...glowing?";
		conkiller();
	}*/
	
	if (fishMonger == true){ 
		
		Convo.enabled = true;
		Convo.text = " 'Ah, thank you for the shellfish! Have a good night' ";
		conKiller();
	}
	
	if (houseCounter >= 2){ 
		if(BottleController.bottleUp == true){

			Convo.enabled = true;
			Convo.text = "I should have something here to open this bottle...";
			conKiller();
		}
	}
	
	print("Seashells: " +SeaShellController.seaShells);
	print("# of House enters :" +houseCounter);
	
	/*if (read == true){ 
		Convo.text = "Uhm...it's not supposed to be night yet";
	}*/
} 

function conKiller(){
	yield WaitForSeconds (3);
	Convo.enabled = false;
}

Interesting…you’re script looks good, but check line 67 and see if this does anything:

if (houseCounter >= 2 && BottleController.bottleUp == true){

The code is spraying the conKiller coroutine. I think it needs a rewrite to act on changes and not just values.

Spraying: suppose houseCounter just became 1. Update pops up the 1st message and says to hide it in three secs. All fine and well. But every frame after that, houseCounter is still 1, so it STARTS ANOTHER conKiller() After three seconds, you have a line of 180 of them. One now “lands” every frame, making it permanently closed (since you start a new conKiller every frame.)

To test, have conKiller print something. It should blast output after a bit.

Rewrite: this is what people mean when they say a State Machine. Somewhere else in the code, someone increases houseCounter to 1. Have that person print the message and fire conKiller. The idea is, update can’t tell if houseCount became 1 just now, but the person increasing it can. The goal is to run message+3secClose only once, when the count first hits 1.

Or, in this case, I almost prefer using a float convoCloseTime and set it to Time.time+3. Otherwise you might get a message, get a new one after 2.5 secs, then .5 secs later the new message gets closed by the 1st message’s 3-sec timer.

Or, use flags to only run each IF one time.