Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

HELP!!

Discussion in 'Scripting' started by cthanold, Aug 26, 2014.

  1. cthanold

    cthanold

    Joined:
    Aug 26, 2014
    Posts:
    1
    I need help! a trouble code says Assets/MeleeSystem.js(3,20): UCE0001: ';' expected. Insert a semicolon at the end.

    I DON'T KNOW WHAT LINE THEY ARE REFERRING TO! Help would be much appreciated so I can get this FPS underway.
     

    Attached Files:

  2. GarthSmith

    GarthSmith

    Joined:
    Apr 26, 2012
    Posts:
    1,240
    I'm not too familiar with UnityScript, but this looks suspect. Notice the equal sign.
    Code (csharp):
    1. // Incorrect
    2. var TheDamage : int - 50;
    3.  
    4. // I think you want one of these?
    5. var TheDamage : int = 50;
    6. var TheDamage : int = -50;
     
    Last edited: Aug 26, 2014
    wilsonc911 and image28 like this.
  3. GarthSmith

    GarthSmith

    Joined:
    Apr 26, 2012
    Posts:
    1,240
    Also, the line number is the 3 in MeleeSystem.js(3,20). That means row/line 3, column/character 20.
     
    Polymorphik likes this.
  4. wilsonc911

    wilsonc911

    Joined:
    Aug 8, 2014
    Posts:
    9
    Does character 20 include white space from indents?
     
  5. GarthSmith

    GarthSmith

    Joined:
    Apr 26, 2012
    Posts:
    1,240
    Yes. Indents are usually 4 spaces. If you're using a monospaced font, column 20 should be the same column of characters on the entire document.

    In this specific example, the compiler got to the negative sign and decided something was wrong.
    Code (csharp):
    1. // Negative sign doesn't make sense!
    2. var TheDamage : int - 50;
    3.  
    4. // Compiler is expecting something like this.
    5. var TheDamage : int;
     
    Last edited: Aug 26, 2014