Global variables!

I cannot, for the life of me, get my variable recognized in another script. Please don't say just read this, because I have. Here is my code.

static var population = 120;
static var happiness = 60.0;
static var food = 500;

function Update () 
{
     if (population > food) 
        happiness -= 0.01 * Time.deltaTime;
}

And my second script,

var farms = 4;
var harvest = farms * 10;

function Update () {
    food = food += harvest * Time.deltaTime;

}

EDIT:

When they are static my variables don't even show up,

They work just fine when I have them as normal variables though.

Sorry, I'm new to scripting and am kind of terrible at it. Trying to get better though.

EDIT: Alright I now have it showing up but the second script doesn't work now! And I have no errors! Please help. Here's the code.

  var population = 100;
static var food = 500;
var foodvalue = food;
var happiness = 60.0;

function Update ()
{
    if (population > food)
       happiness -= 0.01 * Time.deltaTime;
}

and the second script:

      var farms = 4;
    var harvest = farms * 10;

    function Update (){
         PopulationScript.food += harvest * Time.deltaTime;

}

At the bottom of the page you said you have read is explained what you need to do.

function Update () {
    PopulationScript.food += harvest * Time.deltaTime;

}

OtherScript.food += harvest*Time.deltaTime; 

Not sure I understand exactly but if I have this right:

If your static vars reside in Class1 and you are trying to access them in Class2 then you must refer to this variables as Class1.staticVariable

Hope that helps.

==

Static variables will not show up in the inspector. If you need to set up a global from the inspector, you will need a variable to set.

var FoodStatSetting : int;
static var GlobalFoodStat : int;

function Awake(){
GlobalFoodStat = FoodStatSetting;
}

// now you can access “GlobalFoodStat” as a static, and you can set it by changing the FoodStatSetting in the inspector and restarting the test run. You could also move the line of code into Update if you don’t want to restart each time.

Wow… reading this im just wondering… are you the dev behind Banished?