JXN Scripting

    script file   special commands   table

Interactive entry versus jxn script file

- interactive entry of commands

- reading commands from a jxn script file (filename.jxn)

- the jxn log file (filename~log.jxn)

Special Commands

- overview

- jxn include: #filespec.jxn

- #function definition and class JxnFunction

- global versus local variables

- control of debug output


JXN Special Commands

jxn special command (syntax) allowed in description
input field
(interactive)
jxn file or
from JxnEditor
#function
definition
#edit

#edit command
yes no no copies the output list of the JxnSession into a new JxnEditor window
    (same as menu: File > Edit… in the JxnSession window)
shows the result of command in a new JxnEditor window
    e.g. #edit Color.class.getMethods()
#reinit yes no no resets the jxn session (same as menu: File > New in JxnSession window)
#exit yes no no terminates jxn (same as menu: File > Exit or [x] in JxnSession window)
#filespec[.jxn]
#filespec(...)
#filespec simple_term
yes yes no includes jxn file (".jxn" may be omitted for filespec without blanks)
- … with arguments for parameters $1, $2, ... used inside the included file
- single argument without brackets for parameter $1
#this(...)
#this simple_term
deprecated deprecated no continues processing from the top of the current jxn file
#remove variable_name yes yes no forgets variable
#import package_path
#import package_path.class_name
yes yes no adds package or class to list searched for classes
#remove package package_path
#remove package package_path.class_name
#remove package class_name
#remove package_path
#remove package_path.class_name
#remove class_name
removes package or class from list searched for classes

Note: #remove package class_name without the keyword package may,
unintendedly forget a variable named class_name.
#remove package class_name only removes a class defined by #import
#import static class_name
#import static package_path.class_name
yes yes no adds class to list of classes searched for static methods
(other than java jxn does not support single static method names here)
#remove static class_name
#remove static package_path.class_name
removes class from list of classes searched for static methods
#function function_name
#function function_name()
#function function_name(...)
no yes no start of function defintion (see class JxnFunction)
- without parameters (no arguments expected)
- … with named parameters
  #endfunction end of function defintion (required)
function_name() …
function_name(...) …
function_name simple_term
yes yes yes jxn function call
- … with arguments for the defined parameters
- with single argument without brackets for a single parameter
#if statement
#ifdef variable_name
#ifndef variable_name
no yes yes start of if structure
  #else if statement (optional)
  #else (optional)
  #endif end of if structure (required)
#while statement no inside function yes start of while loop
  #break exits from the current loop (optional)
  #continue skips the rest of the current loop and continues after #while … (optional)
  #endwhile end of while loop (required)
#return noyesyesreturns from the current jxn file or function
#return statementnoinside functionyesreturns the result of statement from the function