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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
delay
(long ms) void
delayUntil
(long ms, Supplier<Boolean> condition) void
final ImmutableConfig
Gets the configurationScriptConfig
Gets the current graphics context or creates one if none are present.getInput()
com.google.common.flogger.FluentLogger
getLog()
final String
getName()
The name of the script, mainly for visual purposes.boolean
Initializes the script, this method loads the script configuration.final boolean
isActive()
If the script is active, when the script is active is runningboolean
boolean
isLocal()
Checks if the script is local or from the SDNboolean
isPaused()
void
void
void
void
void
pause()
final void
Logs the given object's toString to the console on the same line.final void
Logs the given message to the console on the same line.final void
Logs the given message on the same line.void
Logs a formatted string.final void
Logs the given object's toString to the console.final void
Logs a message to the console.final void
Logs a formatted string.void
resume()
abstract void
run()
final void
setActive
(boolean active) Sets if the script will be in active state or not.final <T> void
Subscribes the given event with this script as ownervoid
Syncs the configuration with the script statefinal void
Uninitializes 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:
getAuthor
in interfaceImmutableScript
-
getDescription
- Specified by:
getDescription
in 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:
getName
in 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:
isActive
in interfaceImmutableScript
- Returns:
- If the script is active or not
-
unsubscribeAll
public void unsubscribeAll() -
isPaused
public boolean isPaused()- Specified by:
isPaused
in 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:
print
in interfaceImmutableScript
- Parameters:
object
- The message to be logged to the console.
-
println
Logs the given object's toString to the console.- Specified by:
println
in 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:
print
in interfaceImmutableScript
- Parameters:
message
- The message to be logged to the console.
-
print
Logs the given message on the same line.- Specified by:
print
in interfaceImmutableScript
- Parameters:
message
- the message to logargs
- the arguments to format the message with
-
println
Logs a message to the console.- Specified by:
println
in interfaceImmutableScript
- Parameters:
message
- The message to be logged.
-
print
Description copied from interface:ImmutableScript
Logs a formatted string.- Specified by:
print
in interfaceImmutableScript
- Parameters:
t
- the throwable to log
-
println
Logs a formatted string.- Specified by:
println
in interfaceImmutableScript
- Parameters:
format
- the format stringargs
- the arguments referenced by the format specifiers in the format string
-
getConfiguration
Gets the configurationScriptConfig
- Specified by:
getConfiguration
in 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:
isBackgroundScript
in interfaceImmutableScript
-
delay
public void delay(long ms) -
delayUntil
-
delayUtil
-
getInput
- Specified by:
getInput
in interfaceItemInputProvider
-
getOutput
- Specified by:
getOutput
in interfaceItemOutputProvider
-
getDefinition
- Specified by:
getDefinition
in interfaceImmutableScript
-
getLog
public com.google.common.flogger.FluentLogger getLog()
-