Index





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 that: In really powerful configurations aliases, variables, action, userinterface, etc. go hand in hand! e.g.:

#variable bag backpack
#alias wb {wear $bag}
#alias rb {remove $bag}
#alias pb {put $stuff $bag}
#alias l  {#variable stuff $0 ; look at $stuff}
l torch
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.

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 'evalsysfile', 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 that need those configurations. e.g. that 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 '#alias ga "get all"' are best kept here,.. (You can load these scriptfiles into your session with the command 'evaluserfile', please refer to the commands section of the documentation.)

Multiline Commands

In earlier versions of SMM any command had to be completed in a single line, e.g.:
#alias ga "get all"
    
This is reasonable for short commands like the example above, but as soon as you develop bigger script (with control structures, etc.) this approach gets unhandy, e.g.:
#alias checkme { #showme "Your status:" ; #if {$hp>50} { #showme "You are in great condition!" } elseif { $hp>30 } { #showme "You are getting exhausted." } else { #showme "!!! You NEED a rest !!!" ; #showme "... even a bunny can kill you in this shape! } }
    
Multiline commands were introduced in SMM++ 4.1. As long as a bracket ('{') is not closed the next line is appended to the last read in line. This continues until the bracket has been been closed ('}'). All spaces and tabs are removed from the beginning and the end of the line before concatenating the lines! Empty lines are skipped (-> no <Return> is send to the mud). It is still required, that a string is begun and ended on the same line. (If this is a too stringent restriction, please notify me.) Concatenation of lines is done while reading the file! The SMM parser still cannot handle multiline commands. So you have to make sure, that after concatenation you get the command you wanted to have. Especially dont forget to provide all the needed semicoli (';'), if you have separate commands! You can write the above example now the follwing way:
#alias checkme { 
  #showme "Your status:" ;

  #if      { $hp>50 } { 
    #showme "You are in great condition!" 
  } elseif { $hp>30 } { 
    #showme "You are getting exhausted." 
  } else { 
    #showme "!!! You NEED a rest !!!"; 
    #showme "... even a bunny can kill you in this shape! 
  } 
}
    
Did you pay attention to the semicoli? But also keep in mind: if you provide unnecessay semicoli, you will send <Return>'s to the mud, which might not what you want.

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.

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.

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. The buffer belonging to the SMM++ scriptfile 'welcome' will always be in memory.

Editor Menubar

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




Last modified: Sun Dec 19 20:08:14 CET 1999