Pedagogica Documentation

Javadocs of java libraries used by CC

Pedagogica scripting

Pedagogica scripts have a structure of nodes and arcs. Nodes can be nested inside other nodes. There are special functions in nodes and arcs that are called by the pedagogica engine. There are also objects that nodes and arcs can use to control the pedagogica engine.

Node

Functions
first()
Called the first time a node is entered
enter()
Called each time the node is entered.
view()
Called after the view has been prepared. If you are familiar with java gui programing, this is at the end of the addNotify on the view frame.
exit()
Called just before the node is exited
Variables
These variables are avialable during all the functions calls.
currentNode
The node object containing this script
nodeScript
The script object itself
currentScript
Deprecated. the script object itself

Arc

Functions
activate()
Called when the source node this arc is entered
deactivate()
Called after the source node has been exited. I believe it is called before the enter method of the target node of the arc is called
test()
Called to see if the current state should tansverse through this arc, from the source to the target node. It must return true or false. If more than one arc's test returned true, then only one traversed.
traverse(source_node, target_node)
Called while pedagogica is moving from this arcs source to its target.
leave(source_node)
Deprecated. this is called after during a traversal.
arrive(target_node)
Depricated. this is called after during a traversal.
Variables
Durring traversal a few variables are available:
incomingArc
The ActivityArc object that contains the current arc script
arcScript
The arc script itself
arrival
Deprecated. the arc script itself. use arcScript instead
In addition the Node variables should be available. These will be the variables that were available when the next() function was called. In gerneral currentNode will be the sourceNode.
Traversal Order
  1. exit is called on the source node
  2. deactivate is called on all arcs originating from the source node. including the one being traversed.
  3. traverse is called on the arc
  4. arrive is called on the arc. Deprecated (use traverse)
  5. leave is called on the arc. Deprecated (use traverse)
  6. enter is called on the target node
  7. activate is called on all the arcs originating from the target node

How to start a traversal

The standard way is to call the next() function on the currentNode object. At this point all the test() functions are called on the outgoing arcs from this node.