java.lang.Object
net.botwithus.rs3.script.Script
- All Implemented Interfaces:
Runnable,ImmutableScript,ItemInputProvider,ItemOutputProvider,ItemProvider
- Direct Known Subclasses:
GlobalScript,LoopingScript,TickingScript
The abstract script, this class represents the common traits and behaviour between scripts.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddelay(long ms) voiddelayUntil(long ms, Supplier<Boolean> condition) voidfinal ImmutableConfigGets the configurationScriptConfigGets the current graphics context or creates one if none are present.getInput()com.google.common.flogger.FluentLoggergetLog()final StringgetName()The name of the script, mainly for visual purposes.booleanInitializes the script, this method loads the script configuration.final booleanisActive()If the script is active, when the script is active is runningbooleanbooleanisLocal()Checks if the script is local or from the SDNbooleanisPaused()voidvoidvoidvoidvoidpause()final voidLogs the given object's toString to the console on the same line.final voidLogs the given message to the console on the same line.final voidLogs the given message on the same line.voidLogs a formatted string.final voidLogs the given object's toString to the console.final voidLogs a message to the console.final voidLogs a formatted string.voidresume()abstract voidrun()final voidsetActive(boolean active) Sets if the script will be in active state or not.final <T> voidSubscribes the given event with this script as ownervoidSyncs the configuration with the script statefinal voidUninitializes the Scriptvoid
-
Constructor Details
-
Script
-
-
Method Details
-
isLocal
public boolean isLocal()Checks if the script is local or from the SDN- Returns:
- True if the script is locally loaded
-
pause
public void pause() -
resume
public void resume() -
onActivation
public void onActivation() -
onDeactivation
public void onDeactivation() -
onPropertyChangeRequest
-
getAuthor
- Specified by:
getAuthorin interfaceImmutableScript
-
getDescription
- Specified by:
getDescriptionin interfaceImmutableScript
-
run
public abstract void run() -
getGraphicsContext
Gets the current graphics context or creates one if none are present.- Returns:
- The current graphics context
-
getName
The name of the script, mainly for visual purposes.- Specified by:
getNamein interfaceImmutableScript- Returns:
- The name of the script.
-
isActive
public final boolean isActive()If the script is active, when the script is active is running- Specified by:
isActivein interfaceImmutableScript- Returns:
- If the script is active or not
-
unsubscribeAll
public void unsubscribeAll() -
isPaused
public boolean isPaused()- Specified by:
isPausedin interfaceImmutableScript
-
setActive
public final void setActive(boolean active) Sets if the script will be in active state or not.- Parameters:
active- The state of being active or not
-
print
Logs the given object's toString to the console on the same line.- Specified by:
printin interfaceImmutableScript- Parameters:
object- The message to be logged to the console.
-
println
Logs the given object's toString to the console.- Specified by:
printlnin interfaceImmutableScript- Parameters:
object- The message to be logged to the console.
-
print
Logs the given message to the console on the same line.- Specified by:
printin interfaceImmutableScript- Parameters:
message- The message to be logged to the console.
-
print
Logs the given message on the same line.- Specified by:
printin interfaceImmutableScript- Parameters:
message- the message to logargs- the arguments to format the message with
-
println
Logs a message to the console.- Specified by:
printlnin interfaceImmutableScript- Parameters:
message- The message to be logged.
-
print
Description copied from interface:ImmutableScriptLogs a formatted string.- Specified by:
printin interfaceImmutableScript- Parameters:
t- the throwable to log
-
println
Logs a formatted string.- Specified by:
printlnin interfaceImmutableScript- Parameters:
format- the format stringargs- the arguments referenced by the format specifiers in the format string
-
getConfiguration
Gets the configurationScriptConfig- Specified by:
getConfigurationin interfaceImmutableScript- Returns:
- The
ScriptConfig
-
subscribe
Subscribes the given event with this script as owner- Type Parameters:
T- The generic event Type- Parameters:
eventType- The event typelistener- The listener
-
initialize
public boolean initialize()Initializes the script, this method loads the script configuration.- Returns:
- If the script should be active
-
onUninitialize
public void onUninitialize() -
uninitialize
public final void uninitialize()Uninitializes the Script -
syncConfig
public void syncConfig()Syncs the configuration with the script state -
isBackgroundScript
public boolean isBackgroundScript()- Specified by:
isBackgroundScriptin interfaceImmutableScript
-
delay
public void delay(long ms) -
delayUntil
-
delayUtil
-
getInput
- Specified by:
getInputin interfaceItemInputProvider
-
getOutput
- Specified by:
getOutputin interfaceItemOutputProvider
-
getDefinition
- Specified by:
getDefinitionin interfaceImmutableScript
-
getLog
public com.google.common.flogger.FluentLogger getLog()
-