Shoutbox

Script Edit Help - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Script Edit Help (/showthread.php?tid=71347)

Script Edit Help by matt-rockz on 02-03-2007 at 06:17 PM

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


RE: Script Edit Help by absorbation on 02-03-2007 at 06:41 PM

When you edited the script you must of messed up the syntax and thus broke it, now allowing it to run :).


RE: Script Edit Help by matt-rockz on 02-03-2007 at 07:00 PM

Ahh thanks, How do i fix it...Or cant i?


RE: Script Edit Help by absorbation on 02-03-2007 at 07:02 PM

Post the code, and I'll have a look at it ;)


RE: Script Edit Help by matt-rockz on 02-03-2007 at 07:07 PM

*/   
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');
}
}


RE: Script Edit Help by CookieRevised on 02-04-2007 at 12:15 AM

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) ;)
RE: Script Edit Help by shawnnn on 06-14-2007 at 07:44 AM

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
RE: Script Edit Help by Volv on 06-15-2007 at 11:08 AM

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.
RE: Script Edit Help by shawnnn on 06-15-2007 at 01:56 PM

it keeps saying em the script is defective again...:S


RE: Script Edit Help by matty on 06-15-2007 at 02:22 PM

Post the js file (so it keeps its formatting and we will take a look).


RE: Script Edit Help by MicroWay on 06-15-2007 at 07:22 PM

Sorry people from getting on the middle of the post, but on that cases, the Debug Window will not help???
Because it explains where are the errors...
(Yeah.. I know it don't see that the script is buggy, only code errors)...
;)


RE: Script Edit Help by matty on 06-16-2007 at 02:39 AM

No because when you save it and it has errors OnEvent_Initialize isn't even called.