The Settings.Colour Java class.
The Settings.Color Java class.
The standard java.awt.Font
class.
The Language Java class.
The Settings.Region Java class.
The Settings.Region2D Java class.
The ResorceKit Java class.
The Settings Java class.
The standard java.net.URL
class, representing a Uniform Resource Locator such as https://strangeeons.cgjennings.ca
.
A shortcut for the ca.cgjennings.apps.arkham
package.
A reference to the ca
root package.
A reference to the gamedata
root package.
A reference to the java
root package.
A reference to the javax
root package.
A reference to the org
root package.
A reference to the resources
root package.
A shortcut for the javax.swing
package.
A reference to the game component edited by the active editor tab,
or null if none. If not null, then the Editor is an instance of
AbstractGameComponentEditor
A reference to the active editor tab, or null if none. All editors are a subclass of the StrangeEonsEditor class.
A reference to the main application object, an instance of the StrangeEons class.
This object defines some helper functions that can be used to modify or restore settings. This can be used to change otherwise inaccessible user preferences, or to "hack" new game components from existing components by changing their private settings.
Writes zero or more pairs of settings into user settings and then writes the user settings to disk. The new values will override the application defaults.
The arguments declare the keys to replace and the values to replace them with as follows:
Patch.apply("key1", "value1", "key2", "value2", ...)
an even number of arguments forming a sequence of key, value pairs; each value is written to the settings under the matching key
Changes zero or more pairs of the specified component's private settings.
The arguments declare the keys to replace and the values to replace them with as follows:
Patch.apply(component, "key1", "value1", "key2", "value2", ...)
Note that the built-in Component
always refers to the
currently edited game component, if any. (Otherwise it is null.)
the component to modify
an even number of arguments forming a sequence of key, value pairs; each value is written to the settings under the matching key
Modifies the private settings of a game component by merging in all of the settings stored in a resource file.
the component to modify
the resource path of the settings to apply
Removes one or more private settings from a component, resetting them to whatever value they inherit from the component's parent settings. This is not necessarily the same as resetting them to the component's initial state, as some settings may only have been defined on the component.
the component to modify
Deletes zero or more user settings, then writes the user settings to disk. This causes the specified settings to revert to the application default.
the names of zero or more keys to be restored
Changes zero or more pairs of settings until the end of the current session. The settings will return to their previous value the next time the application runs.
The arguments declare the keys to replace and the values to replace them with as follows:
Patch.temporary("key1", "value1", "key2", "value2", ...)
an even number of arguments forming a sequence of key, value pairs; each value is written to the settings under the matching key
If this is a plug-in script that is being called into by the application, this is a reference to the PluginContext that describes the context in which the call is being made.
Prompts the user to confirm an action by choosing OK or Cancel. Returns true if the user chooses OK, otherwise false. For example:
confirm("Proceed?");
a message to display
an optional title for the prompt window
true if the user confirms the action
Prompts the user to choose between one or more buttons. The first button is highlighted as a default option. Returns -1 if the user cancels the dialog. Otherwise returns 0 if the user selected the first option, 1 if the user selected the second option, and so on. For example:
confirm.choose("Favourite colour?", null, "Green", "Red", "Blue");
a message to display
an optional title for the prompt window
one or more button labels
the number of the selected option, counting from 0, or -1 if cancelled
An alternative name for confirm
.
Prompts the user to confirm an action by choosing OK or Cancel
(localized if possible).
Returns true if the user chooses OK, otherwise false. For example:
confirm.confirm("Proceed?");
a message to display
an optional title for the prompt window
true if the user confirms the action
Prompts the user to confirm an action by choosing Yes or No (localized if possible). Returns true if the user chooses Yes, otherwise false. For example:
confirm.yesno("Do you agree?");
a message to display
an optional title for the prompt window
true if the user confirms the action
The global scope. This is an alternate name for self.
The global scope. This can be used to access a global variable that has been aliased by a local variable.
let variable = 42;
function anotherScope() {
let variable = "aliased";
println(variable); // prints aliased
println(self.variable); // prints 42
}
anotherScope();
The path or URL that identifies the location of the source file of the running script. If the script is being run directly from a code editor, this will be the string "Quickscript"
.
Displays a message to the user. If clicked, the message will disappear instantly. Otherwise, if it is a plain message and not a warning or error message, it fades away over time. For example:
alert("Caution:\nFloor is slippery when wet", false);
the message to display
if true, the message is presented as an error; if false, as a warning; if not specified, as a plain message
If debugging is enabled in user preferences, this will check is the specified condition is true, and if not it will throw an error including the specified message. If debugging is not enabled, the condition is evaluated but the function otherwise has no effect.
the condition which must be true for the script to continue
an error message to print when the assertion fails
If debugging is enabled in user preferences, prints an optionally formatted string to the application log. The log can be viewed from the console by right clicking, or by using the Log Viewer.
the text to log
optional arguments referenced by format specifiers in format
Stops executing the script. If the script attached event listeners to objects or started other threads, they will continue to operate.
Prints an object to the script console. You may pass multiple arguments to this function; the arguments will be printed in sequence. For example:
print("Hello");
the object to be printed
Prints a formatted message string. The effect is the same as formatting the string with sprintf and then printing the result. Formatting will be localized using the interface language. For example:
printf("Your lucky number is %d\n", 1 + Math.random()*100);
the format string
arguments referenced by the string's format specifiers
Prints a formatted message string. The effect is the same as formatting the string with sprintf and then printing the result. For example:
let languages = [new Language("en"), new Language("fr")];
for(let lang of languages) {
printf(lang, "In %s, the decimal of 1/2 is %.1f\n", lang.locale.displayName, 1/2);
}
the language or locale used to localize the formatting, or null for no localization
the format string
arguments referenced by the string's format specifiers
Prints an object to the script console, then starts a new line. You may pass multiple arguments to this function; the arguments will be printed in sequence, then a new line will be started.
for(let i=1; i<=10; ++i) println(i);
the object to be printed
Displays a prompt to the user and waits for them to enter a value, returning the value.
a message to display
a default value for the prompt field
the entered value, or null if the prompt was cancelled
Pauses script execution for the specified period of time. Returns true if you interrupt the sleep period from another thread; otherwise false. Calling this from the main thread will cause the application to be unresponsive while sleeping; use caution when choosing a sleep duration.
the time to sleep, in milliseconds (default is 1000)
true if the sleep was interrupted, otherwise false
Returns a formatted string using the %-format string and arguments. Formatting will be localized using the interface language.
Formatting behaviour is similar to Java's String.format
method,
but %i
is allowed as a synonym of %d
and numeric arguments will
be coerced, if necessary, to fit the conversion type. For example,
passing a number as the argument for a %d
conversion will coerce
the number to an integer type rather than cause an error.
the result.
the format string
arguments referenced by the string's format specifiers
Returns a formatted string using the %-format string and arguments.
Formatting behaviour is similar to Java's String.format
method,
but %i
is allowed as a synonym of %d
and numeric arguments will
be coerced, if necessary, to fit the conversion type. For example,
passing a number as the argument for a %d
conversion will coerce
the number to an integer type rather than cause an error.
the language or local used to localize the formatting, or null for no localization
the format string
arguments referenced by the string's format specifiers
Sets the Language used to look up game strings using
#key-name
identifiers. By default this is the global game language.
the localized string database to use for #
variables
Sets the Language used to look up interface strings using
@key-name
identifiers. By default this is the global interface language.
the localized string database to use for @
variables
Imports the specified library into the current script. The result is
the same as if the code in the library was pasted at that point in your
script. The library can either be the name of one of the standard
scripting libraries or else a res://
URL pointing to a script
resource.
If the same library is imported with useLibrary
multiple times in the
same script, only the first call has any effect.
Examples:
// import standard library "markup"
useLibrary("markup");
// import user library from a plug-in, located at
// resources/myname/myplugin/mylib.js
useLibrary("res://myname/myplugin/mylib.js");
name of standard library, or resource path
Sets the Settings
source that will be used to get and set
settings using the $setting-key
syntax.
By default, a script that uses this syntax will read and write the
global (shared) settings, except for DIY scripts
which use the private settings of their DIY game component object.
This function allows you to choose a different Settings
object to use. The specified source
can be any of the following:
Settings
instance;GameComponent
(to use the component's private settings);null
(to use the global shared settings).the settings source to use for $
variables
The #
function looks up a game language string. This can be
used analogously to a #key-name
identifier to look up a
key name that is composed on the fly, as in
#("key-" + n)
. If passed more than one argument, it will look
up the string for the first argument, then use the remaining
arguments to format it as if by using sprintf.
The Language that is searched for the specified key can be changed by calling useGameLanguage.
the key to look up in the game language database
optional arguments that will be used to format the string
The $
function looks up a setting key. This can be
used analogously to a $key-name
identifier to look up a
key name that is composed on the fly, as in
$("key-" + n)
.
The Settings that are searched for the specified key can be changed by calling useSettings.
the key to look up in the game language database
optional arguments that will be used to format the string
The @
function looks up a user interface string. This can be
used analogously to an @key-name
identifier to look up a
key name that is composed on the fly, as in
@("key-" + n)
. If passed more than one argument, it will look
up the string for the first argument, then use the remaining
arguments to format it as if by using sprintf
.
The Language that is searched for the specified key can be changed by calling useInterfaceLanguage.
the key to look up in the interface language database
optional arguments that will be used to format the string
common library
The common library defines basic functionality that may be useful to any script. There is no need to explicitly use it; it is automatically included in every script.