Author Topic: Crashing Code?  (Read 431 times)

Okay, so I am *cough*REALLY*cough* new to scripting, and I was trying to make it to where if someone says /sing, a message would pop up on everyone's screen saying,

'IT'S FRIDAY! FRIDAY! GONNA GET DOWN ON FRIDAY! Everybody's lookin' forward to the weekend, week... oh, you guys can see this. D:'.

I thought it would work because it executed right (For once.) But when I typed in /sing, Blockland CRASHED. A second after I typed it it CRASHED.

Can you figure out why it CRASHED me? ._.   This hasn't happened to me on my scripting adventures before.

This is the script -

Quote
function serverCmdsing(%client) {
   commandToServer("","<color:ffffff>IT'S FRIDAY! FRIDAY! GONNA GET DOWN ON FRIDAY! Everybody's lookin' forward to the weekend, week... oh, you guys can see this. D:");
}

(Line commandToServer("","(messagething)") is one line, meaning the line after it is part of it by the way...)

You never do a commandToServer for a messageDialog thing. Use MessageBoxOK which is used in the city RPG code.

Why the hell would you even want this?!

commandToServer's first argument should always be in tags.

Doing quotes will cause you to crash.

What otto said is the reason why it crashed, but there's a few other reasons why it won't work
1. commandToServer sends a command to the server, you want to send a command to all clients
2. The first argument for command to server is blank
3. If you want to make a pop up, use commandToAll('messageBoxOK',"message");

Code: [Select]
function serverCmdsing(%client)
{
    commandToAll('messageBoxOK',"<color:ffffff>IT'S FRIDAY! FRIDAY! GONNA GET DOWN ON FRIDAY! Everybody's lookin' forward to the weekend, week... oh, you guys can see this. D:");
}


The arguments to the messageBoxOK handler function are title and message, not just message.

The arguments to the messageBoxOK handler function are title and message, not just message.
Oh right

Code: [Select]
function serverCmdsing(%client)
{
    commandToAll('messageBoxOK',"Friday!","<color:ffffff>IT'S FRIDAY! FRIDAY! GONNA GET DOWN ON FRIDAY! Everybody's lookin' forward to the weekend, week... oh, you guys can see this. D:");
}