> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/flatredball/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/flatredball/api/flatredball/instructions/instructionmanager/instructions.md).

# Instructions

### Introduction

The Instructions property is an exposed InstructionList which the InstructionManager will check and execute if according to the [TimeManager's](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) CurrentTime property. Instructions which do not necessarily belong to an instance, or which are to be executed on an object which does not implement the [IInstructable](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) interface can be added to the InstructionManager's Instructions property for automatic execution.

### Code Example

Instructions can be directly added or removed from the InstructionManager.Instructions list:

```lang:c#
// Calls the EndGame method in 10 seconds:
var delegateInstruction = new DelegateInstruction( 
    () => EndGame(), 
    TimeManager.CurrentTime + 10);

InstructionManager.Instructions.Add(delegateInstruction);
```

### Execution Details

The InstructionManager will execute Instructions if the InstructionManager's IsExecutingInstructions property is true (default). The InstructionManager will automatically check the time of instructions and execute them.

### Common Usage

[Instructions](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) are a common part of the FlatRedBall game engine, and many FlatRedBall objects implement the [IInstructable](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) interface. If an instruction is instantiated which should operate on an [IInstructable](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php), then the instruction should be added to the [IInstructable's](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) Instructions property. This suggests that the [IInstructable](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) "owns" the instructions which will operate on it. Having each [IInstructable](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) contain [Instructions](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) which will operate on it can help improve debugging. Some objects, such as [Screens](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) do not implement the [IInstructable](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) interface, or are not automatically managed by a manager. It is common practice to place [Instructions](https://github.com/flatredball/FlatRedBallDocs/tree/main/frb/docs/index.php) which will operate on these objects in the InstructionManager's Instructions list. Instructions in this list will also automatically be executed, and provide a centralized, easy to use list for instructions. However, in general, use the Instructions property for individual objects if available before using the InstructionManager's Instructions list.

### Clearing all Instructions

You can clear all instructions by simply calling the Clear method on the Instructions object:

```
InstructionManager.Instructions.Clear();
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/flatredball/api/flatredball/instructions/instructionmanager/instructions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
