Can someone help me with this script please

hi,

I have a script to make a messagebox that appears after a couple of seconds on the screen,

but i get an error ;

Assets/Guimessgage.js(5,7): BCE0077: It is not possible to invoke an expression of type 'int'.

here is the code ;

var WaitSeconds = 10;

function OnGUI () {
  if (WaitSeconds (10)) {
     GUI.Box (Rect (10,10,280,30), "To show the mouse press ESC button");
  }
}

What am i doing wrong.

I also wan't a audioclip to sound when the messagebox appears on the screen.

how do i do that ?

Any help is welcome !

is this what you are after?

var WaitSeconds : int = 10;
var showGUI : boolean = false;

function Start ()
{
   WaitFunction();
}

function WaitFunction()
{
   yield WaitforSeconds (WaitSeconds);
   showGUI = true
}

function OnGUI () 
{
  if (showGUI == true)
  {
     GUI.Box (Rect (10,10,280,30), "To show the mouse press ESC button");
  }
}

OnGUI is ran every single frame. It's equal to Update. Having said this, you can't do a yield/WaitForSeconds (It isn't WaitSeconds) as that stops the frames.

Unless you have a method called WaitSeconds which takes the int you passed in, and then returns true when it's above the time...

So, what I'd do. Have a temp time, make it equal to the System time.

Then have an if statement comparing the current time and that one so like.

var tempTime =  System.DateTime.Now.TimeOfDay.Seconds;
function OnGUI()
{
    if(tempTime+3 > System.DateTime.Now.TimeOfDay.Seconds)
    {
        //draw
        //play sound
    }
}

As for adding sounds: http://unity3d.com/support/documentation/ScriptReference/AudioSource.html

Hope this helps! =)