Scripting demonstrations
Try new Record-your-own-demos page!
You can code automatic demonstrations yourself,
just by changing the contents of a plain-text file
and calling this from javascript embedded in a webpage using the applet's public method playfile (view html source of a page with demos to see how).
Here are the demo text files
Instruction codes
Updated 20/4/02
The first letter after each # is an instruction.
All subsequent text until the next # is the parameter for that instruction.
"White space" at the beginning and end is trimmed.
Note the code is case sensitive and doesn't trap errors!
It may help to add pauses (e.g. #w 1000) between "major" changes to give the model time to catch up.
You shouldn't need to restart the applet to test it (although this may help if it gets stuck).
Probably wise to start most sequences with reset, select number of plots, and rearrange them
- #p panel-name : Select a panel
- #o object-name : Select an object (control, option, menu) within a panel
The names of panels and objects are now the same as in the labels text file, i.e. whatever follows immediately after each #
Note it will only find objects, if their panel has been selected first.
Here is the labels file
- #u : pop up info for this object
- #r : and remove pop-up
- #s menu-item : Select an item from a menu
- #l : make a menu visible
- #L : and remove the menu
- #t : set an option true
- #f : set an option false
- #x year : set target x-value (year)
- #y value : set target y-value (as on graph, but note emissions are in Mt (x1000)!)
- #m : jump control directly to target
- #d n : control drags to target in n steps (note x-interval must divide by n!)
- #X delta-x : set delta-x
- #Y delta-y : set delta-y
- #D n : drag control n steps using delta-x and delta-y (ignore target!)
- #> limit : Set lower limit for scale
- #< limit : Set upper limit for scale
- #g loopname : start a loop
- #G : end the loop, return to loopname
- #w dt : wait dt milliseconds
- #W dt : set interval between steps while dragging to dt milliseconds
- #i info-text : display this info-text on graph, button etc.
- #I info-text : set model info and load a web page, which may display this info (as in auto-demo)
- #F framename : set frame name for above
- #P pagename : set webpage name for above
- #J javascript : send javascript instruction to web browser
- #e end script