- Home /
Please insert semi colon... WHAT!?!
my computer keeps on saying that i don't have a semi colon at the end of lines 22 and 18
My Scripts Below:
var speed = 24.0;
var rotateSpeed = 3.0;
var bullitPrefab:Transform;
function Update () { var controller : CharacterController = GetComponent(CharacterController);
// Rotate around y - axis;
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
// Move forward / backward
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);
if(Input.GetButtonDown("X"));
var bullit:Instiniate (bullitPrefab) GameObject.Find("Spawn Point")transform.position Quaternion.identity;
EOF;
script RequireComponent (CharacterController);EOF }
I don't know the problem PLEASE HELP!!!
please don't ask a duplicate question just because no one answered the first right away.
Answer by aldonaletto · Feb 12, 2012 at 08:28 PM
This error isn't always what it pretends to be: other syntax errors may fool the compiler and produce this error message. The rule is simple: if the line already has a semicolon, the error is something else before the line.
The script above have several errors in the two last lines, which may generate this error:
if(Input.GetButtonDown("X")); var bullit:Instiniate (bullitPrefab) GameObject.Find("Spawn Point")transform.position Quaternion.identity;The right thing should be something like this:
if (Input.GetButtonDown("X")){ var bullit = Instantiate(bullitPrefab, GameObject.Find("Spawn Point").transform.position, Quaternion.identity); // the code to accelerate the "bullit" is missing, but resembles this: bullit.rigidbody.velocity = transform.forward * speed; Destroy(bullit.gameObject, 2.0); // kill lost bullets after 2 seconds }You should check the Tornado Twins worm tutorial more carefully (that's where this came from) because there are more things missing - like the code to accelerate the projectile, for instance.
I've tried your suggestions but it gives another error ... I don't know if it's the scripting program i'm using or what. I am getting very frustrated because i can't test the game out until I figure out the scripting errors. I've tried doing the 'Tornado Twins', but it gives me a error that I can't figure out!!!! If it helps here are what the errors say...
-Assets/NewBehaviorScript.js(19,7): UCE0001: ';' expected. Insert a semicolon at the end. -Assets/NewBehaviorScript.js(19,32): UCE0001: ';' expected. Insert a semicolon at the end. -Assets/NewBehaviorScript.js(19,63): UCE0001: ';' expected. Insert a semicolon at the end. -Assets/NewBehaviorScript.js(19,72): UCE0001: ';' expected. Insert a semicolon at the end. -Assets/NewBehaviorScript.js(19,81): UCE0001: ';' expected. Insert a semicolon at the end. -Assets/NewBehaviorScript.js(19,92): UCE0001: ';' expected. Insert a semicolon at the end. -Assets/NewBehaviorScript.js(21,7): UCE0001: ';' expected. Insert a semicolon at the end. -Assets/NewBehaviorScript.js(21,45): UCE0001: ';' expected. Insert a semicolon at the end. -Assets/NewBehaviorScript.js(21,48): UCE0001: ';' expected. Insert a semicolon at the end.
-All compiler errors have to be fixed before you can enter playmode! UnityEditor.SceneVeiw:ShowCompileErrorNotification()
Also, I made some changes to my script...
var speed = 24.0; var rotateSpeed = 3.0; var bullitPrefab:Transform;
function Update () { var controller : CharacterController = GetComponent(CharacterController);
// Rotate around y - axis; transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
// $$anonymous$$ove forward / backward var forward = transform.TransformDirection(Vector3.forward); var curSpeed = speed Input.GetAxis ("Vertical"); controller.Simple$$anonymous$$ove(forward curSpeed);
if (Input.GetButtonDown("X"))
bullit Instiniate(bullitPrefab) GameObject.Find("Spawn Point")transform position Quaternion identity;
script RequireComponent(CharacterController)EOF } PLEASE ANSWER $$anonymous$$Y PRAYERS!!!!!!: )
Spelling is terribly important. $$anonymous$$ake sure you spell everything correctly, and that you have all the correct brackets and punctuation. From the looks of things, you need some '=' signs, and some '.' inbetween some of your words- if you can't see the patterns here, you should have a look at some (very) basic scripting tutorials.
Also, isn't TornadoTwins in C#? This looks like JS to me.
Well, in my answer I pointed the error and posted the fixed version, but you ignored it! It could seem impossible, but the last lines are even more wrong than before! Take a look at my answer and fix the errors.
Answer by BiG · Feb 12, 2012 at 08:09 PM
For sure,
if(Input.GetButtonDown("X"));
wasn't your intention. In fact, a semicolon after an if statement will break the statement immediately. Just remove ";" from that line.
Moreover, the next line is a mess ^_^ I don't know what you was trying to do there!
Your answer
Follow this Question
Related Questions
java script problem 0 Answers
"Insert a semicolon at the end." But there is a semicolon already!! 1 Answer
Another "insert semicolon at end" 1 Answer
Double semi-colons 1 Answer
UCE0001 ";" expected. insert a semicolan at the end? 1 Answer