x


unexpected token

what does it mean when it says there is an unexpected token in a script like:

unexpected token: camera

unexpected token: strict

unexpected token: implicit

can anyone help with this cos i need the script for my homework and only have a few days left to complete it. thanx

here is the script

 camera: main#pragma strict

 #pragma implicit

 #pragma ;downcast;

another problem on a different script it

expecting } found ;. ( character 22)

and here is the line of code with the problem but i cant find where to put the } cos every where creates more problems with it.

public var camera; ;: main; camera;

thanx again for any help

more ▼

asked Apr 20 '11 at 12:45 PM

monty gravatar image

monty
10 6 6 8

i have managed to get these problems to go away now by having 'camera: main' instead of main camera but it now says it wants eof instead of camera does anyone know what that means and how to solve it?

Apr 20 '11 at 01:01 PM monty

check updated answer

Apr 20 '11 at 02:36 PM AngryOldMan
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

unexpected token: camera means you have the word camera in there and your not using it properly. look at the camera script reference you should spot your problem straight away.

  #pragma strict
  #pragma implicit
  #pragma downcast

dont need to be in your script unless your optomising it for online play and they should be at the very top of the page.

an eof is an end of function which is this } character you put it at the end of functions!

//example

function Start()
{
   DoSomething();
}

function DoSomething()
{
   if (SomethingHasNotBeenDone)
   {
      Debug.Log ("Do Something Else");
   }
}

ignore the meaning of the words and look at how the eof is used, there is always a start of function and end of function just like you would use sentances and paragraphs in literary English

EDIT

if you are finding errors asking for eofs and there are already ones there it means the syntax for the previopus line is incomplete, have a look at the line above and check that the parametres you have put in match the ones on the script reference for it

more ▼

answered Apr 20 '11 at 01:29 PM

AngryOldMan gravatar image

AngryOldMan
2.5k 12 21 47

this is the top of the page and camera is the first word but it is saying it needs eof. thanx for the help btw it was really helpful

Apr 20 '11 at 01:37 PM monty

i have deleted those things now cos this isnt designed for online but nod it says i need ;'s in places where there are already some there

Apr 20 '11 at 01:41 PM monty
(comments are locked)
10|3000 characters needed characters left

It sounds like there's a simple parsing error in your script (e.g. a mismatched brace). If you need more specific help than that, edit your post to include the script that's generating the error.

more ▼

answered Apr 20 '11 at 01:13 PM

Jesse Anders gravatar image

Jesse Anders
7.3k 7 17 48

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x239
x198
x34
x12

asked: Apr 20 '11 at 12:45 PM

Seen: 2893 times

Last Updated: Apr 24 '11 at 10:02 PM