Skip to content

Get From Code

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

Get From Code asks a method of your own code for an actor, two actors, a clan or a family. What it finds goes into a variable of the scheme, so later nodes can pick it by name. The story goes on through a found or a not found output.

What is not found empties its variable. The variable never keeps something found earlier.

A node of the demo scheme Tourney of the Ring (Drafts/schemes/27-tourney-of-the-ring.json). The demo method StrongestKnight picks the rider, who is stored in the scheme variable Rider.

Use it when only your code can tell who or what to pick, such as the strongest knight of the court.

Use Find Actor instead when a rule in the Studio can pick: a group, some conditions, a way to choose. It needs no code.

  • The method must give what Gives says. A method of another kind finds nothing, and the card warns.
  • Choosing a method sets Gives. The outputs follow it alone, so the graph is the same before your scripts compile.
  • With two actors, the first goes in Store In and the second in Store Second In. A card for two actors reads “Two actors from” the method.
  • Storing again replaces the stored value, for the whole scheme.
  • When For or Against is needed and not there, the variables are emptied and the flow stops.
  • An empty method name shows an error on the card.
LabelDraft keyTypeDefaultShown if, tooltip and notes
Method NameMethodNamemethod name (kind set by the node)not in the data
  • A method that gives an actor, two actors, a clan or a family.
GivesGives
  • Actor (An actor)
  • ActorPair (Two actors)
  • Clan (A clan)
  • Family (A family)
"Actor"What your method gives: an actor, two actors, a clan or a family. Choosing a method sets this. The outputs and Store In follow it.
  • Left out, it is read from the method; write it for a method that is not in your scripts yet.
Store InStoreInStore In (kind set by the node)not in the dataA variable of this scheme that gets what was found, so later nodes can pick it by name: an Actor, Clan or Family variable, as Gives says (with two actors, the first one). It holds one value for the whole scheme: storing into it again replaces it. What is not found empties it.
  • A scheme variable of the kind Gives names: an Actor variable (also the first of two actors), a Clan variable or a Family variable.
  • none: "Nowhere"
Store Second InStoreSecondInStore In (Actor)not in the data

Shown if Gives = ActorPair

An Actor variable of this scheme that gets the actor, so later nodes can pick it by name. It holds one actor for the whole scheme: storing into it again replaces it, even from another branch. Here: the second actor; it is emptied when the second actor is not found.
  • none: "Nowhere"
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)).
  • As in Run Code.
  • 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)).
  • As in Run Code.
  • Who the method gets as its target.
  1. Found
  2. Not Found
"type"
"Get From Code"
"set" keys
MethodName, Gives, StoreIn, StoreSecondIn, For, Against
"then" keys
"Found", "Not Found"
"<alias>": {
"type": "Get From Code",
"then": { "Found": "<alias>", "Not Found": "<alias>" }
}