Metis For Dummies_

W
Shared by: yurtgc548
Categories
Tags
-
Stats
views:
0
posted:
7/30/2012
language:
pages:
21
Document Sample
scope of work template
							Metis For Dummies!
          Part 1
Simple commands and loading
         In This section:


What is the MXC?
How to load the MXC
Simple Command
“Script” and “random”
                            What is the MXC


                       The MXC is the file used for Metis’s ‘Brain’

This is where all the main programming goes to begin with. The file is located in the ‘add-
          on’s’ folder(2.60 and before) or the ‘plugins’ folder (2.7 test6 and above)

You can get to this many ways, but the way I prefer is to get metis into a room, then type

                                        /mxc edit

                                       Into the bot.

   This will open a Text file in notepad which is where you’ll do all your Programming!
           How to Load the MXC
       Loading the MXC is as simple as opening it for editing, However!
You MUST remember to SAVE the file (NOT save-as!) before you reload it, if it is not
                 saved, your changes will NOT load into the bot.

                          To reload the MXC simply type

                                     /mxc load

                      Into the bot’s chat bar and press enter.
                   A notice will appear stating it was sucsessfull.
                      Simple Commands
The simplest command is the one that is pre-set into every metis bot, the !bot command:

<command>
<in>!bot</in>
<out>This is Metis %VERSION%</out>
</command>
   This command looks daunting to novice programmers, but relax, its simple once you
                                        realise the layout.
  Look at the command, see how it starts with <command> but ends with </command>?
           This simply tells the bot you want it to look for something in the room.
            The <in> and </in> defines exactly what the bot is looking for, and
                   The <out> and </out> is what it replies when it finds it!
                                         Simple eh?
                         Now… lets play with this command a little:
                      Simple Commands
<command>
<in>!bot</in>
<out>This is Metis %VERSION%</out>
<command>

 This is our simple command, click to see an example of what this does in a room when
                                         activated
                       Simple Commands
                                  A Common Room
<user1>!bot
<Metis>This is Metis 2.7 Test 6
                       Simple Commands
<command>
<in>!bot</in>
<out>This is Metis %VERSION%</out>
<command>
Now lets change this slightly and see what happens, click to add the new line.
The new line will appear red each time in this tutorial.
                     Simple Commands
<command>
<in>!bot</in>
<out>This is Metis %VERSION%</out>
<out>Glad to be of service!</out>
</command>

          Now this line is added, Reload the script and re-type the ‘Trigger’
                           (the text between <in> and </in>)
                       Simple Commands
                                  A Common Room
<user1>!bot
<Metis>This is Metis 2.7 Test 6
<user1>!bot
<Metis>This is Metis 2.7 Test 6
                       Simple Commands
<command>
<in>!bot</in>
<out>This is Metis %VERSION%</out>
<out>Glad to be of service!</out>
</command>

                                   Why didn’t it work?
   Well, Metis is programmed by default to only return one line per command, unless
   instructed otherwise, so it reads the trigger, replies with the first out it comes across,
                                  then ends the command.
                 So, now we have to tell it to print both, click to see how:
                        Simple Commands
<command type=“script”>
<in>!bot</in>
<out>This is Metis %VERSION%</out>
<out>Glad to be of service!</out>
</command>
                  Add the text in red above to your command, then reload it.
This “script” tels the bot when the trigger is found in the room, it MUST read each out one
                         by one and act on whatever the out tells it to do.
 This may sound complex, but it will become clear later why I said it like that, and not just
                              say it has to print each one out period.
                                Click to see what happens now.
                       Simple Commands
                                  A Common Room
<user1>!bot
<Metis>This is Metis 2.7 Test 6
<user1>!bot
<Metis>This is Metis 2.7 Test 6
<user1>!bot
<Metis>This is Metis 2.7 Test 6
<Metis>Glad to be of Service!
                       Simple Commands
<command type=“script”>
<in>!bot</in>
<out>This is Metis %VERSION%</out>
<out>Glad to be of service!</out>
</command>
                                  See what that has done?
   Both <out>’s have appeared in order, but what if we wanted metis just to pick one at
                           random? Can we do that? Course we can!
            All we have to do is replace the word ‘script’ with the word ‘random’
 When the type of command is set to ‘random’ metis basically puts all of the <out></out>
                  sections into a hat, picks one, then displays this in the room.
                    Simple Commands
<command type=“random”>
<in>!bot</in>
<out>This is Metis %VERSION%</out>
<out>Glad to be of service!</out>
</command>
                                     .
                       Simple Commands
                                  A Common Room
<user1>!bot
<Metis>This is Metis 2.7 Test 6
<user1>!bot
<Metis>This is Metis 2.7 Test 6
<user1>!bot
<Metis>This is Metis 2.7 Test 6
<Metis>Glad to be of Service!
<user1>!bot
<Metis>Glad to be of Service!
<user1>!bot
<Metis>This is Metis 2.7 Test 6
                      Simple Commands
<command type=“random”>
<in>!bot</in>
<out>This is Metis %VERSION%</out>
<out>Glad to be of service!</out>
</command>

 Now, you may be asking yourself what the %VERSION% thing is, and why it don’t print
                                        that in the room.
                                This is Known as a Variable
                  There are two types of Variable, Static and Dynamic.
   Static variables store strict information gathered from system information such as
          usernames, ip addresses and other information that don’t change much.
 Dynamic variables can be written to and read from, and changed constantly during the
                     course of a command, but that’s for another lesson!
        Click for some examples of static variables, and how you can use them
                     Static Variables
                        Static variables include things like:
                                     %NAME%
                                  %RAWNAME%
                                 %LOCALTIME%
                                       %IP%
                                  %OLDNAME%
                                  %NEWNAME%
                                 And many more.
               An example of how they are used is on the next page.
See if you can see what changes have been made to that simple command we saw
                    before, and don’t be frightened to experement
              Static Variable Examples:
<command type=“script”>
<in>!bot</in>
<out>Hello there %RAWNAME%!</out>
<out>or would you prefer to be called %NAME%?</out>
<out>The time where I am is %LOCALTIME%</out>
</command>
              Static Variable Examples:
<user111_3456>!bot
<Metis247_1234>Hello there user111_3456!
<Metis247_1234>or would you prefer to be called user111?
<Metis>The time where I am is 13:23:21
             Static Variable Examples:
 See how metis replaced %RAWNAME% with the full name as shown in the userlist?
              And how %NAME% was just a shortened version of it?
%LOCALTIME% is the exact time shown on the clock of the computer metis is running
                                      on.

                         That’s all for this Basic tutorial,
                       Watch out for Part two coming soon!

						
Related docs
Other docs by yurtgc548
香港教育學院電影嘉年華
Views: 0  |  Downloads: 0
離散對數密碼系統
Views: 0  |  Downloads: 0
计算机编程与数据
Views: 0  |  Downloads: 0
無投影片標題
Views: 0  |  Downloads: 0
附件下载:Info20111118_51389.ppt
Views: 0  |  Downloads: 0
設置Hadoop
Views: 0  |  Downloads: 0
湖北英语教学网课件
Views: 0  |  Downloads: 0
课题ppt.ppt
Views: 0  |  Downloads: 0
物理層 (Physical layer)
Views: 0  |  Downloads: 0
物流专业英语
Views: 0  |  Downloads: 0