13 Scripting in SMM++

There are various ways to make scripting with SMM++ easier.

13.1 Command names are too long!

You can rename any command. Lets say you are using the command ::smm::gui::set very often. Just rename it to ::gset, if you like.

Example:
      # set the gui-variable a
      ::smm::gui::set a 1
      ::rename ::smm::gui::set ::gset
      # now you can easily set the gui-variable a
      ::gset a 1

Commands don't even need to start with '::'. I've artificially forced this feature, to make sure that accidentially SMM++-commands don't collide with MUD-commands. So you could even rename ::smm::gui::set to gset.

Example:
      ::rename ::smm::gui::set gset
      # now you can easily set the gui-variable a
      gset a 1

13.2 SMM++ standard library

When ever I find time, I will add scripts, which do not only deal as examples, but are intented to be generally used, because they give better/easier access to standard commands or setups. These scripts build up the SMM++ standard library (SSL). They are distributed as SMM++-scripts. You are welcome to contribute.

Here follow the descriptions of existing SSL-scripts.

13.2.1 alias

Adding and removing aliases is something which is needed very often. Though powerful SMM++'s way to add an remove aliases via ::proc and ::rename is very unhandy. Therefor I've spend the SSL-script 'alias', with which you can easily add and remove aliases:

Example:
    # load the SSL-script alias
    ::smm::file syseval alias
    
    # now add the alias ga for "get all"
    alias gac get all corpse
    # remove it
    unalias gac

    # use it with variables
    alias ga  { get all $args }
    alias gb  { get $arg0 from $arg1 }
    
    # examples during mudding:
    gac                  ; # -> get all corpse
    ga                   ; # -> get all
    ga corpse            ; # -> get all corpse
    gb "small sword" bag ; # -> get small sword from bag