View Single Post
  #1  
Unread 06-28-2011, 04:36 AM
Fortunis's Avatar
Fortunis Fortunis is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Mar 2011
Location: Leeds, UK
Posts: 72
A request for all plugin Authors 2

Would it be possible for all Authors to make their main command toggle show/hide please. I feel its unnessesary to have to type more text on the command line than is necessary.

Take my plugin as an example. '/mcha' toggles mcha's option window on/off. No need for /mcha show or /mcha hide. I use '/mcha toggle' for something different (turns the functioning of the plugin on/off), but for other plugins /command toggle is used exactly as my normal '/mcha'.

Im aware that you all probably know how to change this but i thought i'd insert some code to inspire thoughs that are new to making plugins.


Code:
yourCommand = class(Turbine.ShellCommand);
Turbine.Shell.AddCommand("<Command you type, excluding slash>", yourCommand);

function yourCommand:Execute(command, arg)

    if arg == "" then

       if yourWindow:IsVisible(true) then
            yourWindow:SetVisible( false );
            yourWindow:Activate( false );
        else
            yourWindow:SetVisible( true );
            yourWindow:Activate( true );
        end

    end

end
Thanks in advance
-Fortunis
__________________
Author of Mouse Cursor Highlighter Advanced

Last edited by Fortunis : 06-28-2011 at 12:41 PM.
Reply With Quote