ai

Classes that implement the commands found in command lists, such as GoTo and ConductClass.

class ai.AddLines(lines)

Command that adds lines to Eric’s total. May be used by any character.

Parameter:lines (number) – The lines to add to Eric’s total.
command(character)

Make a character add lines to Eric’s total.

Parameter:character (Character) – The character.
Returns:self.
is_interruptible()

Return whether this command is interruptible.

Returns:False.
class ai.AwaitAssemblyTime

Command that restarts a character’s command list unless it’s time to start assembly.

command(character)

Restart a character’s command list unless it’s time to start assembly.

Parameter:character (Character) – The character.
Returns:self if it’s time to start assembly, None otherwise.
class ai.Catch

Command that makes Eric catch a mouse or frog (if one is at hand).

catch_animal(eric)

Make Eric catch a mouse or frog if one is at the location of his hand.

Parameter:eric (Eric) – Eric.
Returns:None.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

stand_up(eric)

Make Eric stand up straight after bending over to catch a mouse or frog.

Parameter:eric (Eric) – Eric.
Returns:self.
class ai.ChaseEricOut

Command that makes a character chase Eric up to the girls’ side of the skool gate. It is used by Miss Take if she spots him in the girls’ skool when it’s not playtime.

command(character)

Make a character take the next step while chasing Eric, or remain by his side if already there.

Parameter:character (Character) – The character chasing Eric.
Returns:A GoTowardsXY command if the character hasn’t caught up with Eric yet, or None if the character is already by Eric’s side.
class ai.CheckIfTouchingEric(eric_knows_signal, eric_has_mumps_signal)

Command that checks whether a character is touching Eric. This command is used by Angelface when he has mumps.

Parameters:
  • eric_knows_signal – The signal used to indicate that Eric has been told to avoid the character who has mumps.
  • eric_has_mumps_signal – The signal to use to indicate that Eric has mumps.
command(character)

Make a character check whether he’s touching Eric (and has therefore transmitted his disease). If Eric has been informed of the character’s condition, and the character is touching Eric, the appropriate signal is raised to indicate that Eric has mumps.

Parameter:character (Character) – The character who has mumps.
Returns:self.
class ai.ClimbOverSkoolGate
Command that controls Eric as he climbs over the closed skool gate from the top of a fully grown plant.
class ai.Command

Abstract class from which all other command classes inherit. Subclasses must implement a method named command that takes a single parameter: the character to control.

finish(character)

This method is called on a controlling command before it is terminated. Its purpose is to tidy up before the command is removed from the command list. The default implementation provided here triggers a speed change for the character, so that if he was being made to run continuously (as by the WalkFast command), he no longer will.

Parameter:character (Character) – The character running the controlling command.
is_GoTo()
Return whether this command is one of the GoTo commands. This method returns False, but the GoTo commands override it and return True.
is_interruptible()
Return whether this command is interruptible. An interruptible command can be terminated immediately by a command list restart. This method returns True, but subclasses may override it and return False instead.
class ai.CommandList

A list of commands built from a CommandListTemplate. Maintains a command stack from which commands are popped after they have finished executing.

add_command(command)

Add a command to the stack.

Parameter:command – The Command to add.
command(character)

Hand control of a character over to the current command in this command list. The steps taken are:

  1. Add the controlling command (if there is one, and the current command is interruptible) to the stack.
  2. Add the subcommand (if there is one, and the current command is interruptible) to the stack.
  3. If the command stack is empty, pull the next command from the command list and add it to the stack.
  4. Execute the current command (the last command on the stack).
  5. Act on the return value from the current command; if it is:
    • None, then return from this method;
    • self (the command itself), then pop the current command from the stack and go to step 3;
    • another command, then add that command to the stack and go to step 4.
Parameter:character (Character) – The character to be controlled.
get_GoTo_destination()
Return the destination of the character, or None if he is not under the control of a GoTo command.
is_GoToing()
Return whether the character is under the control of one of the GoTo commands.
is_interruptible()
Return False if the command stack contains an uninterruptible command, True otherwise.
jump(offset)

Jump forwards (or backwards) in the list of commands.

Parameter:offset – The offset by which to jump. -2 means the previous command, -1 means the current command, 0 means the next command, and 1 means the next command but one.
restart(index=None)

Restart this command list. When the current command finishes, the next command will be the first command in the command list, or the command denoted by index.

Parameter:index – The index of the command at which to restart (defaults to 0).
set_GoTo_destination(destination)

Set the destination of the character if he is under the control of a GoTo command.

Parameter:destination (Location) – The destination to set.
set_controlling_command(command)

Set the controlling command for this command list. The controlling command, if set, is executed before and in addition to the current command on the stack (see command()). WalkFast and HitNowAndThen are examples of commands that are used as controlling commands.

Parameter:command (Command) – The command to set as the controlling command.
set_restart_point()
Remove the current and all previous commands from the command list. When the current command finishes, the next command will be regarded as the first for the purposes of a command list restart.
set_subcommand(command_name, args)

Set the subcommand for this command list. The subcommand, if set, is executed before and in addition to the current command on the stack (see command()). MonitorEric is an example of a command that is used as a subcommand.

Parameters:
  • command_name – The name of the command to set as the subcommand.
  • args – The subcommand’s arguments.
set_template(template)

Set the template for this command list. This method is used to replace a character’s current command list (e.g. when the bell rings). Any interruptible commands remaining on the stack are removed; interruptible commands are left in place so that they have a chance to finish before the new command list kicks in.

Parameter:template – The CommandListTemplate to use.
class ai.CommandListTemplate(command_list_id)

Template from which a specific command list may be created (one or more times). command_list_id is an identifier for the command list, used only for debugging purposes.

add_command(command_class, *params)

Add a command to this template.

Parameters:
  • command_class – The class object that implements the command.
  • params – The command’s parameters.
get_commands(start)

Return a list of commands (initialised command class instances) constructed from this template.

Parameter:start – The index of the first command. If start is 0, the entire list of commands is returned. If start is N>0, the first N commands are omitted.
class ai.ComplexCommand

Abstract class used by many commands that require a fixed sequence of steps to be executed with little or no conditional logic. Each step is implemented as a separate method. Subclasses must implement a method named get_commands that returns a list of the methods to execute.

command(character)

Execute the next step (method) in this command’s sequence. What happens after that depends on the return value from the method called; if it is:

  • False, then the step is taken to be still in progress, and will be executed again the next time this method is called
  • None, then the step is taken to be finished
  • self (this command), then the entire command is taken to be finished, and no more steps will be executed
  • another command, then that command is added to the stack (so that it will be executed before proceeding to the next step)
Parameter:character (Character) – The character to control.
done(character)

Terminate this complex command. This method is typically used as the last step in the sequence, and is provided for convenience to subclasses.

Returns:self (to terminate this command)
restart()
Return to the first step in the sequence.
class ai.ConductAssembly

Command that makes a character conduct assembly. This involves delivering a detention message.

command(character)

Make a character deliver a detention message. After the message has been delivered, a signal is raised to indicate that assembly is finished.

Parameter:character (Character) – The character to control.
Returns:self if the detention message has been delivered, or a Say command.
class ai.ConductClass

Command that makes a character conduct a class. It determines whether the character is teaching Eric, and passes control to a ConductClassWithEric or ConductClassWithoutEric command as appropriate.

command(character)

Make a character conduct a class.

Parameter:character (Character) – The character to control.
Returns:A ConductClassWithoutEric command if the character is not teaching Eric; None if the character is teaching Eric but the swot hasn’t shown up yet; a ConductClassWithEric command otherwise.
class ai.ConductClassWithEric

Command that makes a character conduct a class with Eric. This involves waiting until the swot shows up, listening to him while he tells tales and responding appropriately, wiping the board (if there is one in the room), optionally writing on the board, and finally either telling the kids what to do and pacing up and down until the bell rings, or starting a question-and-answer with the swot. At various points in this process, the character will also respond to the swot’s tales about Eric being missing.

command(character)

Make a character perform the next required action while conducting the class.

Parameter:character (Character) – The character to control.
Returns:None if the character should do nothing at the moment, or an appropriate Command.
class ai.ConductClassWithoutEric

Command that makes a character conduct a class without Eric. This involves wiping the board (if there is one in the room), optionally writing on the board, telling the kids what to do, and then pacing up and down until the bell rings.

command(character)

Make a character perform the next step in conducting this class.

Parameter:character (Character) – The character to control.
Returns:A WipeBoard command; a GoToXY command to make the character return to the middle of the board after wiping it; a WriteOnBoard command (possibly); a TellClassWhatToDo command; or a WalkUpOrDown command.
class ai.Dethroned
Command that controls a character who has been pushed out of a seat.
class ai.DoAssemblyDuty

Command that makes a character perform assembly duty. This involves checking whether Eric is present in the assembly hall, and chasing him down if he’s absent.

command(character)

Make a character perform assembly duty. If the character has just successfully herded the absent Eric to the assembly hall, the character’s command list is restarted (so that he returns to the back of the assembly hall and starts the Eric-watching process over again).

Parameter:character (Character) – The character to control.
Returns:self if the character has just herded Eric back to the assembly hall, or assembly has finished; None if it’s not time to start keeping an eye out for Eric yet, or Eric is present; or a FetchEric command.
class ai.DropStinkbomb

Command that makes a character drop a stinkbomb.

drop(character)

Make a character drop a stinkbomb (thus creating a stinkbomb cloud).

Parameter:character (Character) – The character to control.
Returns:None.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

is_interruptible()

Return whether this command is interruptible.

Returns:False.
lower(character)

Make a character lower his arm after dropping a stinkbomb.

Parameter:character (Character) – The character to control.
Returns:None.
raise_arm(character)

Make a character raise his arm in preparation for dropping a stinkbomb.

Parameter:character (Character) – The character to control.
Returns:None.
class ai.DumpWaterPistol

Command that makes Eric throw away his water pistol.

dump_water_pistol(eric)

Make Eric drop his water pistol.

Parameter:eric (Eric) – Eric.
Returns:None.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

stand_up(eric)

Make Eric stand up straight again after dropping his water pistol.

Parameter:eric (Eric) – Eric.
Returns:None.
class ai.EndGame

Command that ends the game. May be used by any character.

command(character)

Make a character end the game.

Parameter:character (Character) – The character.
Returns:None.
class ai.EvadeMouse

Command that makes a character stand on a chair or start jumping.

command(character)
Make a character:
  1. stand or remain standing on a chair, or
  2. start or continue jumping, or
  3. finish either one of these activities (after a certain time).
Parameter:character (Character) – The character to control.
Returns:self if the character has finished standing on a chair or jumping, None otherwise.
is_interruptible()

Return whether this command is interruptible.

Returns:False (a musophobe must not be distracted while evading a mouse).
class ai.Fall

Command that controls a falling object (a conker or a drop of water or sherry).

command(thing)

Control an object that may be falling. If the object is not falling, do nothing; otherwise make it fall a bit, taking appropriate action if it hits the floor or a person’s head.

Parameter:thing – The thing to control.
Returns:None.
is_interruptible()

Return whether this command is interruptible.

Returns:False (falling objects do not care about the bell).
class ai.FallToFloor

Command that controls Eric’s descent to the floor (as from a bike that has run out of momentum, or a plant that has died).

command(eric)

Make Eric fall. If he has reached the floor, he will assume a sitting position.

Parameter:eric (Eric) – Eric.
Returns:self if Eric has hit the floor, or None if he’s still falling.
class ai.FetchEric

Command that makes a character find and hover around Eric until he goes to wherever he should be.

command(character)

Make a character take the next step in the search for Eric.

Parameter:character (Character) – The character to control.
Returns:self if Eric is where he should be, or is due to be expelled; None if the character is already beside Eric; or a GoTowardsXY command.
class ai.FindEric

Command that makes a character go and find Eric.

command(character)

Make a character take the next step in the search for Eric. The skool clock is stopped to ensure that the character has enough time to find him. When Eric is found, he is frozen until the character decides to unfreeze him.

Parameter:character (Character) – The character looking for Eric.
Returns:self if Eric has been found and frozen, None if Eric has been found but cannot be frozen at the moment, or a GoTowardsXY command.
class ai.FindEricIfMissing

Command that makes a character start looking for Eric if he’s not where he should be.

command(character)

Make a character check whether Eric is where he should be, and go looking for him if not.

Parameter:character (Character) – The character to control.
Returns:self if Eric is where he should be, or a FetchEric command.
class ai.FindSeat(go_to_back=True, move_along=True)

Command that makes a character find a seat and sit down.

Parameters:
  • go_to_backTrue if the character should seek out the back seat, False if he should find the nearest seat.
  • move_alongTrue if the character should move along to the next seat even if he’s already standing beside one, False otherwise.
command(character)

Make a character find a seat, turn round if he’s already beside one but facing the wrong way, or sit down.

Parameter:character (Character) – The character to control.
Returns:self if the character sat down, None if he’s beside a seat but had to turn round, or a GoToXY command to send him to a seat.
class ai.FireCatapult

Command that makes a character fire a catapult.

aim(character)

Make a character start or finish raising his catapult to eye level.

Parameter:character (Character) – The character to control.
Returns:False if the character has yet to raise the catapult to eye level, or None if he has raised it to eye level.
fire(character)

Make a character launch a catapult pellet.

Parameter:character (Character) – The character to control.
Returns:None.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

is_interruptible()

Return whether this command is interruptible.

Returns:False (a catapult-firing character should finish what he’s started).
lower(character)

Make a character start or finish lowering his catapult.

Parameter:character (Character) – The character to control.
Returns:False if the character has not finished lowering his catapult, or None if he has.
class ai.FireNowAndThen

Command that makes a character check whether it’s a good time to launch a catapult pellet, and act accordingly. This command is used as a controlling command (see CommandList.set_controlling_command()).

get_command()

Returns the command that should be used to make a character fire his catapult.

Returns:A FireCatapult command.
ready(character)

Return whether now is a good time for this character to fire a catapult pellet. The answer will be True if all the conditions described in HitOrFireNowAndThen.ready are met, and also:

  • The character’s x-coordinate is divisible by 4.
  • The character’s catapult pellet is not currently airborne.
class ai.FireWaterPistol

Command that makes a character fire a water pistol.

aim(character)

Make a character take out his water pistol and aim it.

Parameter:character (Character) – The character to control.
Returns:None.
fire(character)

Make a character pull the trigger of his water pistol (thus releasing a jet of water or sherry).

Parameter:character (Character) – The character to control.
Returns:None.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

is_interruptible()

Return whether this command is interruptible.

Returns:False.
lower(character)

Make a character put his water pistol back in his pocket.

Parameter:character (Character) – The character to control.
Returns:None.
class ai.Flight(phases, paralyse=False)

Abstract command that controls Eric’s flight through a designated sequence of locations (relative to the starting point) and animatory states.

Parameters:
  • phases – The phases of animation to proceed through.
  • paralyse – Whether Eric should be immobilised upon landing.
command(eric)

Move Eric to the next location and phase of animation in the flight sequence.

Parameter:eric (Eric) – Eric.
Returns:self if Eric has landed safely; a Freeze command if Eric has landed but is now immobilised (as when falling from a great height); or None otherwise.
class ai.Floored(count)

Abstract command that controls a character who has been knocked to the floor.

Parameter:count – The delay before the character should get up.
command(character)

Make a character remain on the floor, or get up if enough time has passed.

Parameter:character (Character) – The character to control.
Returns:self if the character has got up and is ready to resume normal service, None otherwise.
is_interruptible()

Return whether this command is interruptible.

Returns:False (the bell cannot raise characters from the floor).
class ai.FlyOverSkoolGate
Command that controls Eric’s flight over the closed skool gate (after hitting it while standing on the saddle of the bike).
class ai.Follow(character_id)

Command that makes a character follow another character.

Parameter:character_id – The ID of the character to follow.
command(character)

Make a character go to the same destination as another character.

Parameter:character (Character) – The character to control.
Returns:self if the destination has been reached, or a GoTo command.
class ai.Freeze

Command that controls Eric while he’s frozen (as by the FindEric command).

command(eric)

Control Eric while he’s frozen. Each time this method is called, a check is made whether Eric has acknowledged understanding of the message being delivered to him (see TellEricAndWait).

Parameter:eric (Eric) – Eric.
Returns:None.
class ai.GoTo(location_id, destination=None, go_one_step=False)

Command that makes a character go to a location.

Parameters:
  • location_id – The ID of the location to go to (may be None).
  • destination (Location) – The location to go to (required if location_id is None).
  • go_one_stepTrue if this command should terminate after sending the character one step towards the destination.
command(character)

Make a character take the next step towards his destination.

Parameter:character (Character) – The character to control.
Returns:self if the character has already reached his destination, None otherwise.
is_GoTo()

Return whether this command is one of the GoTo commands.

Returns:True.
class ai.GoToRandomLocation

Command that makes a character go to a location chosen at random.

command(character)

Make a character start the journey towards a randomly chosen location.

Parameter:character (Character) – The character to control.
Returns:A GoTo command.
class ai.GoToXY(x, y)

Command that makes a character go to a location specified by x- and y-coordinates.

Parameters:
  • x – The x-coordinate of the location to go to.
  • y – The y-coordinate of the location to go to.
class ai.GoTowardsXY(x, y)

Command that makes a character take one step towards a location.

Parameters:
  • x – The x-coordinate of the location to go towards.
  • y – The y-coordinate of the location to go towards.
class ai.GrassAndAnswerQuestions

Command that makes a character tell tales and answer the teacher’s questions during a lesson. It is used by the swot.

command(character)

Make a character tell a tale, wait for a teacher to ask a question, or answer a teacher’s question.

Parameter:character (Character) – The character to control.
Returns:None if the character should do nothing at the moment, or an appropriate Command.
class ai.Grow

Command that controls a plant.

command(plant)

Control a plant. If the plant has recently been watered, it will grow to full height and then die (disappear).

Parameter:plant – The plant to control.
Returns:None.
is_interruptible()

Return whether this command is interruptible.

Returns:False (plants do not care about the bell).
class ai.Hit

Command that makes a character throw a punch.

aim(character)

Make a character start or finish raising his fist.

Parameter:character (Character) – The character to control.
Returns:None if the character’s fist is fully raised, False otherwise.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

hit(character)

Make a character deck anyone unfortunate enough to come into contact with his raised fist.

Parameter:character (Character) – The character to control.
Returns:None.
is_interruptible()

Return whether this command is interruptible.

Returns:False.
lower(character)

Make a character start or finish lowering his fist.

Parameter:character (Character) – The character to control.
Returns:None if the character’s fist is fully lowered, False otherwise.
class ai.HitNowAndThen

Command that makes a character check whether it’s a good time to throw a punch, and act accordingly. This command is used as a controlling command (see CommandList.set_controlling_command()).

get_command()

Returns the command that should be used to make a character throw a punch.

Returns:A Hit command.
ready(character)
Return whether now is a good time for this character to throw a punch. The answer will be True if all the conditions described in HitOrFireNowAndThen.ready() are met, and there is someone punchable in front of the character.
class ai.HitOrFireNowAndThen

Abstract command that makes a character check whether it’s a good time to throw a punch or launch a catapult pellet, and act accordingly.

command(character)

Make a character start throwing a punch or launching a catapult pellet if conditions are favourable.

Parameter:character (Character) – The character to control.
Returns:self if conditions are not favourable, or a Hit or FireCatapult command.
ready(character)

Return whether now is a good time for this character to throw a punch or fire a catapult pellet. The answer will be True if all the following conditions are met:

  • The character is standing upright.
  • The character is not on a staircase.
  • There are no adults nearby facing the character.
  • A randomly selected number is in the designated range (see P_HIT_FIRE).
class ai.Hop(phases)

Command that controls a frog while it’s hopping.

Parameter:phases – The phases of animation to use for the hop.
command(frog)

Move a frog to the next phase of animation in the hop.

Parameter:frog – The frog to control.
Returns:self if the hop is finished, or None.
is_interruptible()

Return whether this command is interruptible.

Returns:False.
class ai.Jump

Command that makes a character jump.

down(character)

Make a character return to the floor after jumping.

Parameter:character (Character) – The character to control.
Returns:None.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

up(character)

Make a character jump into the air.

Parameter:character (Character) – The character to control.
Returns:None.
class ai.JumpIfOpen(door_id, offset)

Command that jumps forwards or backwards in a character’s command list if a specified door or window is open.

Parameters:
  • door_id – The ID of the door or window to check.
  • offset (number) – The offset by which to jump in the command list.
command(character)

Jump forwards or backwards in a character’s command list if a specified door or window is open.

Parameter:character (Character) – The character.
Returns:self.
class ai.JumpIfShut(door_id, offset)

Command that jumps forwards or backwards in a character’s command list if a specified door or window is shut.

Parameters:
  • door_id – The ID of the door or window to check.
  • offset (number) – The offset by which to jump in the command list.
command(character)

Jump forwards or backwards in a character’s command list if a specified door or window is shut.

Parameter:character (Character) – The character.
Returns:self.
class ai.JumpOffSaddle

Command that controls Eric after he’s jumped off the saddle of the bike.

check_cup(eric)

Place the frog in a cup (if Eric has it and has reached a cup).

Parameter:eric (Eric) – Eric.
Returns:None
fall(eric)

Guide Eric back to the floor after jumping off the saddle of the bike.

Parameter:eric (Eric) – Eric.
Returns:False if Eric has not reached the floor yet, or None otherwise.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

reach(eric)

Make Eric rise again and raise his arm (to reach for a cup).

Parameter:eric (Eric) – Eric.
Returns:None.
rise(eric)

Make Eric rise off the bike saddle.

Parameter:eric (Eric) – Eric.
Returns:None.
class ai.JumpOutOfWindow(window_id)

Command that controls Eric’s descent from an open window.

Parameter:window_id – The ID of the window Eric has jumped out of.
class ai.Kiss

Command that controls Eric while he kisses (or attempts to kiss) another character.

finish_kiss(eric)

Control Eric as he finishes a kiss or attempted kiss. If there was no one within kissing range in front of Eric, he will return from the midstride position. If there was someone kissable within kissing range, they will either finish the kiss with Eric (if they accepted it) or deck him (if they decided to slap him instead).

Parameter:eric (Eric) – Eric.
Returns:None.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

start_kiss(eric)

Control Eric as he begins an attempt to kiss someone. If there is no one within kissing range in front of Eric, he will move midstride. If there is someone kissable within kissing range, they will either accept the kiss or slap him.

Parameter:eric (Eric) – Eric.
Returns:None.
class ai.KnockedOut
Command that controls a kid who has been knocked out.
class ai.KnockedOver(sleep)

Command that controls an adult character who has been knocked over by a catapult pellet or conker.

Parameter:sleep – Whether the character should remain unconscious for a while (as when Albert is struck by a conker).
command(character)

Control an adult character who has been knocked over. If conditions are right and the character holds a safe combination letter, he will reveal it. If enough time has passed since being knocked over, the character will give lines if any suitable recipient is nearby.

Parameter:character (Character) – The character to control.
Returns:self if the character has got up and is ready to resume normal service, None otherwise.
class ai.MonitorEric(command_list_id)

Command that makes a character keep an eye out for Eric, and act appropriately if he’s spotted. It is used by Miss Take to make her chase Eric out of the girls’ skool if she spots him there when it’s not playtime. This command is used as a subcommand (see CommandList.set_subcommand()).

Parameter:command_list_id – The ID of the command list to execute if Eric is spotted.
command(character)

Make a character check whether they can see Eric in the girls’ skool during a non-playtime period, and switch to an appropriate command list if so.

Parameter:character (Character) – The character keeping an eye out for Eric.
Returns:self.
class ai.MoveAboutUntil(signal)

Command that makes a character walk up and down until a signal is raised.

Parameter:signal – The signal to wait for.
command(character)

Make a character walk up and down unless the signal has been raised.

Parameter:character (Character) – The character to control.
Returns:self if the signal has been raised, or a WalkAround command.
class ai.MoveBike

Command that controls a bike when Eric’s not sitting on the saddle.

command(bike)

Control a bike when Eric’s not sitting on the saddle. If the bike is resting on the floor or is not yet visible, do nothing; otherwise move the bike forwards.

Parameter:bike – The bike to control.
Returns:None.
is_interruptible()

Return whether this command is interruptible.

Returns:False (the bike does not care about the bell).
class ai.MoveDeskLid

Command that controls a desk lid.

command(desk_lid)

Control a desk lid. If the desk lid is not raised, nothing happens. If the desk lid has just been raised, the contents of the desk (if any) are delivered to the lid-raiser.

Parameter:desk_lid – The desk lid to control.
Returns:None.
class ai.MoveDoor(barrier_id, shut)

Abstract command that makes a character open or close a door or window.

Parameters:
  • barrier_id – The ID of the door or window.
  • shutTrue if the door or window should be shut, False otherwise.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

lower_arm(character)

Make a character lower his arm after opening or closing a door or window.

Parameter:character (Character) – The character to control.
Returns:None.
move_door(character)

Open or close a door or window.

Parameter:character (Character) – The character opening or closing the door or window.
Returns:None.
raise_arm(character)

Make a character raise his arm in preparation for opening or closing a door or window, or do nothing if the door/window is already in the desired state.

Parameter:character (Character) – The character to control.
Returns:self if the door/window is already in the desired state, or None if the character raised his arm.
class ai.MoveFrog

Command that controls a frog.

command(frog)

Control a frog.

Parameter:frog – The frog to control.
Returns:A Hop command, or None if the frog decides not to move.
is_interruptible()

Return whether this command is interruptible.

Returns:False (frogs do not care about the bell).
class ai.MoveMouse

Command that controls a mouse.

command(mouse)
Control a mouse. The pattern of movements of a mouse is as follows:
  1. Scamper up and down a few times.
  2. Hide for a bit.
  3. Go to 1, or die.
Parameter:mouse – The mouse to control.
Returns:None.
is_interruptible()

Return whether this command is interruptible.

Returns:False (mice do not care about the bell).
class ai.MovePellet

Command that controls a catapult pellet.

command(pellet)

Move a catapult pellet if it’s currently airborne, remove it from sight if it’s reached the end of its flight, or else do nothing. If the pellet is airborne and hits a wall, door, window, shield, cup, conker or head, appropriate action is taken.

Parameter:pellet – The pellet to control.
Returns:None.
is_interruptible()

Return whether this command is interruptible.

Returns:False (a catapult pellet should not be stopped by the bell).
class ai.MoveWater

Command that controls a stream of liquid (water or sherry) fired from a water pistol.

command(water)

Move a stream of water or sherry one phase further in its trajectory. If the liquid hits a cup, a plant or the floor on its journey, appropriate action is taken.

Parameter:water – The water/sherry to control.
Returns:None.
is_interruptible()

Return whether this command is interruptible.

Returns:False (flying liquids are unstoppable).
class ai.OpenDoor(barrier_id)

Command that makes a character open a door or window.

Parameter:barrier_id – The ID of the door or window.
class ai.Pause

Command used to occupy a character while they are responding to an attempted kiss from Eric.

command(character)

Occupy a character while they are responding to an attempted kiss from Eric. The character’s animation is controlled by the Kiss command while this command is in effect.

Parameter:character (Character) – The character to occupy.
Returns:self if the character has finished responding to the kiss, or None if they are still occupied.
class ai.ReleaseMice

Command that makes Eric release some mice.

get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

release_mice(eric)

Make Eric release some mice.

Parameter:eric (Eric) – Eric.
Returns:None.
stand_up(eric)

Make Eric stand up straight after bending over to release some mice.

Parameter:eric (Eric) – Eric.
Returns:self.
class ai.Restart

Command that restarts a character’s command list.

command(character)

Restart a character’s command list.

Parameter:character (Character) – The character.
Returns:self
class ai.RideBike(bike)

Command that controls Eric while he’s on a bike.

Parameter:bike – The bike Eric’s riding.
command(eric)

Control Eric while he’s on a bike. Keep the bike moving if Eric pedals, or carry Eric along with the bike if he’s standing on the saddle.

Parameter:eric (Eric) – Eric.
Returns:self if Eric has dismounted; a JumpOffSaddle command if Eric jumped while standing on the saddle; a FlyOverSkoolGate command if Eric hit the skool gate while standing on the saddle; a FallToFloor command if the bike ran out of momentum; or None otherwise.
class ai.Say(words, notify=False)

Command that makes a character say something.

Parameters:
  • words – The words to say.
  • notifyTrue if the character who is listening should be notified (as during a question-and-answer session between a teacher and the swot), False otherwise.
command(character)

Make a character utter the next bit of whatever he’s saying. If the character has finished speaking, his speech bubble is removed, and any listeners are notified.

Parameter:character (Character) – The character who is speaking.
Returns:self if the character has finished speaking, None otherwise.
class ai.SetClock(ticks)

Command that makes a character set the skool clock to a specified time.

Parameter:ticks (number) – The time to set the clock to (remaining ticks till the bell rings).
command(character)

Make a character set the skool clock.

Parameter:character (Character) – The character.
Returns:self.
class ai.SetControllingCommand(command_name, *params)

Command that sets a controlling command on a character’s command list. See CommandList.set_controlling_command() for more details.

Parameters:
  • command_name – The name of the controlling command.
  • params – The controlling command’s initialisation parameters.
command(character)

Set the controlling command on a character’s command list.

Parameter:character (Character) – The character.
Returns:self.
class ai.SetRestartPoint

Command that makes the next command in a character’s command list be regarded as the first (for the purposes of a restart).

command(character)

Make the next command in a character’s command list be regarded as the first (for the purposes of a restart).

Parameter:character (Character) – The character.
Returns:self.
class ai.SetSubcommand(command_name, *args)

Command that sets a subcommand on a character’s command list. See CommandList.set_controlling_command() for more details.

Parameters:
  • command_name – The name of the subcommand.
  • args – The subcommand’s parameters.
command(character)

Set a subcommand on a character’s command list.

Parameter:character (Character) – The character.
Returns:self.
class ai.ShadowEric

Command that makes a character run after Eric and then hover around him until the bell rings.

command(character)

Make a character take the next step in the search for Eric, or remain by his side.

Parameter:character (Character) – The character shadowing Eric.
Returns:A GoTowardsXY command if the character hasn’t found Eric yet, or None if the character is already by Eric’s side.
class ai.ShutDoor(barrier_id)

Command that makes a character close a door or window.

Parameter:barrier_id – The ID of the door or window.
class ai.Signal(signal)

Command that makes a character raise a signal.

Parameter:signal – The signal to raise.
command(character)

Make a character raise a signal.

Parameter:character (Character) – The character.
Returns:self.
class ai.SitForAssembly

Command that makes a character find a spot to sit down during assembly, and keeps him seated until assembly has finished.

find_spot_to_sit(character)

Make a character find a spot to sit during assembly. If assembly has already finished, the command is terminated.

Parameter:character (Character) – The character to control.
Returns:self if assembly has finished, or a GoToXY command to send the character to a place to sit down.
get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

get_up(character)

Make a character get up if assembly has finished. If assembly has not finished yet, return here next time.

Parameter:character (Character) – The character to control.
Returns:False if assembly is still in progress, or None if the character got up off the floor.
sit_down(character)

Make a character sit down for assembly, or turn round to face the right way for assembly. If assembly has already finished, the command is terminated.

Parameter:character (Character) – The character to control.
Returns:self if assembly has finished, False if the character was turned round, or None if the character sat down.
class ai.SitStill

Command that makes a character do nothing. It is used to make a character sit still during a lesson.

command(character)

Make a character do nothing.

Parameter:character (Character) – The character to control.
Returns:None.
class ai.StalkAndHit(character_id)

Command that makes a character seek out another character while throwing occasional punches. This command is used as a controlling command (see CommandList.set_controlling_command()).

Parameter:character_id – The ID of the character to stalk.
command(character)

Make a character proceed one step further towards whoever he’s stalking, and consider throwing a punch while he’s at it.

Parameter:character (Character) – The character doing the stalking.
Returns:A HitNowAndThen command.
class ai.StartDinnerIfReady

Command that makes a character start dinner if the time has come, or restarts the character’s command list if it’s still too early. It is used by teachers on dinner duty.

command(character)

Make a character start dinner, or restart his command list if it’s too early to start dinner.

Parameter:character (Character) – The character to control.
Returns:self
class ai.StartLessonIfReady(signal)

Command that makes a character start a lesson if the time has come, or restarts the character’s command list if it’s still too early.

Parameter:signal – The signal to raise when starting the lesson.
command(character)

Make a character start a lesson, or restart his command list if it’s too early to start the lesson. If it’s time to start the lesson, the character has a special safe secret question, and he can see the answer on a nearby blackboard, he will reveal his safe secret.

Parameter:character (Character) – The character to control.
Returns:A TellKidsToSitDown command if it’s time to start the lesson, self otherwise.
class ai.Stink

Command that controls a stinkbomb cloud.

command(bomb)

Animate a stinkbomb cloud (if it’s visible).

Parameter:bomb – The stinkbomb to control.
Returns:None.
class ai.StopEric(command_list_id, alert_message)

Command that makes a character try to stop Eric escaping from skool, and alert whoever should be alerted (usually the headmaster).

Parameters:
  • command_list_id – The ID of the command list the alerted character should use.
  • alert_message – The alert message to scream.
command(character)

Make a character raise the alarm (if he hasn’t already) that Eric is trying to escape, and continue trying to stop Eric if need be.

Parameter:character (Character) – The character trying to stop Eric escaping.
Returns:self if the character has deemed it no longer necessary to try and stop Eric escaping, or None otherwise.
class ai.TellClassWhatToDo

Command that makes a character tell a class what to do. It is used by teachers.

command(character)

Make a character tell the class what to do.

Parameter:character (Character) – The character to control.
Returns:A Say command, or self if the character has finished telling the class what to do.
class ai.TellEric(message)

Command that makes a character say something to Eric.

Parameter:message – The message to give to Eric.
command(character)

Make a character say something to Eric. When the character has finished speaking, Eric will be unfrozen.

Parameter:character (Character) – The character to control.
Returns:self if the character has finished speaking, or a Say command.
class ai.TellEricAndWait(message)

Command that makes a character say something to Eric, and wait for a response.

Parameter:message – The message to give to Eric.
command(character)

Make a character say something to Eric, and then wait for a response. When Eric has responded, he will be unfrozen. If Eric does not respond within a certain period, the character will repeat the message and wait again.

Parameter:character (Character) – The character to control.
Returns:self if Eric has responded, None if the character is waiting for Eric to respond, or a Say command.
class ai.TellKidsToSitDown

Command that makes a character tell the kids to sit down.

command(character)

Make a character tell the kids to sit down.

Parameter:character (Character) – The character to control.
Returns:A Say command, or self if the character has finished telling the kids to sit down.
class ai.TripPeopleUp

Command that makes a character trip people up while running towards his destination. This command is used as a controlling command (see CommandList.set_controlling_command()).

command(character)

Make a character start or continue running, and trip up anyone in his path.

Parameter:character (Character) – The character to control.
Returns:self.
class ai.Unsignal(signal)

Command that makes a character lower a signal.

Parameter:signal – The signal to lower.
command(character)

Make a character lower a signal.

Parameter:character (Character) – The character.
Returns:self.
class ai.WaitAtDoor(door_id)

Command that makes a character wait at a door until everyone is on the correct side of it (that is, boys on the boys’ side, girls on the girls’ side).

Parameter:door_id – The ID of the door to wait at.
command(character)

Make a character wait at a door until everyone is on the correct side of it.

Parameter:character (Character) – The character to control.
Returns:self if everyone is on the correct side of the door, None otherwise.
class ai.WaitUntil(signal)

Command that makes a character wait until a signal is raised.

Parameter:signal – The signal to wait for.
command(character)

Make a character wait for a signal.

Parameter:character (Character) – The character to control.
Returns:self if the signal has been raised, None otherwise.
class ai.WalkAround(walkabouts)

Command that makes a character walk up and down a given number of times.

Parameter:walkabouts – The number of times to walk up and down.
command(character)

Make a character walk up (away from the walkabout origin) or down (back to the walkabout origin). If the character is on a staircase, make him finish going up or down it first.

Parameter:character (Character) – The character to control.
Returns:self if the designated number of walkabouts has been performed, None if the character is on a staircase, or a GoToXY command.
class ai.WalkFast

Command that makes a character walk fast (as kids do half the time, and teachers do when chasing Eric). This command is used as a controlling command (see CommandList.set_controlling_command()).

command(character)

Ensure that a character starts or continues to walk fast.

Parameter:character (Character) – The character to control.
Returns:self.
class ai.WalkUpOrDown

Command that makes a character walk up (away from an origin) or down (back to the origin).

command(character)

Make a character walk up or down.

Parameter:character (Character) – The character to control.
Returns:A GoToXY command, or self if the character is ready to turn round.
class ai.WatchForEric(command_list_id, alert_message)

Command that makes a character keep an eye out for Eric, and alert someone if they spot him trying to escape from skool. This command is used as a controlling command (see CommandList.set_controlling_command()).

Parameters:
  • command_list_id – The ID of the command list the alerted character should use.
  • alert_message – The message to scream if Eric is spotted trying to escape.
command(character)

Make a character check whether Eric is trying to escape from skool, and take appropriate action if he is.

Parameter:character (Character) – The character keeping an eye out for Eric.
Returns:A StopEric command if Eric is spotted trying to escape, or self otherwise.
class ai.WipeBoard

Command that makes a character wipe a blackboard.

get_commands()

Return the list of steps (methods) to execute for this complex command. The steps are:

is_interruptible()

Return whether this command is interruptible.

Returns:False (blackboards should never be left partially wiped).
lower_arm(character)

Make a character lower his arm after wiping a bit of a blackboard. If there are any bits of the blackboard left to wipe, the command is restarted.

Parameter:character (Character) – The character to control.
Returns:None.
walk(character)

Make a character walk to the next part of the blackboard that needs wiping. If the character hasn’t started wiping yet, he is sent to the nearest edge of the blackboard.

Parameter:character (Character) – The character to control.
Returns:A GoToXY command to send the character to the appropriate location.
wipe(character)

Make a character raise his arm and wipe a bit of a blackboard.

Parameter:character (Character) – The character to control.
Returns:None.
class ai.Write

Command that controls Eric while he’s writing on a blackboard.

command(eric)

Control Eric while he’s writing on a blackboard.

Parameter:eric (Eric) – Eric.
Returns:self if Eric has finished writing on the blackboard, None otherwise.
class ai.WriteOnBoard(message)

Command that makes a character write on a blackboard.

Parameter:message – The message to write on the blackboard.
command(character)

Make a character write the next letter of the message on a blackboard. The character’s arm will be alternately raised or lowered while writing.

Parameter:character (Character) – The character to control.
Returns:self if the character has finished writing, None otherwise.
is_interruptible()

Return whether this command is interruptible.

Returns:False (a blackboard should not be left half-written on)
class ai.WriteOnBoardUnless(signal)

Command that makes a character write on a blackboard unless a specified signal has been raised.

Parameter:signal – The signal to check before writing on the blackboard.
command(character)

Make a character write on a blackboard unless a signal has been raised.

Parameter:character (Character) – The character to control.
Returns:self if the signal has been raised, or the blackboard is dirty, or the character has finished writing on the blackboard; a WriteOnBoard command otherwise.
ai.get_command_class(command_name)

Return the class object for a given command.

Parameter:command_name – The name of the command.
ai.ASSEMBLY_DIRECTION
Direction a character must face when sitting down for assembly.
ai.ASSEMBLY_SIT_RANGE
Min and max number of steps to walk to find a spot to sit during assembly.
ai.BB_BACKTRACK
Distance a teacher walks back after wiping a blackboard.
ai.CHASE_ERIC_OUT_MIN_X
Minimum x-coordinate for the character under control of the ChaseEricOut command.
ai.CLIMB_SKOOL_GATE
Animation phases for climbing over the skool gate from a watered plant.
ai.DESCENT_MIDDLE_WINDOW
Animation phases for descent from middle-floor window.
ai.DESCENT_TOP_WINDOW
Animation phases for descent from top-floor window.
ai.DESK_LID_DELAY
Delay before an opened desk lid closes.
ai.DETHRONED_DELAY
Delay before a dethroned kid gets up.
ai.EVADE_MOUSE_COUNT
Time a musophobe will spend trying to evade a mouse.
ai.FLIGHT_SKOOL_GATE
Animation phases for the flight off the bike over the closed skool gate.
ai.FROG_LONG_HOP
Animation phases for the frog when doing a long hop.
ai.FROG_SHORT_HOP
Animation phases for the frog when doing a short hop.
ai.FROG_TURN_ROUND
Animation phases for the frog when turning round.
ai.KNOCKED_OVER_DELAY
Delay before a knocked-over teacher gets up.
ai.KO_DELAY
Delay before a knocked-out kid gets up.
ai.MIDDLE_WINDOW
ID of the middle-floor window (to decide which descent animation to use).
ai.MOUSE_HIDE_DELAY
Min and max delay before a hidden mouse reappears.
ai.MOUSE_LIFE
Min and max number of sprint sessions a mortal mouse engages in.
ai.MOUSE_SPRINTS
Min and max number of sprints per session.
ai.MOUSE_SPRINT_DISTANCE
Min and max distance of any sprint.
ai.PELLET_VERTICAL
Distance a pellet will travel upwards after hitting a teacher’s head.
ai.PLANT_DELAY1
Delay before a watered plant reaches half height.
ai.PLANT_DELAY2
Delay before a watered plant reaches full height.
ai.PLANT_LIFE
Time a plant takes to grow before dying.
ai.P_HIT_FIRE
Probability that the bully or tearaway will hit or fire if conditions are suitable.
ai.P_HOP
Probability that the frog will move if Eric is nearby.
ai.P_QASESSION
Probability that a lesson with Eric will have a question-and-answer session.
ai.P_SHORT_HOP
Probability that the frog will attempt a short hop (instead of a long hop) if not turning round.
ai.P_TURN_ROUND
Probability that the frog will turn round.
ai.P_WRITE_ON_BOARD
Probability that a teacher will write on the blackboard.
ai.REPRIMAND_DELAY
Delay before a knocked-over teacher gives lines.
ai.SKOOL_GATE
ID of the barrier Eric must hit to invoke the FlyOverSkoolGate command.
ai.TELL_ERIC_DELAY
Time to wait for Eric to respond before repeating a message.
ai.TOP_WINDOW
ID of the top-floor window (to decide which descent animation to use).
ai.UP_DOWN_DISTANCE
Distance a teacher paces up and down during a class without a question-and-answer session.
ai.WALKABOUT_RANGE
Range used by the WalkAround command.
ai.WATER_PHASES
Water animation phases.

Previous topic

Commands

Next topic

animal