Frequently Asked Questions

When I run Magsbot, I get an error saying it can't find the behavior table, buttons, userdefs or variable list files. What's the problem?

Magsbot saves the locations of these files in magsbot.ini, and in earlier versions it saved the entire path name. It still saves the entire path if you have Files/Save Full Path checked. If you move the files to another folder after having saved the configuration, then the path name might be incorrect, if you had Save Full Path checked. If this happens, you can correct the problem by editing magsbot.ini and changing BehaviorPath=c:/SomePathOrOther/behavior.beh to BehaviorPath=behavior.beh (in other words, keep just the filename without the path) in the [Behavior] section.  Make the same change for UserFuncsPath= and ActionButtonsPath= in the [Behavior] section and VarListPath= in the [Eval] section.  In each case, remove the first part of the path name (for example c:/SomePathName/ ) so that only the filename itself (for example buttons.btn) remains. Magsbot will then look for the files in the current folder instead of the folder where you moved the files from. You should only need to perform this fix again if you move the files to a different folder, and only if you have Save Full Path checked.  If you've only used more recent Magsbots, you probably won't see this problem at all.

You can avoid this whole problem by unchecking Files/Save Full Path, and then clicking Files/Configuration/Save Configuration.

How do start up a new bot instance?
First you should set the location that you want the bot to appear at, on the Location tab. (See the next question below.) Then click Connection/New Instance... and enter the name you want for the bot, your citizen ID (citizen number) and your privilege password, and click Ok. (For the main AW universe, the port is 0 and the address can be left blank.)

How do I move the bot to another location?
Just enter the coordinates of the desired location on the Location tab, and click the Set button on that tab. You can enter the coordinates directly into the boxes on the dialog, if you use SDK-style coordinates, or if you prefer you can instead click the AW Coords button on the Location tab and enter the coordinates in the same format used by the AW Brower (like "AW 15n 775e", etc.).

Can I run a bot in another universe?
Of course. Just enter that universe's address and port when you create a new instance (see above). If you're going to be running bots in that universe most of the time, then you can also click Make default for new instance on the New Instance dialog. There are also some buttons in the Universes tab of the Actions panel that will set the default port and address for several popular universes.

How do I change the start location of the bot?
Manually move the bot to the desired start location (see above), then click File/Configuration/Save.

How do I change the bot's name?
Click the "Change Bot Name" button on root tab (the tab labelled ".") of the Actions panel.

How do I start multiple bots at the same time?
You can create a button on the Actions panel that will do this for you. First manually create each bot instance that you want and position them as desired. Once they have all started and moved to the locations you want them at, click on "Create MultiInstance Button" on the Action panel, in the root category tab (that is, the tab with "." on it). Enter a name for the group of bots, and a new button will be created named something like "StartInstances SomeName".  You can then click the new button whenever you want to start the same group of bots at the same locations.

You can also cut and paste the button into a different category, which is recommended. (Right click on a button to see cut and paste options.)

Note that your citizen number and privilege password is saved in the button, but if you prefer you can edit the button afterward and replace the citizen number and password with macros like @myuserid and $mypassword and then create macro definitions by editing userdefs.udf with a text editor and adding a pair of lines like @myuserid=12345 and $mypassword="put_your_password_here".  That way you would be able to give the startup button to someone else to use, without giving away your password; the other person using the button would create macros in userdefs.udf containing their own citizen number and password instead. (After editing userdefs.udf, you need to restart or press Ctrl-F11 to reload it. It's best to turn off the behavior table (Ctrl-B toggles the table on/off) when reloading the userdefs.udf.)

How do I start multiple bots at the same time, automatically?
Create a MultiInstance button as explained in the previous question above, then add a line to the Behavior Table (see the next question) like this:
 
Active Event Action
On STARTUP ENQUEUE { CLICKBTN "YourButtonName" }

Whenever you start Magsbot, the MultiInstance button that you created will be activated. (Technical note: the reason for using the "ENQUEUE" command here is to give the program a chance to finish initializing before your button is activated.)

How do I change the Behavior Table?
Press Alt-B or click Behavior... on the menu to open the Behavior Table window. Position the cursor (a dotted outline) on any column of the row where you want to add a row, then click Insert (or press Alt-I) to insert a blank line. (Note: it's usually best to add your custom rows at the top of the table, before any of the standard behavior.)  Double-click on a column to edit it. (Or, move the cursor to the column you want to edit and press Enter.) Double-clicking on the Active column toggles the row On and Off.

How can I control my world's weather with Magsbot?
To allow visitors to your world to control the weather "on demand" by clicking buttons, see instructions here. To control the weather (i.e. time of day settings like sunrise, sunset, etc.) automatically, see here.

Does Magsbot have a way to generate random numbers?
Yes, there is a random number operator, #, that you can use in numeric expressions. The operator works like a die roll, with the first number being the number of dice and the second number being the type of die. So example, a random number similar to a roll of 3 six-sided dice (or "3d6" in role-playing game terminology) would be expressed as 3#6.  More simply, a random number from 1 to 100 would be 1#100.  A number from 3 to 7 would be 1#5+2.

Can I create an "invisible" bot instance in my world?
Yes, just uncheck the Options/AutoAppear menu item before starting the instance.  Or if you want to have a bot connect but not enter any particular world, then uncheck Options/AutoEnter before starting the instance. If you later want to have the bot enter the world and appear, you can click Set on the Location panel.

How can I check if an avatar is within a particular area?
There are several ways of defining an area in Magsbot, but the latest and most simple way is to use "zones". (Note: Magsbot zones should not be confused with the zone objects that can be created in AW 4.1.)  You can define a zone using the SetZoneN (north boundary), SetZoneS (south boundary), SetZoneW (west boundary), SetZoneE (east boundary), SetZoneB (bottom) and SetZoneT (top)  buttons on the root . tab of the Actions panel. After setting the zone boundaries, click SetZoneActive. You can then use the @inzone[$zonename,@session] function to see if an avatar is within that zone. One advantage of zones over the older methods that Magsbot has used in the past, is that the ZONEENTER and ZONEEXIT events can notify you when someone enters or leaves a zone without the need to constantly check for avatar location in an AVATARCHANGE event. For more information about zones, see here.

Another, older, method of defining an area in Magsbot is to define the area within a user-created variable list, and then use the @inbounds[@session,@vlist] function, which is built in to the Magsbot program and more efficient and faster than the even older "safe" macro method.

How do I log IP numbers?
The simplest way would be to create a button to do that. To create new button, right-click on any of the button tabs on the Actions panel and choose "New" from the popup menu. (Or better yet, choose "Category/Add" from the popup menu and create a new tab for your own buttons first!)  Put this code in the new button:

@v=@vlist;
for i 0 @avspresent-1 {
    store @v $nearby[@i]=$ipof[@nearby[@i]] };
showvlist @v "IP addresses";
freevlist @v;

Then you can click that button to see the IP addresses of nearby avatars, when you have a bot instance running. (If you have several bot instances running, select the the one that you want to see the information for, from the Instance List (Alt-I) before clicking your button.)

How do I use the database?
You can use any kind of database that is supported by ADO, but for an example I've included a Microsoft Access database in the Magsbot package. Press Shift-F3 to see the database dialog, then click the Set button there to update the data. You can use the navigation buttons to add or delete records (see here).

If you're familiar with SQL, you can enter SQL statements in the SQL text box and click Set to update. (Whatever you type in the SQL box overrides anything in the Table box.)  You can add or delete fields to the database using SQL statements or by editing the database directly if you have MS Access.

To use a different kind of database, find the correct ADO connection string for the database type (this is a good source, and there are some examples on the Database tab of the Actions panel) then enter that in the Provider and Connection boxes (the Provider box is often left blank, if the Provider is specified in the Connection string).

You can connect to multiple databases at once within Magsbot programs by using the @dbopen function to create a new database handle for each connection, then use the Magsbot DATASET { } command  in the program to specify which connection to apply data operations to.

You can find more information here.

How do I log information in the database?
There's an example here.  Insert a row into the behavior table (at the top), and put AVATARADD in the "Event" column and the example code in the "Action" column. Double-click the "Active" column so it says "On".