WadScript Help

WadScript Function Reference

This utility is a doozy - it employs a sophisticated scripting language called RookScript (made by yours truly) with some function extensions for manipulating WAD data! It's SO FLEXIBLE! There are even functions for doing byte-by-byte reading and streaming in case you want to do something not covered in the built-in functions! WHOA!

Check this! Open a WAD and print its entry list:

entry main(args) {
	if (args[0] === null) {
		return error("NoWAD", "No WAD specified.");
	}
	check (err) {
		wad = wadfile(args[0]);
		each (i, e : wad->waditerate()) {
			println(i + ": " + e.name + ", " + e.size + " bytes, at offset " + e.offset);
		}
	}
	close(wad);
	if (err != null) {
		return err;
	}
}

Then you just run the script with:

wadscript filenameOfScript.wscript file.wad

NOTE: The arguments after the script file are passed in via that args variable, so "file.wad" is readable from args[0].

Or if you're using Bash, you can just slap #!/usr/bin/env wadscript into the first line and flag the script as executable! Wow! (You can even do a similar thing with WadMerge scripts)

Built-in function documentation for WadScript is included in the release archives, or you can type:

wadscript --function-help

...and send the output to a file or what-have-you. To get it in HTML format, use --function-help-html. A quick guide to RookScript is here (and included in the utilities): rookscript-guide.html

You also get the regular RookScript utility without the Doom extensions for FREE!

rookscript [scriptfile]

Full Command Help

Usage: wadscript [filename] [switches | scriptargs]
                 [--help | -h | --version | --changelog]
                 [--function-help]
                 [--disassemble] [filename]
[filename]:
    The script filename.

[switches]:
    --help, -h                   Prints this help.
    --version                    Prints the version of this utility.
    --gui                        Starts the GUI version of this program.

    --function-help              Prints all available function usages.
    --function-help-markdown     Prints all available function usages in
                                     Markdown format.
    --function-help-html         Prints all available function usages in
                                     HTML format.
    --function-help-html-div     Prints all available function usages in
                                     HTML format, but just the content.
    --disassemble                Prints the disassembly for this script
                                     and exits.
    --entry-list                 Prints the list of entry point names for this
                                     script and exits.
    --entry [name], -e [name]    Use a different entry point named [name].
                                     Default: "main"
    --charset [name], -c [name]  Use a specific charset encoding, [name],
                                     instead of the system default. It is
                                     assumed that the rest of the included
                                     files are encoded this way, as well.
                                     Default: windows-1252
    --runaway-limit [num]        Sets the runaway limit (in operations)
                                     before the soft protection on infinite
                                     loops triggers. 0 is no limit.
                                     Default: 0
    --activation-depth [num]     Sets the activation depth to [num].
                                     Default: 256
    --stack-depth [num]          Sets the stack value depth to [num].
                                     Default: 2048
    --                           All tokens after this one are interpreted
                                     literally as args for the script.
                                     Normally, all unrecognized switches
                                     become arguments to the script. This
                                     forces the alternate interpretation.
    --X                          Bash script special: [DEPRECATED]
                                     First argument after this is the script
                                     file, and every argument after are args
                                     to pass to the script.

Scopes
------
All scripts can access a scope called `global` that serves as a common variable
scope for sharing values outside of functions or for data that you would want
to initialize once.
		

CHANGELOG

### Changed for 1.6.2

* `Fixed` [GUI] Editor would error out on workspace load with no files open.


### Changed for 1.6.1

* `Changed` [GUI-Executor] The working directory form field will not auto-fill unless it is blank.


### Changed for 1.6.0

* `Added` A directory tree for the GUI.


### Changed for 1.5.0

* `Fixed` The `--entry` switch didn't parse the command line properly after its use.
* `Added` The WadScript GUI, plus a switch to start it (`--gui`).
* `Added` A `--charset` switch for specifying the encoding of the script files (if not system default).


### Changed for 1.4.0

* `Added` A switch for printing the entry points for a script.


### Changed for 1.3.1

* `Changed` Improved HTML documentation output.


### Changed for 1.3.0

* `Added` A switch for dumping documentation as HTML. (Enhancement #45)


### Changed for 1.2.2

* `Changed` WadScript will now dump a stacktrace if a script host function produces an unhandled exception.


### Changed for 1.2.1

* `Fixed` WADSETTYPE() did not accept two parameters, as described.


### Changed for 1.2.0

* `Added` All scripts can now make use of a global scope called `global`.


### Changed for 1.1.0.1

* `Added` Clarifications to documentation that PKE files are also openable like PK3s.


### Changed for 1.1.0

* `Added` Functions: WADSETTYPE for setting the WAD type.


### Changed for 1.0.2

* `Added` Made it easier to interface with from other tools.


### Changed for 1.0.1

* `Fixed` Markdown documentation output.


### Changed for 1.0.0

* Initial Release.