Skip to content

Run Code

Group
Code
In the node menu
Code › Run Code
Where it can be used
Scheme graphs

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?.

A node of the demo scheme Season of War (Drafts/schemes/16-season-of-war.json). It calls the demo's ArmyStrength method, which writes the sizes of the two hosts into scheme variables.

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.

  • 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.
LabelDraft keyTypeDefaultShown if, tooltip and notes
MethodMethodNamemethod name (Check)not in the dataA method of your code marked [IntrigueMethod] that returns void, bool or bool?.
ForForActorRef"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)).
  • Who the method gets as its conspirator.
AgainstAgainstActorRef"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)).
  • Who the method gets as its target.
  1. True
  2. False
  3. No Answer
"type"
"Run Code"
"set" keys
MethodName, For, Against
"then" keys
"True", "False", "No Answer"
"<alias>": {
"type": "Run Code",
"then": { "True": "<alias>", "False": "<alias>", "No Answer": "<alias>" }
}