Nice Whiz it's what i want but i got some problem.
Look my code :
code:
var Enabled = 0;
function OnGetScriptMenu()
{
var Menu = "<ScriptMenu>";
if(Enabled==0) { Menu += " <MenuEntry Id=\"ToggleEnable\">Enable</MenuEntry>"; }
if(Enabled==1) { Menu += " <MenuEntry Id=\"ToggleEnable\">Disable</MenuEntry>"; }
return Menu + "</ScriptMenu>";
}
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
switch (MenuItemId)
{
case "ToggleEnable":
if(Enabled == 1) { Enabled = 0; }
if(Enabled == 0) { Enabled = 1; }
break;
// add additional menu items here...
}
}
And after :
code:
if(Enabled==1)
{
[...]My Code[...]
}
else
{
function OnEvent_ChatWndSendMessage(ChatWnd,Message)
{
if(Message=="!is_activated"){
return "Result is : " + Enabled;
}
}
}
But my code does not work.. (After the if), when i do !is_activated, answer is 1 (Enabled). But after, don't work.
A part of my code :
code:
if(Enabled==1)
{
function SendMessage(sMessage)
{
return sMessage;
}
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
if(Message=="Email"){
return 'blabla';
}
When i type "Email", return is.. "Email".
Do you know why ?
Thanx,
Best regards !
EDIT : The menu works, it's just my code, i think it's the "if". :/