Get From Code
- Group
- Code
- In the node menu
- Code › Get From Code
- Where it can be used
- Scheme graphs
What it does
Section titled “What it does”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.
Example
Section titled “Example”When to use it
Section titled “When to use it”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.
Good to know
Section titled “Good to know”- 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.
Settings
Section titled “Settings”| Label | Draft key | Type | Default | Shown if, tooltip and notes |
|---|---|---|---|---|
| Method Name | MethodName | method name (kind set by the node) | not in the data |
|
| Gives | Gives |
| "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.
|
| Store In | StoreIn | Store In (kind set by the node) | not in the data | A 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.
|
| Store Second In | StoreSecondIn | Store 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.
|
| 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”- Found
- Not Found
In a draft
Section titled “In a draft”"type""Get From Code""set"keysMethodName,Gives,StoreIn,StoreSecondIn,For,Against"then"keys"Found","Not Found"
"<alias>": { "type": "Get From Code", "then": { "Found": "<alias>", "Not Found": "<alias>" }}