How to load specific text into the GUI?

My player character can click on a object and choose what actions to do with it (LookAt, Open, etc).
If those actions are not possible he will reply with a line of text like:

“I cant get there”
“It’s empty.”
etc…

So far I’ve been doing a .js file and adding static variables there like:

static var cannotReachObject = "'I can't get there.'";

But I would like to do something more clean. I know there are lists and arrays and some people even have just tons of lines inside a .txt file. I’m not fully sure how to achieve that but what I was imagining is having a function with all the thoughts that could be loaded for the different actions, something like this:

function PlayerSays (text : String){
	var cannotReachObject = "'I can't get there.'";
	var emptyContainer = "'It's empty.'";

// enable the text GUI, say the selected line, leave it for 3 secs and then turn it off
	showThoughts = true;
	text //
	yield WaitForSeconds (3);
	showThoughts = false;
}

And ideally I would just have to write for the action:

function PlayerSays (cannotReachObject);

I’m just learning Unity so my knowledge on how to achieve this is very limited… I understand the concept of what I’m trying to do but i can’t figure out how to actually write it.

Any help very appreciated!

– UPDATE –

This is what I kind of have. Currently doesn’t work and just feels redundant:

var customSkin : GUISkin;
var showThoughts = false ;
var thoughts : String;


    function OnGUI () {
    		GUI.skin =  customSkin;
    		GUI.depth = 1;
    	if (showThoughts == true){
    		GUI.Label (Rect ((Screen.width * 0.5) - 500, (Screen.height - Screen.height * 0.2) + 40, 1000, 40), thoughts , GUI.skin.customStyles[1]);
    	}
    }
    
    function PlayerSays (text : String){
    	
    	if(text == "cannotReachObject"){
    		thoughts = "'I can't get there.'"; 
    	}
    	if(text == "emptyContainer"){
    		thoughts = "'It's empty.'";
    	}
    	
    	showThoughts = true;
    	yield WaitForSeconds (1);
    	showThoughts = false;
    
    }

Hello, I have to say that I don’t really understand your question fully but I’ll try to answer anyway!

So what you want is a text that shows a certain text, okay, that’s easy!

To be clear I won’t give you a full script, I will give you a strip of code which will help you:

var guiText : GUIText;
var text1 : String = "Hello World"
var text2 : String = "This is Hybris2"
var text3 : String = "Giving an answer"

function Update(){

    Invoke("ChangeTxt", 3);//This will call the function every 3 seconds

}

function ChangeTxt(){

    if(textCount == 1){

        guiText.text = text1;
        textCount ++;

    }

    if(textCount == 2){

        guiText.text = text2;
        textCount ++;

    }

    if(textCount == 3){

        guiText.text = text2;
        textCount = 0;

    }//you could of course use cases, but for the sake of ease i'm using if's


}

I cant test it right now, so good luck, if you have problems feel free to ask!