+ Reply to Thread
Results 1 to 5 of 5

Thread: How can I fix these simple syntax errors? (simple to you)

  1. #1
    Wirererer Shizzle3's Avatar
    Join Date
    Apr 2009
    Posts
    103

    Question How can I fix these simple syntax errors? (simple to you)

    Code:
    if (LS == "annoy" & Annoy = 0)
    {Annoy = 1}
    elseif (LS == "annoy" & Annoy = 1)
    {Annoy = 0}
    
    if (LS == "cloak" & Cloak = 0)
    {Cloak = 1}
    elseif (LS == "cloak" & Cloak = 1)
    {Cloak = 0}
    Hey, Im getting this error. "Right parentesis missing to close if-statement"
    It works fine if I take out the "& Annoy = whatever" and "& Cloak = whatever", But I need those to be able to toggle the commands. Can anyone reformat this for me? I cant figure this out.



    ALSO

    How can I get a whole sound to play via my text commands. Annoy is supposed to play a whole sound. When I have interval or runontick at the top or anywhere else, it constantly restarts the sound (which is why its now named "Annoy") Can anyone help me please? Also, please dont post some crap about "go to the wiki" or something. I hate when you ask for help and people say that. (I have already looked around there. :P)

  2. #2
    Wiremod Helper Lyinginbedmon's Avatar
    Join Date
    Mar 2009
    Location
    England
    Posts
    2,659

    Default Re: How can I fix these simple syntax errors? (simple to you)

    It's because you're using a single "=" sign in the if() section, it needs to be 2 when you're asking if something is equal to something else.

  3. #3
    Developer Matte's Avatar
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    3,109

    Default Re: How can I fix these simple syntax errors? (simple to you)

    Code:
    if (LS == "annoy" & !Annoy)
    {Annoy = 1}
    elseif (LS == "annoy" & Annoy)
    {Annoy = 0}
    
    if (LS == "cloak" & !Cloak)
    {Cloak = 1}
    elseif (LS == "cloak" & Cloak)
    {Cloak = 0}
    This should work.
    "If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
    -- Niels Bohr

  4. #4
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,010

    Default Re: How can I fix these simple syntax errors? (simple to you)

    He basicly made toggles, this would be a better way to make those.
    2 if-statements instead of 4.

    Code:
    if (LS == "annoy") {
        Annoy = !Annoy
    }
    elseif (LS == "cloak") {
        Cloak = !Cloak
    }
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  5. #5
    Developer Matte's Avatar
    Join Date
    Jan 2009
    Location
    Norway
    Posts
    3,109

    Default Re: How can I fix these simple syntax errors? (simple to you)

    I didn't try to make his expression shorter -- only working.
    "If anybody says he can think about quantum physics without getting giddy, that only shows he has not understood the first thing about them."
    -- Niels Bohr

+ Reply to Thread

Similar Threads

  1. Simple Question
    By nath2008uk in forum Installation and Malfunctions Support
    Replies: 14
    Last Post: 03-07-2009, 01:13 PM
  2. Simple expression help!
    By stilianos in forum Installation and Malfunctions Support
    Replies: 13
    Last Post: 11-24-2008, 08:48 AM
  3. Should Be A Simple Question
    By brandeno01 in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 2
    Last Post: 09-02-2008, 07:49 PM
  4. A Simple Keyboard CPU
    By Ripture in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 8
    Last Post: 06-07-2008, 11:58 PM
  5. Pretty Simple Question for a very simple Expression
    By ckyfan2k in forum Installation and Malfunctions Support
    Replies: 8
    Last Post: 07-29-2007, 10:41 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots