Shoutbox

[Help] OnGetScriptMenu not executing - 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: [Help] OnGetScriptMenu not executing (/showthread.php?tid=89045)

[Help] OnGetScriptMenu not executing by Amec on 02-08-2009 at 03:52 PM

Ok, well. In this project, I have 3 source files:

1. Menu.js - object I created for easily editing the menu
2. Window.js - object I created for keeping track of PlusWnds
3. Main.js - creates objects and stuff

In Main.js, when I create a global variable like so:

code:
var windows;
the OnGetScriptMenu function isn't called when I click on the menu. Commenting this line out, or changing the name, fixes the problem. The variable is not referenced anywhere.

Now, I had this same problem a few days ago, in a different script, with a different variable name, which was "scriptMenuCache", which works fine in this script. (global both times) Wtf is going on? :S
RE: [Help] OnGetScriptMenu not executing by matty on 02-08-2009 at 04:25 PM

Best to post the plsc so we can take a look.


RE: [Help] OnGetScriptMenu not executing by Amec on 02-08-2009 at 04:34 PM

Here ya go :P


RE: [Help] OnGetScriptMenu not executing by matty on 02-08-2009 at 04:46 PM

The problem is that your variable has the same name as the Windows function.

Either name the variable oWindows or name the function xWindows or something to differentiate between the two.


RE: [Help] OnGetScriptMenu not executing by Amec on 02-08-2009 at 04:51 PM

Isn't JScript case sensitive...?


RE: [Help] OnGetScriptMenu not executing by matty on 02-08-2009 at 04:54 PM

Well let me put it this way. The moment I changed the variable name it worked when I changed it back it didn't. Then I changed the function name and it worked.


RE: [Help] OnGetScriptMenu not executing by Amec on 02-08-2009 at 04:59 PM

Ok, well what was happening in my other script then? There was no function called "scriptMenuCache".


RE: [Help] OnGetScriptMenu not executing by matty on 02-08-2009 at 05:09 PM

quote:
Originally posted by Amec
Ok, well what was happening in my other script then? There was no function called "scriptMenuCache".
The problem with Plus! is the way the files are loaded if will load the file that is the same name as the script so if you globally declare a variable that references another function that hasn't been loaded yet you wont get an error but the script wont work.