Defined Macros
The currently listing of defined macro functions can be found at Proteopedia:Macros.
Using Macros
Integrating macro use into JSmol code is straightforward.
This example doesn't require any parameter to act. It causes the structure shown to 'bobble()'.
<jmol>
<jmolLink>
<script>
script /mc/ktheis.spt;
if (~bobble); ~bobble=false; exit; else; bobble(); ~bobble=true; endif;
</script>
<text>Toggle Bobble on/off</text>
</jmolLink>
</jmol>
The bobble() part triggers the action. The exit ends the looping bobble.</br>
You can try the result here:
Doesn't seem to stop!?!?
This example shows how to specify an item or items to act on by passing in a parameter.
Coding New Macros
Advanced users who want to code additional macros can get a flavor for the JSmol operating behind the scenes and ideas on how they'd code their own by examining the code for macros already available. To view an example go the Proteopedia:Macros page and note that examples such as the 'bobble()' example include notes on how you import it using script /mc/ktheis.spt. In particular note the /mc/ktheis.spt part after 'script'. That is the address of the script code stored at Proteopeida. Place that part after after http://proteopedia.org/wiki/ so you end up at http://proteopedia.org/wiki//mc/ktheis.spt where you can see the code for several defined macro functions.