AtmoWire  
  Adobe Atmosphere tutorials, resources, directory, reviews, and news.  
 
  Home
  Features
  Directory
  Forum
  Tutorials
  Resources
  Reference
  Calendar
  Contests
  Job Listings
  Builder Profiles
  Store
  Links
  Contact








Chat-Bots in Adobe Atmosphere
     Part five of a six part tutorial by Stuart Forbes

Setting up bot animation
What's Part 5 all about?
In Part 5 we'll show you how to include the bot in one of your own worlds - it's not hard and there are only a few things you need to do as the javascripts should do most of the work for you.

Step 1: Attach main script to world
Copy all the files that you uploaded in Step 4 into the same folder as your new world (apart from base.aer which is our original bot world file).

Now open your world in the builder and add type in base.js in the JavaScript URL section of World Settings.

Step 2: Attach bot script
Add an anchor point somewhere in your world and name it anc1. Now with the Object Inspector, type the name bot.js in the JavaScript URL section. This is the script that loads the bot, and sets up its animation.

Step 3: Set up bot positions
Add four anchor points to your world in the places you want your bot to move to - call them pos1, pos2, pos3 and pos4 (you can actually have as many of these as you want by altering the bot script - we'll show you how to do that later).

Step 4: Alter the HTML page
Save your world and then load the page botmain.htm into a text editor e.g. Notepad. Change the line that starts: vmp = new MTSPlugin("base.aer", by replacing the text base.aer with the name of your world. Now save the file.

Step 5: Test it out
If you now double click on the file index.htm in your world's folder on your hard drive you shold see your world loading with the bot inside it.

You should be able to move him around with the buttons on the right hand frames page just as you did in our world.

NB the bot won't be able to reply your questions until you upload the file to your web host. We suggest you experiment with the positions first to get them right before uploading.

Step 6: Upload to your web site
Once you have got the bot positioning right all you need to do is upload all the files (including ours) from your world folder to your web site and hopefully all will work from there!
 
Changing the number of positions
If you want more positions in your world for your bot to move to, just add more anchors ading 1 to the number at the end of the name e.g. pos5, pos6 pos7 etc.

If you are use more (or less) than the 4 position anchors you started with then you'll need to change the right hand frames page slightly. Load the file botcontrol.htm into Notepad, and look for this section: <tr><td height="20"><a href="javascript:dostu(3)" class="btn" title="b4">Position 4</a></td></tr>

Just copy and paste this text as many times as you need it underneath. You'll need to add 1 to the number in dostu() and to the number after Position each time. When you have finished, save the file.

You'll also have to change the main script slightly, like this:
  • Load the file base.js into a text editor ( e.g. Notepad)
  • Look for this line near the top ancn=Array("anc1","pos1","pos2", "pos3","pos4");
  • Now just add the names of the anchors you've added to the world to this list. Make sure there is a comma between each name and that there are quote marks either side (as for the others). If you want less positions just delete the ones you don't want from the END of the list.

Alter bot messages/orientation
While you have the file base.js loaded you might like to change the messages that the bot gives when:
  • Moving to each position - change the text on the line that starts: req= new Array("Please accompany
  • The player moves near the bot when in that position - change the text on the line that starts: info=new Array("Hello
You can also change the orientation of the bot when in that position by altering the line starting: rot=new Array(3.14/4 it's best to experiment with this to suit NB altering the anchor rotation in the world won't make any difference - you have to do it in the script.

When you have finished making the alterations, save the file.

Upload your amended scripts
Once you've made all your alterations,, don't forget to upload the files you've changed to your web site!

What's next?
In Part 6 of the tutorial we'll introduce you to some of the ways in which you can teach your bot to respond to different questions. Artifical Intelligence is a very large and complex subject but we hope to give you some pointers to at least get you started!


  Go to:     Part 1     Part 2     Part 3     Part 4     Part 5     Part 6 Coming soon  


Please be sure to check out Stuart Forbes' website at http://www.hsworlds.com.

To view more great worlds that Stuart has built Click Here.


Copyright© 2004 AtmoWire.com - All rights reserved.