What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Script Edit Help

Pages: (2): « First [ 1 ] 2 » Last »
Script Edit Help
Author: Message:
matt-rockz
Junior Member
**


Posts: 18
31 / Male / –
Joined: Feb 2007
O.P. Script Edit Help
Hey, ive been trying to edit this script and i save it but when i click ok to close the window it says 'This Script May Be Defective Or You May Not Have The Proper Privileges To Run Scripts' I dont know why it says it. Please help?
Matt
02-03-2007 06:17 PM
Profile E-Mail PM Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
RE: Script Edit Help
When you edited the script you must of messed up the syntax and thus broke it, now allowing it to run :).
02-03-2007 06:41 PM
Profile PM Find Quote Report
matt-rockz
Junior Member
**


Posts: 18
31 / Male / –
Joined: Feb 2007
O.P. RE: Script Edit Help
Ahh thanks, How do i fix it...Or cant i?
02-03-2007 07:00 PM
Profile E-Mail PM Find Quote Report
absorbation
Elite Member
*****

Avatar

Posts: 3636
Reputation: 81
– / Male / Flag
Joined: Feb 2005
RE: Script Edit Help
Post the code, and I'll have a look at it ;)
02-03-2007 07:02 PM
Profile PM Find Quote Report
matt-rockz
Junior Member
**


Posts: 18
31 / Male / –
Joined: Feb 2007
O.P. RE: Script Edit Help
*/   
var hi = 'Hey!'
var on = '1'

function OnEvent_Initialize(MessengerStart)
{
if (on == '0'){
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is curently turned: Off\r\n\r\Turn it on by going to the msgplus icon ;)');}
else
{
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is curently turned: On');
}
}
function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind)
{
if (on == '1'){
if (Origin != Messenger.MyName){

if (Message.match(/(^|\s+)(\*)?hello(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?helo(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?ello(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?elo(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?hey(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?hiya(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?hi(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?sup(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?hii(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?supp(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)Yo(d|s)?(\*)?($|\s+)/i)!=null)
{
ChatWnd.SendMessage(hi);
}
if (Message.match(/(^|\s+)(\*)?hiya(d|s)?(\*)?($|\s+)/i)!=null)
{
}
}
}
function OnEvent_Uninitialize(MessengerExit)
{
}
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
  if(Message.substr(0, 15) == '/heyon'){
    heyon();
    return '';
  }
   if(Message.substr(0, 15) == '/heyoff'){
    heyoff();
    return '';
  }
     if(Message.substr(0, 15) == '/heyonoff'){
    onoff();
    return '';
  }
}
function OnGetScriptMenu(Location)
{
    var ScriptMenu = '<ScriptMenu>';
    ScriptMenu    +=  '<MenuEntry Id=\'onoff\'>On or Off?</MenuEntry>';
       ScriptMenu    +=  '<MenuEntry Id=\'StartStop\'>';
              if(on == '0') {
          ScriptMenu += 'Turn On Auto Hey';
          ScriptMenu    +=  '</MenuEntry>';
            }else {
          ScriptMenu += 'Turn Off Auto Hey';
           ScriptMenu    +=  '</MenuEntry>';
    }
    ScriptMenu    +=     '<MenuEntry Id=\'about\'>About</MenuEntry>';
    ScriptMenu    += '</ScriptMenu>';
   
    return ScriptMenu;
}

function OnEvent_MenuClicked(MenuItemId,Location,OriginWnd) {
   switch(MenuItemId) {
      case 'StartStop':
         heyturn();
         break;
      case 'onoff':
        onoff();
         break;
      case 'about':
         msgbox();
         break;
   }
}
function msgbox() {
   var wnd = MsgPlus.CreateWnd('msgbox.xml', 'autoheymsgbox');
   wnd.SetControlText(msg);
}

function OnautoheymsgboxEvent_CtrlClicked(PlusWnd,ControlId) {
   switch(ControlId) {
      case "Ok":
         PlusWnd.Close(0);
         break;
   }
}
function onoff()
{
if (on == '0'){
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is: Off');}
else
{
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is: On');
}
}
function heyon()
{
if (on == '0') {
on = '1'
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is now: On');
}
}
function heyoff()
{
if (on == '1') {
on = '0'
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is now: Off');
}
}

function heyturn()
{
if (on == '0'){
on = '1'
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is now: On');
}
else
{
on = '0'
MsgPlus.DisplayToast('Auto Hey', 'Auto Hey is now: Off');
}
}
02-03-2007 07:07 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Script Edit Help
quote:
Originally posted by matt-rockz
Hey, ive been trying to edit this script and i save it but when i click ok to close the window it says 'This Script May Be Defective Or You May Not Have The Proper Privileges To Run Scripts' I dont know why it says it. Please help?
Matt
remove the "*/" at the first line (isn't cause of the error, but it is wrong nontheless)

1) Close Messenger completely
2) Open the script file in notepad
3) save it as a 'Unicode' text file
4) restart Messenger and open it up in Plus!'s script editor again




The script itself contains a lot of potential errors and bugs btw. Also all those regular expressions aren't needed and this can be done much more efficient though) ;)

This post was edited on 02-04-2007 at 12:17 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
02-04-2007 12:15 AM
Profile PM Find Quote Report
shawnnn
New Member
*


Posts: 2
Joined: Jun 2007
RE: Script Edit Help
hey cookie i've had the same problem but with all the scripts, even the simplest

code:
function OnEvent_Initialize(MessengerStart)
{
    Debug.Trace("Hello World!");
}


so i supposed it's not a sintax problem. Now i tried to close messenger, save it as unicode and it works, but the problem is that I should do that everytime i'd like to debug the program, and Messenger is very slow to start! is there a way to debug it while keeping msn executed?

thanks in advance
Shawn
06-14-2007 07:44 AM
Profile E-Mail PM Find Quote Report
Volv
Skinning Contest Winner
*****

Avatar

Posts: 1233
Reputation: 31
34 / Male / Flag
Joined: Oct 2004
RE: Script Edit Help
quote:
Originally posted by shawnnn
Now i tried to close messenger, save it as unicode and it works, but the problem is that I should do that everytime i'd like to debug the program, and Messenger is very slow to start! is there a way to debug it while keeping msn executed?
You just need to restart the script itself, you can do this by just disabling it in script preferences then re-enabling it (you need to click "Apply" in between).

I would recommend just using the default script editor (the one in MsgPlus) to edit your scripts - it might not have all the little cool features which your own editor has but it does the job and it automatically restarts the script every time you save it.
06-15-2007 11:08 AM
Profile PM Find Quote Report
shawnnn
New Member
*


Posts: 2
Joined: Jun 2007
RE: Script Edit Help
it keeps saying em the script is defective again...:S
06-15-2007 01:56 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Script Edit Help
Post the js file (so it keeps its formatting and we will take a look).
06-15-2007 02:22 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On