# Custom Code

For more complex logic than the [Property Trigger](/miltech-mission-hub/detailed-documentation/map-objects/property-trigger.md), you can use custom RPN code. The **Custom Code** object can both execute RPN code and also use its result as a trigger.

Learn more about RPN code here: [MSFS SDK Documentation - Reverse Polish Notation](https://docs.flightsimulator.com/html/Additional_Information/Reverse_Polish_Notation.htm)

### Attributes

<table data-header-hidden data-full-width="false"><thead><tr><th width="109.99993896484375">Attribute</th><th>Description</th></tr></thead><tbody><tr><td><strong>Active On Start</strong></td><td><strong>Enabled:</strong> the code will start executing as soon as the missions starts<br><strong>Disabled:</strong> you need to activate this object during the mission, or use the <em>Execute Once</em> action.</td></tr><tr><td><strong>Fire Once</strong></td><td><strong>Enabled:</strong> the object will deactivate (stop executing the code) when it fires a connection for the first time<br><strong>Disabled:</strong> the object will keep firing the connected events until it is deactivated</td></tr><tr><td><strong>RPN Code</strong></td><td>Custom RPN code to execute</td></tr></tbody></table>

### Actions

<table data-header-hidden><thead><tr><th width="110">Action</th><th>Description</th></tr></thead><tbody><tr><td><strong>Activate</strong></td><td>Start executing the code every frame</td></tr><tr><td><strong>Deactivate</strong></td><td>Stop executing the code</td></tr><tr><td><strong>Execute Once</strong></td><td>Execute the code once</td></tr></tbody></table>

### Events

<table data-header-hidden><thead><tr><th width="109.99993896484375">Event</th><th>Description</th></tr></thead><tbody><tr><td><strong>True</strong></td><td>Fires when the result of executing the RPN code is true (larger than or equal to 1)</td></tr></tbody></table>

## See also

* For simple logic, use [Property Trigger](/miltech-mission-hub/detailed-documentation/map-objects/property-trigger.md)


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.miltechsimulations.com/miltech-mission-hub/developer-sdk/advanced-map-objects/custom-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
