Glossary of Behaviors

Note: Behaviors in Stencyl are saved as .png files. (The code is stored in the image file's metadata). Individual behaviors can be downloaded by right-clicking on the icon, and selecting "save image as.."

Warning: The Mathematics Development Engine Extension should be enabled before any behaviors are imported! Otherwise, you may see errors about "missing blocks".


Warning: Internally, variables names are preceeded by an underscore. (e.g. "Expression" would be represented as "_Expression" internally). When certain attributes (such as "Targets") requires listing a variable name, the underscore should be included. Global variables do not need underscores.

As a quick rule of thumb, whenever you need to type the name of a variable anywhere, use the internal name--that is, precede with an underscore.

Standard Behaviors

2D Graph Output Behavior
Actor will generate a 2D graph of a single-variable function, printed in a specified region.

Notable Variables
Independent Variablee.g. x
ExpressionThe right-hand side ofthe equation, following y=
Draw on CreationThe graph will be drawn when the actor is created, rather than on event call

Events
ActivateShows the graph (actor is active by default)
DeactivateHides the graph
DrawGraphGenerate and display the graph. Event must be called if Expression has been changed.


Basic Input Field Behavior
Actor generates an input field, displayed in a specified region.

Notable Variables
_ContentsStored value of the input field
Acceptable charactersCharacters the input field will accept, separated by commas
Use Alphabet...If checked, will include the standard alphabet as acceptable characters
Fixed TextText that is always displayed, but not part of the contents
TargetsVariables the input field will submit values to. Variables should be listed as ID.behavior.variable
Event TriggerEvents should be listed in the form event|unique id. Each listed event will be triggered in all behaviors for all actors with specified Unique Id.

Events
ActivateEnables and displays the input field (actor is active by default)
DeactivateHides the input field
SendContentsFor every varaible in Targets, replace its value with _Contents. Events listed in Event Trigger will be called.


Button Input Behavior
When attached to a button, provides functionality to submit values to specified variables.

Notable Variables
TargetsVariables the button will submit values to. Variables should be listed as ID.behavior.variable
ValueThe value to be submitted
Value is a VariableThe specified value is the name of a variable
Send on ClickIf checked, SendContents event will be called when button is pushed
AppendIf checked, Value will be appended to the specified (text) variable

Events
SendContentsFor every varaible in Targets, replace its value with _Contents. Events listed in Event Trigger will be called.


Calculator Output Behavior
Actor will generate a text box in a specified region, into which calculator outputs are fed.

Notable Variables
NewInputHolds an expression to be evaluated.

Events
ActivateShows the output (actor is active by default)
DeactivateHides the output
CalculateEvaluates the expression stored in NewInput, and copies the input and output to the display


Click and Drag
Allows the attached actor to be dragged by the mouse pointer.


Fixed Image Display
Actor will generate a 2D image inside a specified region.

Notable Variables
Image FileName of image file. Image should be placed in /extras folder.
Image File is URLIf checked, the specified file is a URL. The image will be downloaded and displayed.

Events
ActivateShows the image (actor is active by default)
DeactivateHides the image


Hide Actor
Hides the actor this behavior is attached to. This behavior is typically attached to "generator" actors--actors which generate graphs, input fields, etc.


Input Palette Generator Behavior
Actor will generate a numerical input palette in a specified region.

Notable Variables
TargetsVariables the button will submit values to. Variables should be listed as ID.behavior.variable
Event TriggerThis event will be triggered in all behaviors for the attached actor when the submit button is clicked

Events
ActivateShows the palette (actor is active by default)
DeactivateHides the palette


Label Behavior
Actor will generate a label, displayed in a specified region. The label displays text, but no user input. This behavior is a general-purpose text display behavior.

Notable Variables
ContentsText that the label displays
Contents Type The type of contents that the label contains. Options are:
LiteralLabel displays the Contents variable verbatim
URLLabel will visit the URL specified in the Contents variable, and display the page
LocalLabel will read the file specified in the Contents variable, and display the text
Open URL on ClickIf checked, user's web browser will open when the label is clicked
URLIf Open URL on Click is checked, specifies the URL to visit
Word WrapAutomatically wraps text to the next line
Auto UpdateIf checked, display will update when Contents is changed. If not checked, Initialize event must be called.

Events
ActivateShows the label (actor is active by default)
DeactivateHides the label
InitializeInitializes (or re-initializes) the label


List Based Graph Output Behavior
Actor will generate a list-based graph of a set of data points, printed in a specified region.

Notable Variables
Initial Data PointsList of coordinates in form x,y

Events
ActivateShows the graph (actor is active by default)
DeactivateHides the graph


Navigate on Event
Switches to a specified scene when Navigate event is called.

Events
NavigateSwitch to the specified scene


Navigate Button Behavior
Attaches to a button actor; switches to a specified scene when the button is pushed.
Note: This behavior listens for user input (mouse, or touch). The ButtonPush event is called when the user clicks the button.

Events
ActivateShows the button (actor is active by default)
DeactivateHides the button
ButtonPushSwitch to the specified scene


Polynomial Input Field Behavior

Deprecated. This behavior is used by a few of the older actors in the Actor Library. Basic Input Field Behavior should be used, instead.


Push Button Behavior
Attaches to a button actor and listens for user input (mouse, or touch). When the button has been pushed, behavior will trigger a list of specified events.

Notable Variables
Event TriggerEvents should be listed in the form event|unique id. Each listed event will be triggered in all behaviors for all actors with specified Unique Id.

Events
ActivateShows the button (actor is active by default)
DeactivateHides the button
ButtonPushTrigger the events specified in Event Trigger


Response Recorder
Stores data in specified global variables. The data will be retrieved from a specified actor.

Notable Variables
Target ActorThe actor to listen to for data
BehaviorThe actor's behavior to listen to for data
VariableThe variable to retrieve data from
Storage VariableThe global variable to store data in
RestrictionA global boolean variable that will be set to true when a value is stored in Storage Variable. When a response has been recorded, further requests for storage will be ignored.

Events
RecordPerforms the value storage action


Scrollbar Behavior
Actor will generate a scrollbar in a specified region.

Events
ActivateShows the scrollbar (actor is active by default)
DeactivateHides the scrollbar


Simple Image Display
Actor will generate an image, displayed in a specified region.

Notable Variables
Image FileThe image to display
Image File is URLIf checked, Image File refers to a URL. The image will be downloaded and displayed

Events
ActivateShows the image (actor is active by default)
DeactivateHides the image
LoadImageLoads the image into memory
LoadInstanceDisplays the image


Simple Push Button Behavior
Attaches to a button actor and listens for user input (mouse, or touch). When the button has been pushed, behavior will trigger a list of specified events. Events are limited to behaviors attached to the same actor.

Note: Push Button Behavior is a more general, flexible behavior.

Notable Variables
Event TriggerEvents should be listed, separated by commas. Each listed event will be triggered in all behaviors for the actor attached to this behavior.

Events
ActivateShows the button (actor is active by default)
DeactivateHides the button
ButtonPushTrigger the events specified in Event Trigger


Unique Identifier
Gives the actor a specified, unique name. This behavior is required by many of the other behaviors which use a Targets variable.


 

See Simple Clicker Instructions


 

See Simple Clicker Instructions


Example Application Behaviors

These are the behaviors used in the example applications.

Cannonball Behavior
Provides the functionality for the cannonball in the physics demonstration.


Cannon Behavior
Provides the functionality for the cannon in the physics demonstration.


Golf Ball Behavior
Provides the functionality for the golf ball in the physics demonstration.


Golfer Behavior
Provides the functionality for the golfer in the physics demonstration.