Run Code
- Group
- Code
- In the node menu
- Code › Run Code
- Where it can be used
- Scheme graphs
What it does
Section titled “What it does”Run Code calls a method of your own game code and continues through the answer. A method that returns yes goes through True, one that returns no goes through False. A method that gives no answer, or cannot be called, goes through No Answer.
The method has to be marked [IntrigueMethod] and return nothing, bool or bool?.
Example
Section titled “Example”When to use it
Section titled “When to use it”Use it when the game itself knows the answer: a rule in your code, a count only your code can make, an effect that must happen in code.
Use Get From Code instead when the method gives back an actor, two actors, a clan or a family. Use Compare Variable instead when the answer is already in a variable.
Good to know
Section titled “Good to know”- A method that returns nothing counts as True once it has run.
- A
bool?method that returns null gives No Answer. - An empty method name, or a name no method has, gives No Answer. The card warns about an unknown name.
- A method that throws is logged and gives No Answer.
- When the method needs an actor and For or Against is not there, the flow stops.
- For and Against show only for a method that takes those actors.
- Link No Answer, so a broken method does not end the flow there.
Settings
Section titled “Settings”| Label | Draft key | Type | Default | Shown if, tooltip and notes |
|---|---|---|---|---|
| Method | MethodName | method name (Check) | not in the data | A method of your code marked [IntrigueMethod] that returns void, bool or bool?. |
| For | For | ActorRef | "Conspirator" | Shown if the method takes one actor, two actors or the whole call, or is not known (not compiled yet, a typed name) The actor the method gets first (a method that takes (Actor conspirator) or (Actor conspirator, Actor target)).
|
| Against | Against | ActorRef | "Target" | Shown if the method takes two actors or the whole call, or is not known (not compiled yet, a typed name) The actor the method gets second (a method that takes (Actor conspirator, Actor target)).
|
Outputs
Section titled “Outputs”- True
- False
- No Answer
In a draft
Section titled “In a draft”"type""Run Code""set"keysMethodName,For,Against"then"keys"True","False","No Answer"
"<alias>": { "type": "Run Code", "then": { "True": "<alias>", "False": "<alias>", "No Answer": "<alias>" }}