0
function queue_instructions(){
        var input_message = "Commands
    w?  Shows whos on the waitlist
    w+  Adds yourself to the waitlist
    w-  Removes yourself from the waitlist
    w++  Moves yourself down one spot on the waitlist
    -mods  Shows a list of available moderators
    -plays  Shows how many songs each DJ has played
    -promote  Requests a vote from everyone for you to be moved to 1st on the list
    -pull [#]  Requests a vote from everyone to pull that DJ off the booth  Number of DJ is     what number spot he is on the booth  Numbers read from left to right
    -remove [#]  Removes that number DJ from the waitlist  Must be a moderator
    -votekick [username]  Requests a vote from everyone to kick the user
     Type -help [command] for more info on a command (ie. -help w?)";
        deliver_chat(input_message);

I get a syntax error unexpected toke illegal on my Javascript console on Google chrome. Any ideas?

5 Answers 5

3

You have to close those quotes on each line, and concatenate with + to the next line:

var input_message = "Commands " + 
    "w?  Shows whos on the waitlist " + 
    "w+  Adds yourself to the waitlist " + 

and so on

Did you want line breaks to be inserted with each line? If so, you can use \n:

var input_message = "Commands\n" + 
    "w?  Shows whos on the waitlist\n" + 
    "w+  Adds yourself to the waitlist\n" + 
Sign up to request clarification or add additional context in comments.

Comments

1

When you split a string over multiple lines, you need to concatenate it with + like this

var input_message = "Commands"+
"w?  Shows whos on the waitlist"+
"w+  Adds yourself to the waitlist"+
"w-  Removes yourself from the waitlist"+
"w++  Moves yourself down one spot on the waitlist"+
"-mods  Shows a list of available moderators"+
"-plays  Shows how many songs each DJ has played"+;

And also in your code, I don't find the closing curly brace } of that function.

function queue_instructions()
{
     //Stuff here.
}

you need to include it.

1 Comment

Well you're the one who took the time to edit this question, so a +1 is the least I can do :)
0

Your syntax is incorrect. You'll need to either put the whole string in one line OR close the quotes in each line a do a + to concat the next line with it.

Comments

0

Or you do like this:

var input_message = [
    "Commands",
    "w?  Shows whos on the waitlist",
    "w+  Adds yourself to the waitlist",
    "w-  Removes yourself from the waitlist",
    "w++  Moves yourself down one spot on the waitlist",
    "-mods  Shows a list of available moderators",
    "-plays  Shows how many songs each DJ has played",
    "-promote  Requests a vote from everyone for you to be moved to 1st on the list",
    "-pull [#]  Requests a vote from everyone to pull that DJ off the booth  Number of DJ is what number spot he is on the booth  Numbers read from left to right",
    "-remove [#]  Removes that number DJ from the waitlist  Must be a moderator",
    "-votekick [username]  Requests a vote from everyone to kick the user",
    "Type -help [command] for more info on a command (ie. -help w?)"
].join("\n");

Comments

0

I notice no-one has suggested escaping the line-ending:

var multiStr = "This is the first line \
    This is the second line \
    This is more...";

Note that the line endings are included in this string…

http://davidwalsh.name/multiline-javascript-strings

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.