PHP Code:
str.substring(start[,length]) - extracts a substring out of str
the second parameter is how long you want to grab for the substring. -1 for the length will go to the end of the string.
Also
PHP Code:
function ChatBar.onAction()
is the same as
PHP Code:
function onPlayerChats()
From what I understand it's recommended to use ChatBar. I've even had issues with playerchats here and there, but not with chatbar. ChatBar is the Gui default where you type in the text.
and
is the same as
when using the ChatBar function instead.
so:
PHP Code:
function ChatBar.onAction() {
if (ChatBar.substring(0, 4) == "/set") { //honestly i cant remember if it starts at 0 or 1, I believe its 0. If not, you'd do 1, 4
temp.tokens = ChatBar.text.tokenize(); //as previously mentioned, SPACES become separators
if (tokens[1] == "shoes"){
player.colors[2] = tokens[2];
}
}
// i believe you could dynamically set it with substrings, but since it's already in tokens, it's better to just use the tokens.