Select Object

To select the currently active object, use an object's name followed by a colon.


EGO:                      // select active object
     setPosition(10, 10);  // set Ego's position
     walk(10, 200);        // tell Ego to walk to another position

To refer to an object while another object is currently active, use the dot symbol.


EGO:
     // set Bob's position
     Bob.setPosition(10, 10);  
     // direct Ego to walk there
     walk(Bob.positionX, Bob.positionY);

Say-Statement

Since the AGAST script language is designed to write scripts, there is a shorthand statement that tells the active object to say a line of text.


ESKIMO:
     "Hello there, polar bear."
     "I wish I had your coat to wear."

is equivalent to


ESKIMO:
     say("Hello there, polar bear.");
     say("I wish I had your coat to wear.");

Notice that the say-statement is complete without a terminating semicolon. This is important to remember when using it inside another statement.


     if random(2) {
          "See you later."
     }
     else {
          "Bye."
     }
See Also...