ERights Home e 
Back to: E World Scripting On to: VB-Like E World Scripting

Original VB-based
Scripting Proposal


This is the original email message from Tony that started all this off. Here is my current best response on what these examples would look like in E for those in the C syntactic tradition, and here are the same examples expressed in E for those in the Visual Basic syntactic tradition. The examples in this message and the E-based response are now cross-linked to each other so you can easily see how the examples compare.


Date: Fri, 26 Sep 1997 14:04:30 -0700
To: markm-at-communities.com, crock@communities.com, marcs@communities.com,
        jay@communities.com
From: Tony Grant <tony@communities.com>
Subject: E

I've spoken briefly with most of you about E and my hopes that it will truly be just that. Mark has asked me to provide a few samples of Visual Basic syntax. I've listed some sample scripts that I'd love to use. I'll state briefly what the script should do and then provide some VB-like pseudo code to illustrate how simple I would like things to be. [MarkM: This is not literal VB syntax, but enough to give you the flavor]

This also makes a couple of assumptions about E that I haven't heard anything completely final about: it can be both a word scripting tool: Run Microcosm and do tests via a script mechanism

One question I have about the syntax is how much overhead is needed for any particular script. Crock and I briefly discussed how neat it would be to have an E script for every unum which is not much more than a giant text field. It would be great if the script could simply state the little bit of functionality and nothing else. In my mind, this is what separates a script from a program. Users of the scripting language shouldn't have to deal with:

  #include <stdio.h> or
  import EZ.Avatars.Speech

or any other overhead junk.


[See the E Version]

Some of the neat behavioral stuff we can do depends on the events that we've defined. I know we'll at least have timer events, RegionEntry, RegionExit, Bump ( walked into an object) , Click... I think we're also doing Speech (triggered when anybody says something in a region. And maybe some others.

In VB, each of these would be a Method available to each object, and each Method would have a defined set of parameters relevant to the event:

Click()
Bump()
RegionEntry(AvatarName as String)
RegionExit(AvatarName as String)
Speech(AvatarName as String, Text as String)
...

Useful functions and data:

MyName
ListObjects()
ListAvatars()
ListPortals()
ListTeleportPads()
ListLocalRegions()
ListGestures()  [gestures known to this object]
PlayGesture(GestureName as String)
Say(Text as String)

Launch (AvatarName as String,RegionName as String)
WalkTo (RegionName as String)
TeleportTo (RegionName as String)

Here are some script examples:


[ See the E for C Version] [See the E for VB Version]

1. Launch Microcosm with Yappy as the avatar and have him transition back and forth between CentralPark region and BeachResort.

This would help us to find any memory leaks occurring on transitions. I don't know how much overhead would be involved in this, but it would be great if it we're simple:

   Launch("Dax","CentralPark")

   For i = 1 to 100
      TeleportTo("BeachResort")
      TeleportTo("CentralPark")
   Next i


[ See the E for C Version] [See the E for VB Version]

2. Visit every region in a realm. This would a great script to run after new art checking to make sure that none of the new regions have broken the world.

   Launch("Dax","CentralPark")

   regions = ListLocalRegions
   For each r in regions
      TeleportTo (r)
   Next

Alternatively:

   Launch("Dax","CentralPark")

   regions = ListLocalRegions
   For i = 1 to regions.Size
      TeleportTo regions(i)
   Next


[ See the E for C Version] [See the E for VB Version]

3. Simple Click response:

   Define Sub Click()
      Say ("Ow!")
   End Sub


[ See the E for C Version] [See the E for VB Version]

4. The next generation Click response. Play a random gesture.

   Define Sub Click()
      gestures = ListGestures()
      size = gestures.Size
      n = Random(size)
      PlayGesture(gestures(n))
   End Sub


[ See the E for C Version] [See the E for VB Version]

5. A greeting bot. When an avatar enters the region, the bot welcomes him or her:

   Define Sub RegionEntry(AvatarName as String)
      Say("Hi " + AvatarName + ". Welcome to KidsWorld!")
   End Sub


[ See the E for C Version] [See the E for VB Version]

6. A ridiculously simple Eliza:

   Define Sub Speech(AvatarName as String, Text as String)
      Say ("That's interesting " + AvatarName + ". Tell me more about " &Text)
   End Sub


[ See the E for C Version] [See the E for VB Version]

7. Have a bot in your Turf that reacts to the mention of your name.

   Define Sub Speech(AvatarName as String, Text as String)
      If InStr(MyName,Text)
         PlayGesture("Spin")
         Say ("I sure do love " + MyName)
      End If
   End Sub


[ See the E for C Version] [See the E for VB Version]

8. The wandering avatar: (no error checking for a region with no portals)

   Launch("Dax","CentralPark")

   For i = 1 to 100
      regions = ListRegions()
      size = regions.Size
      n = random(size)
      WalkTo (regions(n))
   Next i

This is my target. If things we're this easy, I'd be ecstatic. I don't particularly care about If...EndIf and For...Next vs. braces, although scripting languages do seem to tend towards the former. It's arguably more human readable (as opposed to more programmer-readable).

I'd like a user who's never programmed before to be able to select from a list of default script behaviors, look at the text and understand what's going on. She could then change a text string and be thrilled to se the behavior reflected in Microcosm. Feeling more ambitious, she cuts and pastes a few scripts together and starts becoming comfortable with the syntax. Soon her turf is crawling with lively objects...

 

 
Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
ERights Home e 
Back to: E World Scripting On to: VB-Like E World Scripting
Download    FAQ    API    Mail Archive    Donate

report bug (including invalid html)

Golden Key Campaign Blue Ribbon Campaign