Iphone timer error won't build?

i was using this code to keep track to time in my game and also to change the scene once the time had reached 0 (well -1 wouldn’t work with 0 not sure why) it was working fine on loads of tests i then clicked build and run to see it it worked on my iPhone and i receive errors with this script file unfortunately i don’t understand what iv done wrong if anyone could please help… heres the error codes i get and my script if its any help

Assets/Timer.js(37,29): BCE0051: Operator ‘-’ cannot be used with a left hand side of type ‘float’ and a right hand side of type ‘Object’.

Assets/Timer.js(41,5): BCE0005: Unknown identifier: ‘restSeconds’.

Assets/Timer.js(47,42): BCE0005: Unknown identifier: ‘restSeconds’.

Assets/Timer.js(56,5): BCE0005: Unknown identifier: ‘text’.

Assets/Timer.js(63,41): BCE0005: Unknown identifier: ‘text’.

private var roundedRestSeconds : int;

private var displaySeconds : int;

private var displayMinutes : int;

var TimeLeft = "Time Remaining:"; 

var countDownSeconds : int;

var mySkin : GUISkin;


function Awake() {

    startTime = Time.time;

}

 

function OnGUI () {

    GUI.skin = mySkin;

    var guiTime = Time.time - startTime;

    restSeconds = countDownSeconds - (guiTime);

    roundedRestSeconds = Mathf.CeilToInt(restSeconds);

    displaySeconds = roundedRestSeconds % 60;

    displayMinutes = roundedRestSeconds / 60; 

    text = String.Format ("{0}:{1:0}", displayMinutes, displaySeconds);
    
 if ( displaySeconds == -1)
 	{
 		Application.LoadLevel(1);
 		}

    GUI.Label (Rect (120, 40, 110, 30), text);

     GUI.Label (Rect (20, 40, 110, 30), TimeLeft);
}

You must declare all variables by using “var”, and you must define the type for all variables, either explicitly, or implicitly by supplying a value. Make sure “#pragma strict” is at the top of all your scripts.

–Eric

sorry but i still don’t understand i have added the #pragma strict to the top of the script file, the errors that seems to stay no matter what i attempt are on lines 39 and line 65 but i can’t see what the problem is and it was working running on the pc a few moments ago

I don’t know what lines 39 and 65 are. You should put #pragma strict on all scripts so they work the same on all platforms.

–Eric

sorry i forgot to post the script, the problem seems to be on line 31 and line 51

#pragma strict

var startTime;

var roundedRestSeconds : int;

var displaySeconds : int;

var displayMinutes : int;

var TimeLeft = "Time Remaining:"; 

var countDownSeconds : int;

var mySkin : GUISkin;

var restSeconds;

var text;
function Awake() {

    startTime = Time.time;

}

function OnGUI () {

 
    GUI.skin = mySkin;

    var guiTime = Time.time - startTime;
 
    restSeconds = countDownSeconds - (guiTime);

    roundedRestSeconds = Mathf.CeilToInt(restSeconds);

    displaySeconds = roundedRestSeconds % 60;

    displayMinutes = roundedRestSeconds / 60; 


 	

    text = String.Format ("{0}:{1:0}", displayMinutes, displaySeconds);
    
 if ( displaySeconds == -1)
 	{
 		Application.LoadLevel(1);
 		}

    GUI.Label (Rect (120, 40, 110, 30), text);

     GUI.Label (Rect (20, 40, 110, 30), TimeLeft);
}

Please read my previous post, specifically the part about declaring the types of variables.

–Eric