Scripts not functioning or interacting.

Ok, so after the last time I posted this thanks to a few kind people, I saw that I had glazed over some just stupid things that I didn’t think about when originally writing my scripts. Now I have removed those aspect and added a few log entry calls so whenever an action is performed it’s logged.

Anyways to the point my scripts are still not interacting the way I wan’t them to or not at all.

The script I have checking the number correct doesn’t seem to work if I assign the adding of numbers to any function other than Update and if I set it in update it simply adds 1 to the number every frame the second the game is started.

The script in question:

#pragma strict

var correct : int = 0;
var callTrue : boolean;	

function Start() {

correct = 0;
callTrue = false;

}

function Update(){

if(correct == 25){

	Debug.Log("Win");
	}
}

function Go(){

correct = correct + 1;

Update();

}

And just in case you wan’t the script making the calls to this one.

#pragma strict
 
 var checkTrue = boolean;
 var correctCor : Vector3;
 var card : GameObject;
 
 function Update () {
 
 var ArrayScript : ArrayCorrect = GetComponent(ArrayCorrect);
 
 if(card.transform.position == correctCor){
        Debug.Log("I'm at the spot D:");
 		ArrayScript.Go();
 		Debug.Log("Adding one to ArrayCorrect.js");
 	}
 }

I’m sure I’m just glazing over something but sometimes I genuinely need other people to just point things out for me that I would otherwise catch.

Thanks in advanced.

Try this, I’ve stripped out everything that is not specific to your code above :

#pragma strict
 
var correct : int = 0; 

//I've removed your Start() function
//As far as this is concerned you
//are setting the "correct" value above
//and it is unnecessary. 

function subGo(){
    correct = correct + 1;
}

and :

#pragma strict

var correctCor : Vector3;
var card : GameObject;
var ArrayScript : ArrayCorrect;

//Find your script here, not every frame!
function Awake() {

    //I'm assuming your ArrayCorrect is on the same
    //object as this script.
    ArrayScript = GetComponent(ArrayCorrect);
}

function Update() {

    if (card.transform.position == correctCor) {
        ArrayScript.subGo();
    }

    if(ArrayScript.correct == 25) {
        Debug.Log("Win");
    }
}

If you are having problems formatting your code here properly let us know, we can help, if you write your code like in your question then try and learn how to format it better. You, I, and everyone here will be able to read it better and figure out your problem faster if you do :slight_smile:

Sorry all for the repeated edits, I have had a little bit of wine :slight_smile: