Author Topic: string problem  (Read 433 times)

Hello, I just started to script, and to start, I tried to make a small, useless script: In the chat, type /I *put in message*.
What should happen is that all players on the server will receive a chat message saying your name followed by your message, for example:

/I is making a strawberry cake. = Herrerarausaure is making a strawberry cake.

Teal = Chat command
Blue = Chat message (to all players)

I know that script was already done, (Bot's ui script), but I promise never publishing it. Now my problem is, with this code:
Code: [Select]
function servercmdI(%client, %message)
}
messageAll('', "<color:FFFF00>"@ %client.getPlayerName() @ " "@ %message);
}
Everything worked properly, except that only the first word after "/I" was displayed, the other words were ignored.

I know that my code is probably a bit weird with some beginner's errors, but I started from almost nothing (only basics from C coding)

My question is: How do you add more words?

Add more arguments to the function.

Add more arguments to the function.
There is another possibility :
%name=%brick.getName();

%name=strReplace(%name,"_","");

this will change all _ in the string, into nothing and will return John.

u can change it into different things, for ex:

%name=strReplace(%name,"_","*");

that will return *John

Only different :

%name=%message;  //Just %message.
%name=strReplace(%name,"_"," ");  //Notice there's a space there instead of nothing.

This will make it so you type it in with underlines like so:

/I is_testing_this_command.

The code above will replace those underlines with spaces when the code actually executes(if you put it in the right place),
and return the chat as:

"ThinkInvisible is testing this command."

Basic explanation ninja edit!
Blockland / commands don't like extra spaces for one variable. So, you have to change a filler character to spaces later on in the code.
« Last Edit: August 09, 2010, 01:41:16 PM by ThinkInvisible »

ooooh, yeah. ok. Thanks for helping!