home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Amiga Game Guide
/
AmigaGameGuide_CD.iso
/
Amiga
/
Tools
/
GRAC
/
Docs
/
commands.doc
next >
Wrap
Text File
|
1977-12-31
|
26KB
|
771 lines
GRAC V2.0 script commands
-------------------------
A GRAC script command has up to two parameters, which can be numbers,
flags, or preset variables. Flags are preceded by the '#' symbol, eg. #15 to
mean flag number 15. The preset variables are:
room - current room
item - selected inventory item
pc - player's character
entrance - last entrance point
gtime - time since the game began, in frames
rtime - time since the current room was loaded, in frames.
current - background/foreground/inventory item/character associated
with the script
string - string associated with selected object
height - height of the selected object
Most parameters can be set by pressing 'Help' after entering the command,
so there is no need to memorise what they all mean.
To insert a comment into a script, begin the line with a '*' character,
then type in the text.
Some old commands have additional comments for GRAC 2.0. These are marked
with an asterisk (*). Some commands are no longer needed and have been
removed from the list. They are described at the end of this file.
This list contains all commands available in GRAC version 2.0. It isn't
final: the easiest way to expand GRAC is to add new script commands.
Script control
--------------
Execute - -
Used in verb scripts to carry out the script associated with the selected
object.
Script script -
Execute the script, then return to the current position.
Set mark mark number
Sets a mark for use with the 'goto mark' command below. There is no
limit to the number of marks, but once a mark is set it cannot be
changed within the same script.
Goto mark mark number
Continue execution from the stated mark. Does not return when the
script ends.
* A computed goto is possible in GRAC 2.0, by using a flag for the mark
number. This can be very useful.
This form of goto only allows you to move within the same script. The
old (GRAC V1) form allowed jumps into different scripts. This is not
recommended, so the older form has been removed, though it will still
work if you really need it.
Timer script delay
The script is executed after a delay of the stated number of frames. All
activity continues as normal.
Timer off - -
Don't bother executing the script after all.
Pause delay
An alternative to the 'timer' command. After the specified delay the
script continues from the next line.
WARNING! Don't expect to get back to any previous script if this script
was started using a 'script' command. Also, don't place a pause in the
middle of a 'for-next' loop or 'if' block. It is really not placing a
pause in the script but stopping the script and restarting from the next
line after a delay. You can only have one paused script at a time.
Pause off
Cancels the paused script.
No default - -
As the first line of a script, this stops the verb script from being
executed. For example, if the verb script tells the character to walk up
to the object, and you don't want this to happen for a particular object,
use this command.
Compare value value
Sets two numbers to be used with the 'if' instruction. Flags can
be entered using the # symbol, and preset variables can be used.
Compare item flag value
The current inventory item and either the flag or the value (whichever is
positive) are set.
* You could just use the compare instruction but then you could not press
help to choose the item.
Compare entry flag value
As above, but the point that the player entered the room from is
compared. This is to have animations etc. dependent on which door the
player came through.
* You could use the compare instruction but then you could not press help
to choose the entry point.
If expression not
The expression compares the two values set with a 'compare' instruction.
As with all parameters, the expression is represented by a number.
1 is 'greater than'
2 is 'greater than or equal to'
3 is 'equal to'
4 is 'less than or equal to'
5 is 'less than'
The commands following the 'if' will only be executed if the expression
is true. If the 'not' parameter is -1 the execution will continue only if
the expression is false.
This is all a bit complicated so here is an example. Suppose that flag (1)
holds the value 4 and flag (2) holds 5.
compare #1 #2
if 3 0
bell
end if
Will the bell ring or not? The answer is no because expression 3 is
'equal to' and flag (1) is not equal to flag (2).
If the following were used instead the bell would ring.
compare #1 #2
if 5 0
bell
end if
End if - -
This marks the end of an 'if block'. An 'if block' begins with the command
'if' and ends with 'end if'. If blocks within if blocks are allowed.
Else if expression not
Used within an 'if block'. 'compare' commands are always executed
regardless of if's, so 'else if' can use a different test to the original
if.
Else - -
Used before the end of an 'if block', if no expressions have been true in
the entire block then execution continues from here.
For flag start value
Next limit -
The flag is set to the start value, and the commands between 'for' and
'next' are repeated, incrementing the flag by one each time, until the
limit is reached.
Note that 'flag' is just a number, without a '#'.
Wait frames -
Wait for the specified number of frames. A frame lasts one tenth of a
second unless the game is slowed down by too many objects on screen.
Wait click frames -
Waits for a mouse click, or the specified number of frames, whichever
comes sooner. If 'frames' is zero, GRAC will wait for a mouse click.
End
Ends the current script.
Quit
Quits from the game.
Screen control
--------------
Hide - -
Both the mouse pointer and the control panel disappear.
Show - -
Brings back the control panel and mouse pointer.
Show picture - -
Loads and displays a picture. This is useful for title screens.
Picture off - -
Removes a picture displayed using 'Show picture'.
Load palette picture -
Loads the picture purely to use the palette. It is not displayed, but
does use memory so it is best to use small screens for this purpose.
Control palette picture -
As the above command, but the palette will be used for the control panel.
Fade speed -
Fades into the palette loaded as described above. The fade takes speed*15
1/50ths of a second.
Fade in - -
When a startup script begins, the display is not visible until either the
end of the script, or this command.
Fade picture speed -
Fades a picture to black.
Fade control speed -
Fades the palette of the control panel into the one loaded with 'control
palette'.
Flash colour string
The string contains information used to change the colour in a rapid
sequence. Useful for animation effects. The string has the form
(RGB,delay)(RGB,delay)....
RGB sets the red, green and blue components of the colour, from 0 to F
(This is in hexadecimal, where the sequence of numbers is 0,1,2,3,4,5,6
7,8,9,A,B,C,D,E,F)
For example, 000 is black, F00 is bright red, 888 is grey and FFF is
white.
Delay sets the time until the colour is changed again, in 1/50ths of a
second. Therefore, multiply by five to have the delay in frames.
Cycle first colour last colour
The colours between the two values are cycled, just like the colour
cycling in Dpaint.
Cycle off
Stops colour cycling.
Scroll off
Stops automatic scrolling of the screen.
Scroll on
Restarts screen scrolling.
Scroll X distance Y distance
Scrolls a specified distance in the X and Y directions.
Character control
-----------------
Go character -
Also used by verb scripts to make the character walk to the selected
object. As with all character parameters, -1 or 'pc' means the player's
character. If the selected object is a character, the player's character
will attempt to walk to a point in front of the other character. If an
object does not have a base, it will be impossible to execute a 'go'
command.
Walk off - -
Stops the player from moving.
Walk on - -
Allows the player to move again following a 'walk off' command.
Wait stop character -
Wait for the character to reach the point they're heading to. If zero
(0) is entered as the character number, it will be possible to interrupt
the walk with a mouse click.
* Previously, if -1 was used to indicate the player's character, the
movement could be interrupted with a mouse click. In GRAC 2 it is
possible to have more than one player character, so I had to change
this.
Stop character -
Stops the character moving.
Place character character point
Puts the character at the point.
Hide character character -
The character disappears.
Walk character point
The character walks to the point.
Reach character height
The character reaches at the chosen height, where 1=low, 2=middle,
3=high and -1 or 'height' to use the default for the current object.
Take character foreground object
The character reaches for the object, the object disappears and is added
to the characters inventory. -1 or 'object' for the object indicates the currently
selected object. For this to work the object must have a negative flag
and the 'take' option must be set to the appropriate inventory item.
Face character direction
The character faces the specified direction. 1=right, 2=left, 3=in,
4=out
Add item item character
The chosen item is added to the characters inventory.
Drop item item character
As above, but the item is dropped. Actually it just vanishes.
Character frame character image
Change the animation frame of a character. The image as grabbed in the
character editor.
Body frame character image
As above, but the image should have no head, which will be added
separately. This is to allow characters to speak when not in a standing
position.
Character change character (a) character (b)
Character (a) takes on the appearance of character (b). The effect is
preserved until the characters are reloaded with a new object bank. This
command is ideal for changes of clothing etc.
Switch character -
Puts the player in control of a different character.
Say character string
The character says the string, which appears above the characters head
while the characters head is animated. As with print, @ starts a new
line. The text is also split at full stops, question marks and exclamation
marks. This is because text looks very odd if it is not split at natural
points in the string.
* In GRAC 2 you can animate the character from within the string. Begin
the string with a '¶' symbol (alt-p), then include the animation
in the form (frame,delay)(frame,delay)........ where 'frame' is the
image number as in the character editor and 'delay' is the number of
screen updates until the next image. Finish with another '¶' then type
what the character actually says. You can include animation at the start
of a new line as well, after the '@'.
eg. ¶(56,1)(57,1)(58,1)(56,1)(57,1)(58,1)¶I'm waving my arms about.
Voice string point
The string appears above the point, but it is not necessary to have a
character there to say it. If 'point' is zero, the coordinates set
using the 'position voice' command will be used instead. This is to
allow voices to be used on screens which have no points, such as
close-ups or picture screens.
Set voice colour height
This sets the colour of the voice text, and the height above the point,
in pixels.
Position voice X position Y position
Sets the position used for voice text.
Animation
---------
Object frame f. object image
The object's image is changed. Warning: this is not permanent. If the
player leaves the room and returns, the object will change back to its
original image. If you don't want this to happen, change the object in
the room's startup script.
Anim f. object string
Animates the object according to the contents of the string, which must
have the following form:
(X position,Y position,image)(X position,Y position,image)....
Amal (see below) can also be used to animate objects. However, I
reccommend that you use Anim instead. The main advantage over amal is
that you can create the string using a point-and-click method by pressing
help. It is also fully compatible with the save/load feature, even if the
animation doesn't loop. The maximum number of frames is 100. Like
'object frame', anims have no permanent effect.
Amal f. object string
The most versatile way to animate an object. If you use AMOS then you
will probably be familiar with Amal. If not, this is how to use it. I
can't cover everything; the AMOS manual has an entire chapter on Amal,
but the basics are as follows:
The object will be animated according to a set of instructions held in
the string, separated with semi-colons ( ; ). Each instruction is a
single upper-case letter, followed by some parameters. Any lower case
letter are optional.
Move across,down,steps
Moves the object across and down the number of pixels specified in the
number of steps selected. Each step takes one frame to perform.
Anim number,(image+RZ,delay)(image+RZ,delay)....
Animates the object by cycling through the images the set number of
times. A value of zero for the number means to repeat continuously.
Delay can be any number greater than zero and is the number of frames
to wait before moving on to the next image. This command is ideal for
adding background animations such as dripping taps and flashing lights.
RZ is a register. Read the note below.
Let register=expression
The register is set according to the expression. The registers are:
R0 to R9, internal registers which are different for every object,
RA to RZ, global registers for passing information between objects,
X, the objects X-position
Y, the objects Y-position
A, the objects image. This may be different to the image number used
by GRAC. To get the actual image, add RZ to GRAC's image number.
Example: L R0=3; sets internal register 0 to a value of 3.
For register=start To end ;.....;Next register
This is a For...Next loop similar to those used in scripts. The
register begins at <start> and is increased by 1 each loop until it
reaches <end>.
Jump label
Amal jumps to the specified label. A label is a single capital letter
followed by a colon ( : ), which can be anywhere in the string.
Pause
Waits for one update.
End
Ends the Amal program.
There are many more Amal commands. Refer to the AMOS manual for details.
You should really only use repeating strings (with a Jump at the end) or
continuous Anims to be compatible with the save/load feature. This is
because when a game is loaded the Amal string is always started from the
beginning.
* The Anim command is usually better than Amal. Use it instead if
possible.
Paste b. object image
Paste the image over the background object. This method of animation is
quicker and uses less memory than with foreground objects. However, once
pasted, the image cannot be deleted except by pasting another image over
the top. Only one image may be pasted per frame, except in a startup-
script when the display has not been faded in.
This is not a permanent effect (see object frame).
Freeze - -
Stops all animation until an 'unfreeze' command is encountered. Note that
'wait' allows animation to continue, stopping only the script. This
command freezes the display and lets the script continue. However, the
'paste' command cannot be frozen, only objects and characters.
Unfreeze - -
See above.
Play anim animation delay
Plays iff animation, with the delay between frames in 1/50ths of a
second.
Limbo - -
Useful when playing large animations, this command clears all non-
essential data from memory. A 'load room' command is required to
continue with the game.
Sound
-----
Bell - -
This command makes a bell sound. It is useful mainly when debugging, to
make sure that part of a script is actually executing.
Sound left sample frequency
The sample is played through the left speaker (channel 0)
Sound right sample frequency
As above but uses channel 1
Sound centre sample frequency
Sound through channels 0 and 1 simultaneously.
Sound back sample frequency
Sound through channels 2 and 3, looped. This is intended for background
noise.
Load sample sample -
Usually, samples are loaded when they are played. Use this command to
load a sample in advance. Don't load too many samples as this uses
memory.
Erase sample sample -
The sample is erased, saving memory.
ST play pattern loop
Starts soundtracker music playing from the specified pattern. The music
will loop indefinitely (unless stated otherwise in the song itself) and
is fully compatible with samples. Music is suspended on the necessary
channels until the sample ends. If 'loop' is zero, the music is assumed to
be looping continuously and will be restarted if a saved game is loaded.
Otherwise, the music will not be restarted if a game is loaded.
Music stop
Stops the music.
Miscellaneous
-------------
Load room room point
Loads a room and positions the player's character at the specified point.
Scale percentage
Sets the overall scaling factor for all characters in the room, as a
percentage of full size. Characters can only be reduced in size, so the
percentage must less than 100. There is a minimum scaling factor of 25%,
because characters drawn smaller than this are just not recognisable.
Using this command you could have a large scene with tiny characters
in it (Future Wars style), or even write a computer version of 'The
Incredible Shrinking Man'. When combined with the 'perspective' command,
virtually any type of scene could be created.
One problem I have found is that when animating scaled characters, they
tend to wobble around a bit unless the animation frames are precisely
the same size. This applies especially to talking frames. This is not a
bug but a side effect of the scaling process. The solution is to grab
the animation frames from within a box the same size for each frame, and
with the hot spot in the same relative position.
Perspective floor horizon
Turns on character scaling for the room, dependent on Y position. 'floor'
and 'horizon' are Y positions on the screen. Below 'floor', characters
are drawn full size. Above 'horizon' they are drawn at minimum size (1/4
full size). In between these positions they are scaled proportionally.
Note that neither 'floor' nor 'horizon' need actually be placed in the
visible area of the screen, and negative values are allowed.
The HEIGHT of a zone affects the scaling. Thus you can have a character
climb up to a higher level without being reduced in size, or put the
perspective in reverse for weird camera angles.
Static f.object
This command can be used to speed up the screen update in rooms with
a lot of objects. If an object is never going to move, it can be drawn
quicker by not replacing the background underneath it. Simply use
this command in the startup script, before the screen is faded in.
By making objects static, you can have more of them on screen without
causing the game to run at a snail's pace.
Close up close up -
Begins a close up.
Exit close up - -
Leaves the close up.
Choice string flag
Adds a choice to the current selection if the flag is true (flag zero is
always true, remember). The obvious use for this feature is to create
multiple choice conversations. The maximum number of choices is 10.
Note that 'flag' is just a number, without a '#'.
Choose flag character
The player must choose between all available choices by clicking on the
string which is printed in the text window. The flag is then set to
whatever choice was made (ie. 1 for the first choice, 2 for the second
etc.) All choices are then cleared. If the character parameter is not
zero, that character will now say the selected string.
Note that 'flag' is just a number, without a '#'.
Set flag flag value
Sets the flag to the value. This may cause objects or walk zones to
disappear if they are dependent on the flag. Any such change is
permanent (until the flag is changed again).
Note that 'flag' is just a number, without a '#'.
Clear flags first last
Sets all flags between the 'first' and 'last' to zero.
Toggle flag flag -
If the flag is zero, it is set to one. Otherwise it is set to zero.
Note that 'flag' is just a number, without a '#'.
Random flag limit
The flag is set to a random number, up to the allowed limit. If the limit
is negative, the random number may be positive or negative. Otherwise it
will always be positive.
Note that 'flag' is just a number, without a '#'.
Add flag value
Adds the value to the flag.
Note that 'flag' is just a number, without a '#'.
Subtract flag value
Subtracts the value from the flag.
Note that 'flag' is just a number, without a '#'.
Flag to string string flag
The string is changed to the digits of the flag. See the note for 'Set
string' below.
Note that 'flag' is just a number, without a '#'.
Set string string (a) string (b)
String (a) is set to string (b). Remember that the string will not
actually be changed until the game runs and the script is executed.
With the text editor you set the initial strings. Also, no text strings
are saved with saved games, so don't use this command to change strings
that you intend to use later, only in the same script.
Clear string string -
The string is cleared. See the note for 'Set string'.
Add string string (a) string (b)
String (b) is appended to string (a). See the note for 'Set string'.
Print string -
The specified string is printed in the text window. Remember that the
parameter is actually a number, which refers to a text string. -1 or
'string' for the string indicates the description of the selected object.
An '@' character indicates the start of a new line.
Save off - -
Disables the save game feature.
Save on - -
Allows games to be saved.
Verb off verb -
Stops the verb from being used
Verb on verb -
Allows the verb to be used.
Restart
Starts the game again from the beginning.
Quit
Quits from the game.
*****************************************************************************
For various reasons, the following commands are now obsolete. They still
work, but only for compatibility with earlier versions of GRAC. You should
never use them.
Goto script line
Continue execution from any line in any script. Does not return when the
script ends.
Link script line
This is not quite the same as goto. The program continues from the stated
script and line but will do so even if the link is in the middle of an if
block which is not being executed. This command is used to effectively
join scripts together to make a longer one.
Compare flag flag (a) flag (b)
This sets flags (a) and (b) for use with the 'if' instruction.
WARNING: do not confuse this with 'compare value'.
Compare value flag value
Similar to the above instruction but sets a flag and a number.
Add flag flag (a) flag (b)
Flag (b) is added to flag (a).
Subtract flag flag (a) flag (b)
Subtracts flag (b) from flag (a).
Copy flag flag (a) flag (b)
Flag (a) is set to the value of flag (b).
Med play has been removed, because: 1) it didn't work very well, 2) it was
taking up unnecessary memory when not being used, and 3) as copyrighted
software, it is of dubious legality to distribute the med library.
'Select' and 'End select' never worked in the first place. They were included
in the original documentation by mistake!