Got a question that the wiki doesn't answer? Ask on the forum (preferred), or join us on IRC.

About the ads

CommandHelper/API/switch

From SK's Wiki
Jump to: navigation, search

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
<<<


Namespaces

Variants
Actions