Missing Documentation on accessing Variables

The following link is down:
http://docs.unity3d.com/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html

I have been having issues accessing a variable from one script on a GUI text to a second script attached to a another GUI text.

My searches keep pointing me to this dead link. This is a pretty basic issue. I would like to do it in Javascript.

here is my code:

Script 1: Timer.js - On first GUI Text

function Update ()
{

     var gameTime = Time.time;

     var playerDays : float = 0;
 
     guiText.text = gameTime.ToString();

     if(gameTime > 30)
    {
     playerDays ++;

     guiText.text = "A day in game time";
    }

}

Script 2: Player Days.js - On Second GUI Text

function Update ()
{

  playaDays = Timer.playerDays;

  guiText.text =  playaDays.ToString();

}

I would like to get the value for playerDays in Timer.js in Player Days.js
Thank you for any help

Does the word ‘scope’ sound familiar at all?

At the minute PlayaDays is within the scope of the Update function - it doesn’t exist outside of the function.

To make it accessible from another script you need to define it in the ‘global scope’

var playaDays : float = 0;

function Update()
{
 var gameTime = Time.time;

 guiText.text = gameTime.ToString();

 if(gameTime > 30)
 {
     playerDays ++;

     guiText.text = "A day in game time";
 }
}

With your code as-is, playerDays shouldn’t ever not be 0 because at the start of every frame you’re assigning 0 to it.

Then from your other script, use GetComponent().playaDays.