- Home /
Question by
eeveelution8 · May 30, 2014 at 09:19 PM ·
javascripterrorghostphantom
a 'phantom' error.
in this script i have,
var opensavingthrow : int = 1;
var hacksavingthrow : int = 1;
var amiaHACKdoor : boolean = false;
var playerholder : GameObject;
var player : player_script;
function OnTriggerEnter (other : Collider) {
if(amiaHACKdoor == true){
if(other.GetComponent(player_script).Hackskill >= hacksavingthrow){
DestroyObject (gameObject);
player.pointtext.text = "-door hacked open.";
}
else if(other.GetComponent(player_script).Openskill < opensavingthrow){{
player.pointtext.text = "-Hack skill required:"+hacksavingthrow;
}
}
else if(amiaHACKdoor == false){
if(other.GetComponent(player_script).Openskill >= opensavingthrow){
DestroyObject (gameObject);
player.pointtext.text = "-door picked open.";
}
else if(other.GetComponent(player_script).Openskill < opensavingthrow){{
player.pointtext.text = "-Lockpick skill required:"+opensavingthrow;
}
}
}
function Start(){
playerholder = GameObject.FindGameObjectWithTag("Player");
player = playerholder.GetComponent(player_script);
}
but comes up with the error,
Assets/scripts/skilltest.js(16,47): BCE0044: expecting :, found '='.
but at that line,
player.pointtext.text = "-Hack skill required:"+hacksavingthrow;
there is no equals sign at that point, the error message says it's in the middle of the word skill, in the string. I tried copying the script, deleting it, making a new script, and pasting it in, but that didn't work.
Any ideas?
Comment
Best Answer
Answer by tw1st3d · May 30, 2014 at 09:22 PM
else if(other.GetComponent(player_script).Openskill < opensavingthrow){{
needs to be
else if(other.GetComponent(player_script).Openskill < opensavingthrow){
There are actually two lines, 15 and 25 both have the same error. An extra {
Your answer
![](https://koobas.hobune.stream/wayback/20220613150305im_/https://answers.unity.com/themes/thub/images/avi.jpg)