|  Help-command not working | 
| Author: | 
Message: | 
Jimbo 
Veteran Member 
     
  
  
 
Posts: 1649 Reputation: 18 
33 /   /   
Joined: Jul 2006 
 | 
O.P.  Help-command not working
When I have the following script installed, the '/all' commnad doesn't work 
anyone know why? 
Here is the script:
 code: function OnEvent_ChatWndSendMessage(ChatWnd, sMessage) { 
 
    if(sMessage.charAt(0) == "/"){ 
        return parseCommands(sMessage,ChatWnd); 
    } 
} 
function parseCommands(sMessage,iOriginWnd){ 
 
    if (sMessage.charAt(0) == '/'){ 
        if(sMessage.charAt(1) == '/'){ 
            return sMessage; 
        } else { 
            var firstSpace = sMessage.search(' '); 
            if(firstSpace == -1){ 
                var command = sMessage.toLowerCase().substr(1); 
                var params = ''; 
            } else { 
                var command = sMessage.toLowerCase().substr(1, firstSpace-1); 
                var params = sMessage.substr(firstSpace+1); 
            } 
            if(params != "") { Debug.Trace("The command \"" + command + "\" with the parameters \"" + params + "\" has been parsed."); } 
            else { Debug.Trace("The command \"" + command + "\" has been parsed."); } 
            switch(command) { 
                case 'colour=red': 
                    iOriginWnd.SendMessage("4"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=blue': 
                    iOriginWnd.SendMessage("12"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=green': 
                    iOriginWnd.SendMessage("50"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=yellow': 
                    iOriginWnd.SendMessage("8"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=purple': 
                    iOriginWnd.SendMessage("6"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=pink': 
                    iOriginWnd.SendMessage("13"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=orange': 
                    iOriginWnd.SendMessage("36"+params); 
                    sMessage = ''; 
                    break; 
                default: 
                case 'colour=lilac': 
                    iOriginWnd.SendMessage("21"+params); 
                    sMessage = ''; 
                    break; 
            } 
        } 
    } 
    return sMessage; 
} 
function OnGetScriptCommands() 
{ 
    var commands = '<ScriptCommands>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=red</Name>'; 
            commands+='<Description>'+"Change colour of text to red"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=blue</Name>'; 
            commands+='<Description>'+"Change colour of text to blue"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=green</Name>'; 
            commands+='<Description>'+"Change colour of text to green"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=yellow</Name>'; 
            commands+='<Description>'+"Change colour of text to yellow"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=orange</Name>'; 
            commands+='<Description>'+"Change colour of text to orange"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=pink</Name>'; 
            commands+='<Description>'+"Change colour of text to pink"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=purple</Name>'; 
            commands+='<Description>'+"Change colour of text to purple"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=lilac</Name>'; 
            commands+='<Description>'+"Change colour of text to lilac"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
    commands+='</ScriptCommands>'; 
    return commands; 
} 
   
 |   
 | 
| 09-01-2006 08:30 AM | 
 | 
  | 
ForestPlus! 
Banned 
 
 
Posts: 96 
Joined: Aug 2006 
 | 
| 
 RE: Help-command not working
 Well i imported the script, tried /all and the command did work... 
I put in /all hello and pressed <enter> and the word hello came up in pale blue writing (Not sure whether it is ment to do that or not) 
Does any other commands workl/don't work? 
 |   
 | 
| 09-01-2006 08:44 AM | 
 | 
  | 
Jimbo 
Veteran Member 
     
  
  
 
Posts: 1649 Reputation: 18 
33 /   /   
Joined: Jul 2006 
 | 
| 
O.P.  RE: Help-command not working
 well, when i type '/all hello' it comes up in pale blue(lilac) writing but only sends 'hello' to the active convo. 
 |   
 | 
| 09-01-2006 08:46 AM | 
 | 
  | 
ForestPlus! 
Banned 
 
 
Posts: 96 
Joined: Aug 2006 
 | 
| 
 RE: Help-command not working
 Hmm... weird... the same to me when i tried to test it, but after i remove the script it does it fine... 
Is that a script to change the colour of the writing? 
 |   
 | 
| 09-01-2006 08:50 AM | 
 | 
  | 
Jimbo 
Veteran Member 
     
  
  
 
Posts: 1649 Reputation: 18 
33 /   /   
Joined: Jul 2006 
 | 
| 
O.P.  RE: Help-command not working
 yes, you have to type /colour=xxxxx 
 
there are only about 10 colours in it at the moment. 
oh, by the way, it only changes the colour for one message 
 This post was edited on 09-01-2006 at 08:52 AM by Jimbo.
 |   
 | 
| 09-01-2006 08:51 AM | 
 | 
  | 
ForestPlus! 
Banned 
 
 
Posts: 96 
Joined: Aug 2006 
 | 
| 
 RE: Help-command not working
 That could be the problem, now i have removed the script, it doesn't only let me use the /all command, but the message i wrote (eg /all hello) now appears in my normal text writing (red) 
This is something weird... it shouldn't interfere with other commands.. 
 |   
 | 
| 09-01-2006 08:55 AM | 
 | 
  | 
Jimbo 
Veteran Member 
     
  
  
 
Posts: 1649 Reputation: 18 
33 /   /   
Joined: Jul 2006 
 | 
| 
O.P.  RE: Help-command not working
 thats what i thought, but for some trange reason it is, wonder why? 
 |   
 | 
| 09-01-2006 08:56 AM | 
 | 
  | 
markee 
Veteran Member 
     
  
  
 
Posts: 1622 Reputation: 50 
37 /   /   
Joined: Jan 2006 
 | 
 RE: Help-command not working
quote: Originally posted by 134jimbodude 
                
code: ... 
 
default: 
                case 'colour=lilac': 
                    iOriginWnd.SendMessage("21"+params); 
                    sMessage = ''; 
                    break; 
 
... 
 
  
  
Put default under the final break and it should all be fixed.  Any comand you write should change to the lilac colour otherwise I think.  I thought I changed this for you last time but obviously not, sorry.  
 |   
 | 
| 09-01-2006 08:58 AM | 
 | 
  | 
Jimbo 
Veteran Member 
     
  
  
 
Posts: 1649 Reputation: 18 
33 /   /   
Joined: Jul 2006 
 | 
| 
O.P.  RE: Help-command not working
 thanks markee 
 
so, this would work? 
[code] 
 
function OnEvent_ChatWndSendMessage(ChatWnd, sMessage) { 
 
    if(sMessage.charAt(0) == "/"){ 
        return parseCommands(sMessage,ChatWnd); 
    } 
} 
function parseCommands(sMessage,iOriginWnd){ 
 
    if (sMessage.charAt(0) == '/'){ 
        if(sMessage.charAt(1) == '/'){ 
            return sMessage; 
        } else { 
            var firstSpace = sMessage.search(' '); 
            if(firstSpace == -1){ 
                var command = sMessage.toLowerCase().substr(1); 
                var params = ''; 
            } else { 
                var command = sMessage.toLowerCase().substr(1, firstSpace-1); 
                var params = sMessage.substr(firstSpace+1); 
            } 
            if(params != "") { Debug.Trace("The command \"" + command + "\" with the parameters \"" + params + "\" has been parsed."); } 
            else { Debug.Trace("The command \"" + command + "\" has been parsed."); } 
            switch(command) { 
                case 'colour=red': 
                    iOriginWnd.SendMessage("4"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=blue': 
                    iOriginWnd.SendMessage("12"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=green': 
                    iOriginWnd.SendMessage("50"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=yellow': 
                    iOriginWnd.SendMessage("8"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=purple': 
                    iOriginWnd.SendMessage("6"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=pink': 
                    iOriginWnd.SendMessage("13"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=orange': 
                    iOriginWnd.SendMessage("36"+params); 
                    sMessage = ''; 
                    break; 
                case 'colour=lilac': 
                    iOriginWnd.SendMessage("21"+params); 
                    sMessage = ''; 
                    break; 
 default: 
            } 
        } 
    } 
    return sMessage; 
} 
function OnGetScriptCommands() 
{ 
    var commands = '<ScriptCommands>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=red</Name>'; 
            commands+='<Description>'+"Change colour of text to red"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=blue</Name>'; 
            commands+='<Description>'+"Change colour of text to blue"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=green</Name>'; 
            commands+='<Description>'+"Change colour of text to green"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=yellow</Name>'; 
            commands+='<Description>'+"Change colour of text to yellow"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=orange</Name>'; 
            commands+='<Description>'+"Change colour of text to orange"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=pink</Name>'; 
            commands+='<Description>'+"Change colour of text to pink"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=purple</Name>'; 
            commands+='<Description>'+"Change colour of text to purple"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
        commands+='<Command>'; 
            commands+='<Name>colour=lilac</Name>'; 
            commands+='<Description>'+"Change colour of text to lilac"+'</Description>'; 
            commands+='<Parameters>Message</Parameters>'; 
        commands+='</Command>'; 
    commands+='</ScriptCommands>'; 
    return commands; 
} 
 
 |   
 | 
| 09-01-2006 09:00 AM | 
 | 
  | 
markee 
Veteran Member 
     
  
  
 
Posts: 1622 Reputation: 50 
37 /   /   
Joined: Jan 2006 
 | 
 RE: Help-command not working
I'm quite sure it should, though for making the code look nice you might want to indent the "default:" line so it is flush with the "case" lines    
 |   
 | 
| 09-01-2006 09:04 AM | 
 | 
  | 
| 
Pages: (2): 
« First
  
 [ 1 ]
 2
 
»
 
Last »
 | 
| 
 |