View Single Post
  #53  
Old 02-06-2014, 03:16 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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
PHP Code:
ChatBar.text 
is the same as
PHP Code:
player.chat 
when using the ChatBar function instead.

so:
PHP Code:
function ChatBar.onAction() {
  if (
ChatBar.substring(04) == "/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. 
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote