Need help? Ask on the forum, ask a fellow user or developer (join us on IRC), or contact sk89q.
Contribute to the wiki, edit this page! Register an account, or login with Facebook first.
HEY! Do you integrate (or want to) a plugin into yours? Do you help work on WE/WG/etc.? Please subscribe to our mailing list!
CommandHelper
API
switch
From SK's Wiki
< CommandHelper | API
Switch
Description: Executes a block of commands if @var is equal to the given value at start of block.
Format:
switch(<@var>,
'value1',
command
command
,
'value2',
command
command
,
)
Returns: void
Example:
*:/test [$cmd= ''] = >>>
switch($cmd, #watch the ','
'', #check for '' (an empty string)
msg('You typed only /test. Try it now with /test help.')
, #this ends the block for ''
'help', #check for 'help'
msg('You typed /test help') #more commands are possible
msg('Try it now with /test HELP')
, #this ends the block for 'help'
'HELP',msg('Big HELP? Remember casesensitiveness'), #example for one line
) #end of switch
<<<