A.G.S. v2.21
Text Script Commands Manual by Spyros

Main Page
Character

Cursor
Dialogue
Display
File
Game
GUI
Inventory
Music,Sound,Flic

Palette
Object

Room
Screen
String

 

AnimateObject (int object, int loop, int speed, int repeat)
Starts the object number OBJECT animating, using loop number LOOP of its current view. The overall speed of the animation is set with SPEED, where 0 is the fastest, and increasing numbers mean slower. The delay for each frame is worked out as SPEED + FRAME SPD, so the individual frame speeds are relative to this overall speed. The REPEAT parameter sets whether the animation will continuously repeat the cycling through the frames. If REPEAT is zero, the animation will start from the first frame of LOOP, and go through each frame in turn until the last frame, where it will stop. If REPEAT is 1, when the last frame is reached, it will go back to the first frame and start over again with the animation. If REPEAT is 2, it will do the animation once, but then return the graphic to the first frame and stop (whereas repeat=0 will leave the graphic on the last frame).
Example:
AnimateObject(3,4,0,1);

AreObjectsColliding (int obj1, int obj2)
Checks if object OBJ1 and OBJ2 are touching each other. Returns 1 if they are, and 0 if they are not.
NOTE: This function only performs a rectangular check, even when pixel- perfect click detection is turned on.
Example:
AreObjectsColliding(3,4);

GetObjectAt (int x, int y)
Checks if there is a room object at SCREEN co-ordinates (X,Y). Returns the object number if there is, or -1 if there is not.
See the description of GetLocationName for more on screen co-ordinates.
Example:
GetObjectAt(245,123);

GetObjectGraphic (int object)
Returns the current slot number that OBJECT is displayed as.
Example:
This will change the Object's 0 Graphic to slot number 300 if the current displayed slot is number 299
if ((GetObjectGraphic(0)==299) SetObjectGraphic (0,300);

 

GetObjectX (int object)
Returns the X co-ordinate of room object number OBJECT.
Example:
GetObjectX(3);

GetObjectY (int object)
Returns the Y co-ordinate of room object number OBJECT.
Example:
GetObjectY(3);

IsObjectAnimating (int object)
Returns 1 if the specified OBJECT is currently animating. Returns 0 if the object has finished its animation.
Example:
IsObjectAnimating();

MergeObject (int object)
Merges object number OBJECT into the background scene for this room. By doing this, the object becomes part of the background and so does not slow the game down. This is a 1-way operation - once the object has been merged, it cannot be changed back and the state of the room is permanently altered. Therefore you should only use this function if a game event has occured that means the room is permanently changed. NOTE: after calling this function, you cannot use the object any more and it is permanently removed from the game.
NOTE: objects can only be merged if the object graphic was imported at the same colour depth as the background graphic
Example:
MergeObject(3);

MoveObject (int object, int x, int y, int speed)
Starts the object OBJECT moving from its current location to (X,Y). It will move at speed SPEED, which uses the same scale as the character Walk Speed values in the Room Editor.
Example:
MoveObject(3,234,67,4);

MoveObjectDirect (int object, int x, int y, int speed)
Starts OBJECT moving from its current location to (X,Y), ignoring all walkable areas on the screen. The object will therefore move directly to
the destination in a straight line.
Example:
MoveObjectDirect(3,234,67,4);

ObjectOff (int object)
Turns object number OBJECT off. It will no longer be displayed in this room until you use an ObjectOn command.
Example:
ObjectOff(3);

ObjectOn (int object)
Turns object number OBJECT on. It may have been turned off previously with ObjectOff or may have been set initially off in RoomEdit.
Example:
ObjectOn(3);

SetObjectFrame (int object, int view, int loop, int frame)
Sets object number OBJECT's graphic to frame FRAME of loop LOOP of view number VIEW. This is useful if you want the object to use the second loop in a view for an animation, because using the SetObjectView function in room startup code will cause loop 0 to breifly flash on the screen first.
Example:
SetObjectFrame(3,4,7,2);

SetObjectGraphic (int object, int slot)
Sets the graphic for object number OBJECT to slot number SLOT. You can get the slot number from the Sprite Manager in RoomEdit. If the object is currently animating (from an AnimateObject command) then the animation will be stopped.
Example:
SetObjectGraphic(3,274);

SetObjectPosition (int object, int x, int y)
Changes the object number OBJECT's position to (X,Y). These co-ordinates specify the lower-left hand corner of the object.
Example:
SetObjectPosition(3,234,67);

SetObjectTransparency (int object, int amount)
Sets OBJECT to be AMOUNT % transparent. Setting AMOUNT to 100 means it is totally invisible, and lower values
represent varying levels of transparency. Pass AMOUNT as 0 to stop the object being transparent.
NOTE: Transparency currently only works in hi-color games, and the object
must have been imported in hi-colour for the transparency to work.
NOTE: Having a large transparent object can significantly slow down the engine.
Example:
SetObjectTransparency(3,60);

SetObjectView (int object, int view)
Sets object number OBJECT's view to VIEW. The graphic is set to the first frame of loop 0 of the view.
Example:
SetObjectView(3,12);