Highscore error when comparing int with array

Hi there,
I’m working on a local highscore in my sidescroller game, but I don’t know how to fix this error. Can anybody help me with this code?

static var newHighscore : boolean = false;

static var dead : boolean = false;

private var nameEntry : boolean = false;

private var newHighscoreRank : int;

private var highscoreName = Array(String);

private var highscore = Array(int);

private var names : String;

private var scores : int;

var newScore : int = 0;

var newName : String = “Player1”;

highscore.length = 10;
highscoreName.length = 10;

for (i=0;i<10;i++) {

if (PlayerPrefs.HasKey(i+“Scorename”)) {

newScore = PlayerPrefs.GetInt(i+“Score”);
newName = PlayerPrefs.GetString(i+“Scorename”);
}
highscore.Add(newScore);
highscoreName.Add(newName);

if (dead) {

if (scores > highscore*) {*

newHighscore = true;
newHighscoreRank = i;
if (nameEingabe) {

for (j = i+=1; j < 10 ; j++) {

highscore[j] = highscore*;*
highscoreName[j] = highscoreName*;*
}
highscore = scores;
highscoreName = names;
}
}

PlayerPrefs.SetInt(i+“Score”,highscore*);*
PlayerPrefs.SetString(i+“Scorename”,highscoreName*);*
}
}
}
When I run the code it returns this error:
MissingMethodException: Method not found: ‘System.Int32.op_GreaterThan’.
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create ()
Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[] args)
Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[] args)
Boo.Lang.Runtime.RuntimeServices+c__AnonStorey12.<>m__6 ()
Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args)
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
Rethrow as MissingMethodException: Greater than is not applicable to operands ‘System.Int32’ and ‘System.MonoType’.
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
Platformen.AddScore () (at Assets/Assets/Scripts/Platformen.js:70)
Platformen.OnGUI () (at Assets/Assets/Scripts/Platformen.js:132)
line 70 is where it says ‘if (scores > highscore*) {’*
Does anybody of you know how to fix this?
Thanks! :wink:

Try taking the ‘int’ out of new Array (int) and use new.

private var highscore = new Array();

and actually, you should do the ‘new’ in Start:

function Start()
{
  highscore = new Array();

I tried, but now it says:

NullReferenceException: Object reference not set to an instance of an object Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs) Platformen.AddScore () (at Assets/Assets/Scripts/Platformen.js:70) Platformen.OnGUI () (at Assets/Assets/Scripts/Platformen.js:132)

Thanks for answering! :wink: