All of what you want can be found in the scripting documentation (OnGetScriptMenu, OnEvent_MenuClicked, Script Info File Schema Documentation). I don't want to write the code for you, because it's better if you learn; but here is an example for you:
code:
function OnGetScriptMenu(Location) {
if (Location == 2) { // Script menu in chat window
var ScriptMenu = "<ScriptMenu>";
ScriptMenu += "<SubMenu Label=\"SubMenu 1\">";
ScriptMenu += "<MenuEntry Id=\"MnuFeat1\">Feature 1</MenuEntry>";
ScriptMenu += "<MenuEntry Id=\"MnuFeat2\">Feature 2</MenuEntry>";
ScriptMenu += "</SubMenu>";
ScriptMenu += "<SubMenu Label=\"SubMenu 2\">";
ScriptMenu += "<MenuEntry Id=\"MnuFeat3\">Feature 3</MenuEntry>";
ScriptMenu += "<MenuEntry Id=\"MnuFeat4\">Feature 4</MenuEntry>";
ScriptMenu += "</SubMenu>";
ScriptMenu += "</ScriptMenu>";
return ScriptMenu;
}
}
function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd) {
if (Location == 2) {
if (MenuItemId == "MnuFeat1") OriginWnd.SendMessage("Message 1");
if (MenuItemId == "MnuFeat2") OriginWnd.SendMessage("Message 2");
if (MenuItemId == "MnuFeat3") OriginWnd.SendMessage("Message 3");
if (MenuItemId == "MnuFeat4") OriginWnd.SendMessage("Message 4");
}
}
This will create a script menu in your chat window only with the name of your script. It will have menus something like this:
code:
"Your Script Name" > "SubMenu 1" > "Feature 1"
"Feature 2"
> "SubMenu 2" > "Feature 3"
"Feature 4"
When each of the
Feature x menus are clicked, it will send a message to the chat window "Message x".
NOTE: You cannot send a message when a submenu is clicked. Plus! scripting only catches when a menu entry is clicked.
Please refer to the above named scripting documentation pages for more info.