Using a Variable from another Javascript.

ScriptOne.js

public var dog : int =0;

Then the value of dog changes to 42

Now I want to write another script

ScriptTwo.js

public var cat : int =0:

Then how do I make cat = dog (from ScriptOne.js)

so cat = 42 or the current value of dog.

//ScriptOne.js

static var dog : int =0;


//-----

//ScriptTwo.js

static var cat : int =0:

//in function 

cat = ScriptOne.dog;

maybe something like this
you can also send messages to functions… but this is closer to your approach.

Also you could try

var cat = int;

function Update(){
if(firstScriptName.Dog >= 10){
cat = 1;
}
if(firstScriptName.Dog >= 20){
cat = 2;
}
else {
cat,needsToiletPaper*4;
  }
}

This way you could update when needed(ie)Like every ten dogbones the cat gets one bowl of milk.

So what kind of game you making? :smile: