new Run(treatment, app)
Parameters:
| Name | Type | Description |
|---|---|---|
treatment |
Object | From ztt.js. |
app |
App | The session's app. |
- Source:
Methods
chat()
A subject's chat entry: a new record of the chat box's table, with its programs run.
- Source:
contractRows()
A contract list's rows: the box table's records that meet its condition, sorted.
- Source:
dumpTables()
Table dumpers, as z-Tree 5 runs them (as the stage starts, after its programs): each whose
condition holds writes its tables (semicolon-separated names) to its file, in the session's
output folder, as z-Tree writes them (see loadTables).
- Source:
endPeriod()
Ends period p: profits added up.
- Source:
exec()
Runs code in ctx; an error is noted (and logged), not thrown.
- Source:
initRecord()
A new record of a table: the background's programs for its table run on it, as z-Tree
runs them (noda's contracts get Buyer = -1 and so on, GIMS's records their arrays).
- Source:
loadTables()
Table loaders, as z-Tree 5 runs them (before the stage's programs): each whose condition
holds reads its file, a dumper's (a line naming a table and its variables, then a line
for each record: the table's name and the values; tab-separated), from the session's
output folder (where dumpers write, so that a treatment can load what one before dumped),
else the treatment's. A table's records are replaced by the file's: a variable the file
does not have is 0, as in z-Tree, but for jtree's own in subjects and globals (Period,
Subject, Group, Participate; NumPeriods), which its sessions need. A variable the
treatment does not have is an error, noted (as z-Tree shows it), and left out.
- Source:
mode()
Whose rules the treatment runs by: its session's mode (see Session#engineMode), else jtree's.
- Source:
onChange()
Called when the tables change outside a participant's action (later blocks).
- Source:
plotInput()
A subject used a plot input of a plot box: {box, input (its id: the item's path in the box,
then @ and the records it was drawn for, table:id, innermost first), x, y (where), x0, y0,
x1, y1 (a drag's start and end)}. A click (action 0) makes a record of the input's table at
the point (or, for subjects, moves the subject's); a click on an item (1) or a drag (2) is
its record's. Then the input's programs run, each on its table's record.
- Source:
press(d)
A subject pressed a button of a box of their stage's screen: its inputs are checked and put
in their record (or a new one, or the chosen one, for contract boxes), its checkers are
checked, and its programs run. Returns {error} (a message for the subject), or {leave}
(whether the subject leaves the stage).
Parameters:
| Name | Type | Description |
|---|---|---|
d |
Object | {box (path), button (index), values (by input name), record (chosen)} |
- Source:
runPrograms()
Runs programs (a stage's, the background's) for the subjects starting it: each program, in
order, on its table's records (subjects: those starting; globals: once).
- Source:
screen()
The screen a subject sees: stage's active or waiting screen (the background's, if it has none).
- Source:
startPeriod()
Starts period p (0-based) for the subjects (the session's participants, in order).
- Source:
tableCondition()
Whether a loader's or dumper's condition holds (on the globals; none: it does).
- Source:
tableFile()
The file a table loader or dumper names: its name (z-Tree's may be a Windows path) in
folder.
- Source: