- Home /
Syntax Errors on Detection Script
Hello all. I have three really simple errors and I can't figure them out. I feel like I am missing something small like a bracket. Take a crack at it, maybe I just need an extra pair of eyes. Thanks alot.
(25,18): BCE0044: expecting ), found '='.
(25,20): BCE0043: Unexpected token: false.
(27,6): BCE0044: expecting :, found '='.
var playAni : MonoBehaviour; var handelRotate : MonoBehaviour; var doorNotReady : boolean = false; var waiting : boolean = false; var left : boolean = false;
function OnTriggerEnter () {
//When entered, the door is delared ready and it starts an animation
left = false; doorOpen = true; waiting = true; wait();
playAni.PlayOpen(); handelRotate.PlayOpen();
}
function OnTriggerExit () {
//If the door is not ready, and player has left, close the door
if (doorNotReady = false) {
left = true;
playAni.PlayClose(); handelRotate.PlayClose();
}
}
function wait () {
//Wait for two seconds then declare the door is not ready
yield WaitForSeconds(2);
doorNotReady = false;
}
function Update () {
//When it has waited, and the person is out of the collider, open the door
if (doorNotReady = false && waiting = false && left = true) {
playAni.PlayClose(); handelRotate.Play
}
Answer by clunk47 · Jul 02, 2013 at 02:59 AM
It's just one error actually causing all three. In an if() statement, you need two equals signs.
Change if (doorNotReady = false) to if (doorNotReady == false)
OR
if(!doorNotReady)
The exclamation point in front of doorNotReady means "not". If you wanted to ask if it were true, you could say if(doorNotReady)... Hence no exclamation mark, no "not" statement.
Yep, I really don't know what I was thinking there. I guess I was working too fast. Thanks for the correction, its really appreciated!
always happy to help, happens to me all the time and I greatly appreciate the help I get from this community :D