This is a listing of all the plotscripting commands implemented as of December 16 1999. More commands will be added in the future.
In addition to reading this document, I also reccomend you check out Plotscripting Tutorial and the HamsterSpeak Specification
Wait Commands
wait (ticks)
Makes the script wait for the specified number of ticks. I havent timed how many ticks there are in a second, but I would guess roughly 15. If you leave out the argument, it will wait for one tick.
wait for text box
makes the script wait until there is no text box displaying on the screen. Useful to know when to move on after using a show text box command
wait for hero (who)
Waits for the specified hero stop walking. Use the constant me to refer to the leader, or use numbers 0,1,2,3 to refer to a specific hero. If you leave out the argument, the first hero will be assumed.
wait for key (key)
Waits for the player to press a key. You can use the follwing constants:
any key,
up key,
down key,
left key,
right key,
use key,
cancel key, or
menu key.
If you do not specify, then any key will be used.
wait for NPC (who)
Waits for the specified NPC to stop walking. The argument is the number of the NPC, 0 to 35. If more than one copy of the NPC exists on the map, it only checks the first one.
wait for camera
Waits for the camera to stop moving after a pan camera or focus camera command.
wait for all
Waits for any camera motion to stop, waits for all heros to stop walking, and if suspend NPCs is active, waits for all NPCs to stop walking.
suspend player
Blocks the player from controlling the game, so the plotscript can have exclusive control. The one exception to this is text boxes. The player can advance text boxes no matter what.
resume player
Restores normal control after a suspend player command. This is very important. If you use suspend player, but forget resume player, the game will be stuck after the script ends.
suspend NPCs
Stops NPCs from walking around automatically. When Suspend NPCs is run, all NPCs stop in their tracks, ready for you to control them with the walk NPC command
resume NPCs
Restores automatic NPC movement after a suspend NPCs command
suspend obstruction
Allows heros to walk through NPCs, allows NPCs to walk through heors, and allows NPCs to walk through each other.
resume obstruction
Restores normal obstruction after a suspend obstruction command
suspend catapillar
Stops your other heros from following the leader. This is useful when you want to control them individually with walk hero commands.
resume catapillar
Reverses the suspend catapillar command, and makes your other heors follow the leader as normal.
suspend random enemys
Prevents enemies from attacking your party while walking over tiles that can normally spawn random battles. This is useful to prevent battles from interrupting a plotscript.
resume random enemys
Undoes the suspend random enemys and allows random battles to occur as normal.
suspend box advance
Prevents the player from advancing or clearing text boxes by pressing keys. While this is active, the only way to make a text box advance is with the advance text box command. Be very careful with this command, since you do not want to leave the player stuck on a text box forever
resume box advance
Undoes the suspend random enemys and allows the player to advance and clear text boxes by pressing keys as normal.
walk hero (who,direction,distance)
Makes the specified hero move in the specified direction for the specified number of tiles. The first argument tells who to move. Use me or numbers 0-3. The second argument is the direction. Use the constants:
north,
south,
east,
west,
up,
down,
left, or
right.
The third argument is the number of tiles to move. If you leave out the third argument, the hero will move one tile.
walk hero is usually used with the wait for hero command.
You should normally use the suspend player command before moving heros, and if you want to move heros other than the leader, you should use the suspend catapillar command.
walk NPC (who,direction,distance)
Makes the specified NPC move in the specified direction for the specified number of tiles. The first argument tells who to move. Use numbers 0-35. If more than one copy of the NPC exists on the map, only the first one will be moved. The second argument is the direction. Use the constants:
north,
south,
east,
west,
up,
down,
left, or
right.
The third argument is the number of tiles to move. If you leave out the third argument, the NPC will move one tile.
walk NPC is usually used with the wait for NPC command.
You should normally use the suspend NPCs command before moving NPCs.
set hero direction (who,direction)
Makes the specified hero face in the specified direction. The following constants are avaialable for direction:
north,
south,
east,
west,
up,
down,
left, or
right.
set NPC direction (who,direction)
Makes the specified NPC face in the specified direction. The following constants are avaialable for direction:
north,
south,
east,
west,
up,
down,
left, or
right.
If more than one copy of the same NPC exists on the map, only the first one will turn.
set hero frame (who,frame)
Sets the walking frame of the specified hero to 0 or 1.
set NPC frame (who,frame)
Sets the walking frame of the specified NPC to 0 or 1.
If more than one copy of the same NPC exists on the map, only the first one's frame will be changed.
set hero position (who,X,Y)
Instantly moves the specified hero to an X,Y position on the map. The coordinates are in units of tiles.
set NPC position (who,X,Y)
Instantly moves the specified NPC to an X,Y position on the map. The coordinates are in units of tiles. If more than one copy of the same NPC exists on the map, only the first one will be moved.
walk hero to X (who,X)
Makes the specified hero walk to a given X coordinate on the map
walk hero to Y (who,Y)
Makes the specified hero walk to a given Y coordinate on the map
walk NPC to X (who,X)
akes the specified NPC walk to a given X coordinate on the map. If more than one copy of the same NPC exists on the map, only the first one will be moved.
walk NPC to Y (who,Y)
Makes the specified NPC walk to a given Y coordinate on the map. If more than one copy of the same NPC exists on the map, only the first one will be moved.
set hero speed (who,speed)
Changes the walking speed of the specified hero. If you do not specify a speed, the hero's speed will return to the default, 4. Be careful with using speeds that do not divide evenly into 20, because tiles are 20 pixels in size, and an irregular walking speed may cause your hero to become misaligned with the tiles.
set NPC speed (who,speed)
Changes the walking speed of the specified NPC. If you do not specify a speed, the NPC's speed will return to the default, 4. Be careful with using speeds that do not divide evenly into 20, because tiles are 20 pixels in size, and an irregular walking speed may cause the NPC to become misaligned with the tiles. If more than one copy of the same NPC exists on the map, only the first one will be moved.
use door (number)
instantly uses the numbered door, just as if you had stepped into it.
camera follows hero (who)
Normally, the camera follows your leader. With this command, you can make the camera follow any hero you want. If you leave out the argument, the camera will follow your leader as normal.
camera follows NPC (who)
With this command, you can make the camera follow an NPC instead of the hero. If more than one copy of the specified NPC exists, the camera will follow the first one. To revert the camera to normal, use camera follows hero.
pan camera (direction,distance,pixelstep)
This command causes the camera to stop following your leader and pan in the specified direction. For direction, you can use the constants:
north,
south,
east,
west,
up,
down,
left, or
right.
The distance is the number of tiles you want the camera to move before it stops. You can also specify the number of pixels you want the camera to move for each tick. if you leave the last argument out, the camera will move by 2 pixels per tick. This command is normally used with wait for camera. To revert the camera to normal, use camera follows hero.
focus camera (x,y,speed)
This command causes the camera to focus itself on the specified X,Y coordinates of the map. These coordinates are in units of tiles. The third argument, the speed, tells how fast the camera will pan. If you do not specify a speed, the camera will pan 2 pixels per tick. This command is normally used with wait for camera. To revert the camera to normal, use camera follows hero.
show text box (number)
Displays the numbered text box, just as if you had talked to an NPC. The text box will not actually pop up until the next wait command. This command is most often used with the wait for text box command.
advance text box
Advances a text box just as if the player had pressed a key. For use while suspend box advance is active.
fight formation (number)
Starts a battle with the numbered enemy formation
game over
Resets the game and returns you to the title screen. This command is most useful for after-you-win-the-game type scripts, and for death-scripts that are triggered when you lose in battle.
show value (number)
Displays the number in the bottom left corner of the screen. Useful for count-down timers, and for debugging complicated scripts.
show no value
Gets rid of the number in the bottom left corner of the screen after a show value command.
get money (amount)
Adds the specified amount to your party's money
lose money (amount)
Subtracts the specified amount from your party's money.
pay money (amount)
A function that checks to see if you have enough money to pay the amount specified. If you do, it subtracts it, and returns true. If you do not have enough, it subtracts nothing, but returns false. Intended for use in if statements.
add hero (who)
Puts the named hero in your party. If there is no room, the hero will be added to your reserve. Use the constants defined in your HSI file. They are in the form of hero:name
delete hero (who)
Removes the named hero from your party. If you have more than one copy of the hero in your party, only the first one will be deleted. Use the constants defined in your HSI file. They are in the form of hero:name
swap in hero (who)
Moves the named hero in your from your reserves to your active party. If there is no room in your active party, the hero will not be moved. Use the constants defined in your HSI file. They are in the form of hero:name
swap out hero (who)
Moves the named hero from your active party into your reserve. Use the constants defined in your HSI file. They are in the form of hero:name
lock hero (who)
Locking a hero prevents the player from moving the hero on the party menu. Locked heros in the active party cannot be moved into the reserve, and locked heros in the reserve are completely hidden. Also prevents a hero from being moved by swap in hero or swap out hero. Use the constants defined in your HSI file. They are in the form of hero:name
unlock hero (who)
Reverses lock hero (who), and makes it possible to move a hero in and out of the active party again. Use the constants defined in your HSI file. They are in the form of hero:name
swap by name (name,name)
Swaps two named heros in your party no matter what position they are in. Use the names defined in your HSI file in the form hero:name
swap by position (position,position)
Swaps two heros in your party based on their positions in the party
get item (item,number)
Adds the specified number of the specified item to your inventory. If you do not specify a number, only one will be added. You can refer to the item by number, or you can use the constants defined in your HSI file, which are in the form of item:name
delete item (item,number)
Removes the specified number of the specified item from your inventory. If you do not specify a number, only one will be removed. You can refer to the item by number, or you can use the constants defined in your HSI file, which are in the form of item:name
play song (song)
Plays the specified song. Use the constants defined in your HSI file. They appear in the form of song:name
stop song
Stops whatever music is currently playing.
fade screen out (red,green,blue)
Fades the screen to a solid color. If you do not specify any arguments, the screen will fade to black. The red, gree, blue values are numbers from 0 to 63 that tell how bright that particular color should be. (63,0,0) would be blood red. (40,0,40) would be purple. (63,63,63) would be bright white.
fade screen in
Fades the screen back to normal after a fade screen out command.
random(lownumber, highnumber)
Returns a random number in the range of the two numbers. The returned value will be greater than or equal to the first number, and less than or equal to the second number
inventory (item)
Returns a count of how many of the specified item are in your inventory. If you do not have the item, it returns zero or false. You can refer to the item by number, or you can use the constants defined in your HSI file, which are in the form of item:name
leader
Returns the hero number of the current leader.
hero X (who)
returns the specified hero's X position in tiles.
hero Y (who)
returns the specified hero's Y position in tiles.
NPC X (who)
returns the specified NPC's X position in tiles.
NPC Y (who)
returns the specified NPC's Y position in tiles.
room in party
A function that returns the number of available spaces in your active party. It will return zero or false if there is no room.
current map
returns the number of the current map.
set tag (tag,value)
Sets the value of a tag. The available constants are:
off,
on,
true, or
false.
You can specify the number of the tag, or you can use the constants in your HSI file. These constants are in the form of tag:name.
check tag (tag)
A function that checks the value of a tag, and returns true if the tag is turned on, and false if the tag is turned off. It can be used in if and while statements
You can specify the number of the tag, or you can use the constants in your HSI file. These constants are in the form of tag:name.
set variable (variable,value)
This command assigns a new value to a variable. If you do not specify the new value, the variable will be reset to zero. This command works exactly the same for global and local variables.
increment (variable,amount)
This command adds an amount to the current value of a variable. If you do not specify the amount, then the variable will be incremented by one. This command works exactly the same for global and local variables.
decrement (variable,amount)
This command subtracts an amount from the current value of a variable. If you do not specify the amount, then the variable will be decremented by one. This command works exactly the same for global and local variables.
Pre-December 1999 versions of HamsterSpeak used a different syntax for math. For more information, see the HamsterSpeak Specification
number + number
Adds two values together and returns the result. This can also be written as number,add,number
number -- number
Subtracts the second number from the first number and returns the result. It is neccisary to use the double minus so that HSPEAK.EXE can tell the difference between subtraction, and a minus sign that indicates a negative number. You can also write number,subtract,number
number * number
Multiplies two values together and returns the result. This can also be written as number,multiply,number
number / number
Divides the second number into the first number and returns the result. The result will be rounded to the nearest integer. This can also be written as number,divide,number
number,mod,number
Divides the second number into the first number and returns the remainder.
number ^ power
Raises a number to a power and returns the result. Normally you will only be raising things to a power of 2. Raising to very large powers will most certainly produce an overflow error. This can also be written as number,exponent,power
number == number
Checks to see if the two numbers are equal. If they are equal it returns true, otherwise it returns false. This can also be written as number,equal,number
number <> number
Checks to see if the two numbers are not equal. If they are not equal it returns true. If they are equal it returns false. This can also be written as number,not equal,number
number << number
Checks to see if the first number is less than the second number. If it is, it returns true, otherwise it returns false. This can also be written as number,less than,number
number >> number
Checks to see if the first number is greater than the second number. If it is, it returns true, otherwise it returns false. This can also be written as number,greater than,number
number <= number
Checks to see if the first number is less than or equal to the second number. If it is, it returns true, otherwise it returns false. This can also be written as number,less than or equal to,number
number >= number
Checks to see if the first number is greater than or equal to the second number. If it is, it returns true, otherwise it returns false. This can also be written as number,greater than or equal to,number
value,and,value
Returns true if both of the values are true (non-zero). If either of them is false, and returns false.
value,or,value
Returns true if at least one of the values are true (non-zero). Only if both of them are false does or return false.
value,xor,value
Returns true if one, but not both of the values are true (non-zero). If both of them are true, or both of them are false, xor returns false.
if(condition) then(commands) else(commands)
The if statement checks the value of its condition, and if the value is true, it runs the commands in the then block. If the value is false, it runs the commands in its else block. The conditional is usually an equality operator such as == or <>, or it is a check tag command. The else is optional as long as you have a then, and the then is optional as long as you have an else. There are some examples of if statements in the HamsterSpeak Specification, and in WANDERP.HSS
while(condition) do(commands)
The while command checks the value of its condition, and if the value is true it runs the commands in the do block. It keeps checking the conditional and runs the do block over and over again until the conditional returns false. The conditional is usually an equality operator such as == or <>, or it is a check tag command.
for(counter,start,finish,step) do(commands)
The for command runs the commands in the do block a specified number of times. The first argument to for is the counter. It must be a variable. The next two arguments are the starting value and the finishing value. For example, if you use a start value of 1 and a finish value of 10 then the do block will run 10 times. The first time the do block runs, the counter will be 1, then it will be 2, then 3 and so on until it reaches 10, the finish value. The fourth argument of for is optional. It is the step by which the counter will change each loop. If you use a step of 2 then the counter will count 1,3,5,7,9. If you switch the start and finish values and use a step of -1 then the counter will go backwards. If you use 0 as the step, the counter will never change, so the do block will repeat forever. There are examples of for commands in WANDERP.HSS
alter NPC (who,NPCstat,value)
Changes the stats of an NPC. Constants for this command have been included in PLOTSCR.HSD. Advanced uses should have no trouble figuring out how to use this command by looking at PLOTSCR.HSD.
set death script (id)
Changes the script that is run when you die in battle. The argument is the script's ID number, NOT the script's name. Calling set death script with no argument disables the death script.
find hero (who)
Searches through your party to see if the specified hero is there, and returns the position where the hero was found, or -1 if the hero was not found. Use the names defined in your HSI file in the format hero:name. Not only does this tell you if a hero is in your party, but you can also use it to tell whether or not the hero is in your active party. find hero will return 0,1,2 or 3 if the hero is in the active party, but it will return a number 4 or higher if the hero is in the reserve
get hero stat (who,stat,type)
A function that returns one of a hero's stats. The first argument is the name of the hero you want to check as defined in your HSI file. The second argument is the name of the stat that you want to check. The names of the stats are also define in your HSI file in the form stat:name. The third argument is either current stat or maximum stat
set hero stat (who,stat,type,value)
A command that changes one of a hero's stats. The first argument is the name of the hero you want to change as defined in your HSI file. The second argument is the name of the stat that you want to change. The names of the stats are also define in your HSI file in the form stat:name. The third argument is either current stat or maximum stat. The last argument is the new value of the stat.