Problem with my script. |
Author: |
Message: |
TheTomb
New Member
Posts: 6
Joined: Aug 2006
|
O.P. Problem with my script.
I'm making my first script which is called Interpreter which steals your Contacts name. I don't know if it's right or not but it comes up saying
"/interpretate is not recognised as a command"
Heres my code
code: function OnEvent_Initialize(MessengerStart)
{
}
function OnEvent_Uninitialize(MessengerExit)
{
}
function OnGetScriptCommands(){
var commands = '<ScriptCommands>';
commands+='<Command>';
commands+='<Name>interpretate</Name>';
commands+='<Description>Interpretate your contact by stealing their name!</Description>';
commands+='<Parameters/>';
commands+='</Command>';
commands+='</ScriptCommands>';
return commands;
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if(Message == "/interpretate")
{
Messenger.MyName = Contact.Name
MsgPlus.DisplayToast("Success!", "You have the same name as your contact!");
return '';
}
}
|
|
08-11-2006 07:10 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: Problem with my script.
quote: Originally posted by TheTomb
Messenger.MyName = Contact.Name
Because Contact.Name doesn't exist anywhere. You need to iterate through the ChatWnd.Contacts object to get a Contact object which you can get the contacts name from.
|
|
08-11-2006 07:12 PM |
|
|
TheTomb
New Member
Posts: 6
Joined: Aug 2006
|
O.P. RE: Problem with my script.
and how am I supposed to do that?
|
|
08-11-2006 07:14 PM |
|
|
Felu
Veteran Member
Posts: 2223 Reputation: 72
30 / /
Joined: Apr 2006
Status: Away
|
RE: Problem with my script.
code: function OnGetScriptCommands(){
var commands = '<ScriptCommands>';
commands+='<Command>';
commands+='<Name>interpretate</Name>';
commands+='<Description>Interpretate your contact by stealing their name!</Description>';
commands+='<Parameters/>';
commands+='</Command>';
commands+='</ScriptCommands>';
return commands;
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if(Message.substr(0,13) == "/interpretate")
{
var Contacts = ChatWnd.Contacts;
var e = new Enumerator(Contacts); for(; !e.atEnd(); e.moveNext())
var Blah = e.item()
Messenger.MyName = Blah.Name;
MsgPlus.DisplayToast("Success!", "You have the same name as your contact!");
return '';
}
}
Use that code
This post was edited on 08-11-2006 at 07:28 PM by Felu.
|
|
08-11-2006 07:26 PM |
|
|
TheTomb
New Member
Posts: 6
Joined: Aug 2006
|
O.P. RE: Problem with my script.
I still get
'The command you entered was not recognised'
|
|
08-12-2006 08:15 AM |
|
|
vikke
Senior Member
Posts: 900 Reputation: 28
31 / /
Joined: May 2006
|
RE: Problem with my script.
Try
code: var commands = new String();
commands+='<ScriptCommands>';
commands+='<Command>';
commands+='<Name>interpretate</Name>';
commands+='<Description>Interpretate your contact by stealing their name!</Description>';
commands+='<Parameters/>';
commands+='</Command>';
commands+='</ScriptCommands>';
return commands;
|
|
08-12-2006 08:17 AM |
|
|
TheTomb
New Member
Posts: 6
Joined: Aug 2006
|
O.P. RE: Problem with my script.
Nope, now it doesn't appear in the
/ list
|
|
08-12-2006 08:20 AM |
|
|
vikke
Senior Member
Posts: 900 Reputation: 28
31 / /
Joined: May 2006
|
RE: Problem with my script.
Hmm ok, strange.
Well.. return "; should be return "";
|
|
08-12-2006 08:23 AM |
|
|
Eljay
Elite Member
:O
Posts: 2949 Reputation: 77
– / / –
Joined: May 2004
|
RE: Problem with my script.
code: function OnGetScriptCommands(){
var commands = '<ScriptCommands>';
commands+='<Command>';
commands+='<Name>interpretate</Name>';
commands+='<Description>Interpretate your contact by stealing their name!</Description>';
commands+='<Parameters/>';
commands+='</Command>';
commands+='</ScriptCommands>';
return commands;
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if(Message.substr(0,13) == "/interpretate"){
for(e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext()){
var Contact = e.item()
Messenger.MyName = Contact.Name;
MsgPlus.DisplayToast("Success!", "You have the same name as your contact!");
return '';
}
}
}
|
|
08-12-2006 08:26 AM |
|
|
Felu
Veteran Member
Posts: 2223 Reputation: 72
30 / /
Joined: Apr 2006
Status: Away
|
RE: Problem with my script.
quote: Originally posted by TheTomb
I still get
'The command you entered was not recognised'
Hmm... The code i gave works perfectly fine. Can you please post the code you are using?
quote: Originally posted by vikke
Try
code: var commands = new String();
commands+='<ScriptCommands>';
commands+='<Command>';
commands+='<Name>interpretate</Name>';
commands+='<Description>Interpretate your contact by stealing their name!</Description>';
commands+='<Parameters>';
commands+='</Parameters>';
commands+='</Command>';
return commands;
That wont work .
Edit
quote: Originally posted by -!Felu!-
code: function OnGetScriptCommands(){
var commands = '<ScriptCommands>';
commands+='';
commands+='interpretate';
commands+='Interpretate your contact by stealing their name!';
commands+='';
commands+='';
commands+='';
return commands;
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if(Message.substr(0,13) == "/interpretate")
{
var Contacts = ChatWnd.Contacts;
var e = new Enumerator(Contacts); for(; !e.atEnd(); e.moveNext())
var Blah = e.item()
Messenger.MyName = Blah.Name;
MsgPlus.DisplayToast("Success!", "You have the same name as your contact!");
return '';
}
}
Use that code
quote: Originally posted by Eljay
code: function OnGetScriptCommands(){
var commands = '<ScriptCommands>';
commands+='';
commands+='interpretate';
commands+='Interpretate your contact by stealing their name!';
commands+='';
commands+='';
commands+='';
return commands;
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
if(Message.substr(0,13) == "/interpretate"){
for(e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext()){
var Contact = e.item()
Messenger.MyName = Contact.Name;
MsgPlus.DisplayToast("Success!", "You have the same name as your contact!");
return '';
}
}
}
Whats the difference Eljay? Just Blah is Contact and ChatWnd.Contacts is defined as Contacts in my code and your code directly uses ChatWnd.Contacts .
This post was edited on 08-12-2006 at 08:37 AM by Felu.
|
|
08-12-2006 08:34 AM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|