View Single Post
  #4  
Old 08-22-2009, 02:57 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by screen_name View Post
Exactly what I meant. I was thinking that you could do something like this;

PHP Code:
function onPlayerChats() {
   
temp.pc player.chat.tokenize();
   switch (
pc[0]) {
     case 
"+":
       switch (
pc[1]) {
         case 
"gold":
         break;
         case 
"item":
         break;
         case 
"health":
         break;
         default:
           
player.chat "Invalid parameter";
         break;
      }
     break;
     case 
"?":
     break;
     default:
     break;
  }

Something of the sort. I realize after typing that though, if I wanted the ? command to display help, then there would be a lot of extra typing.
You're probably better off nesting if/else if-statements in this case.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote