SMM++ Manual Version 5.0

12 Scriptfile Editor

12.1 Why Scriptfiles and not fancy Inputs?

I want to point out this matter, as I chose this implementation after thinking well about it. I hope you understand my arguments and dont miss "modern days" inputs. It would have been much easier to provide "fancy" alias/action/etc. inputs and indeed I wanted to do so, until I recognized that those "fancy" inputs arent powerful! As soon as I tried to make them more powerful, they got very unhandy in usage or become naturally an editor.

There is an easy explanation for this: In really powerful configurations aliases, variables, action, userinterface, etc. go hand in hand! e.g.:

Example:
::variable bag
::variable stuff

::set bag   backpack
::set stuff torch

# wear the bag
::proc wb {} {::variable bag ; wear $bag}
# remove the bag
::proc rb {} {::variable bag ; remove $bag}
# look at some stuff and remember at what you have looked
::proc l  {what} {
  ::variable stuff  
  ::set stuff $what 
  ::tomud "look at $stuff"
}
# easily put the "stuff" into the bag
::proc pb {} {
  ::variable bag
  ::variable stuff
  ::tomud "put $stuff in $bag"
}

# during mudding you find a sword, examine it,
#  find it interessting and take it with you
l sword
pb

This is only a very basic example, but it well points out the matter. You dont want to have the aliases and variables scattered around in different user interfaces.

12.2 Three Flavors of Scriptfiles

There are three different types of scriptfiles:
SMM++ scriptfiles
are distributed with the SMM++ package. You cannot edit, save or delete them. They are intended to be examples of how SMM++ can be used. You are encouraged ot send in your scripts to be included into the distribution. Just export your script to a file and send it to the author. So others can profit from your work too! (You can load these scriptfiles into your session with the command '::smm::file syseval', please refer to the commands section of the documentation.)
Session scriptfiles
are loaded at start of a session. Here you can store your configuration on per session basis. Of course they are saveable, but (of course) not deletable. If you dont want a configuration leave the file empty. If you delete a session, all session configuration (including its scriptfile) is deleted.
User scriptfiles
close the gap between the SMM++- and session script files. Here you can store your more global configurations and load them into all session scriptfiles, which need these configurations. I.e. this means that many sessions can share the same scriptfiles. It is natural that you can create and delete all these scriptfiles as you want to. E.g. general aliases like '::proc ga {} {get all}' are best kept here,.. (You can load these scriptfiles into your session with the command '::smm::file usereval', please refer to the commands section of the documentation.)

12.3 Start the Scriptfile Editor

From the Configuration menu choose Scriptfile Editor. The editor will show up and you can enter your input. At any time, you can save your text or close the editor with cancel.

You can launch or close the editor at any time. It doesnt interfere with any other actions. If you start a session it will load whatever is saved on disk. If you close the editor and launch it later again, you can continue exactly where you stoped your work.

12.4 Use the Scriptfile Editor

When designing the editor I had always emacs in mind; so most concepts are taken from there (though emacs is of course much better than the SMM scriptfile editor,.. If you miss some needed functionality please notify me. Thanks!).

Unlike emacs you can only view one buffer at a time: the actual buffer.

12.4.1 Buffers

One of the concepts is the buffer concept. Each buffer has a corresponding file and vice versa. If you load a file, its corresponding buffer is created containing what is in the file. If you save a buffer, its content is written to the file.

The buffermanager keeps track of all the seperate buffers loaded.

12.4.2 Editor Menubar

Here follows a description of the menubar entries. Most actions can be invoked via key sequences; they are denoted beneath the entry.

Selim Issever
<SMM++ Configuration|Contents|Scripting in SMM++>