Package org.dreambot.api.script
Class AbstractScript
- java.lang.Object
-
- org.dreambot.api.methods.MethodProvider
-
- org.dreambot.api.methods.MethodContext
-
- org.dreambot.api.script.AbstractScript
-
- All Implemented Interfaces:
java.lang.Runnable
,java.util.EventListener
,PaintListener
- Direct Known Subclasses:
TaskScript
public abstract class AbstractScript extends MethodContext implements java.lang.Runnable, PaintListener
Created with IntelliJ IDEA. User: NotoriousPP Date: 9/28/2014 Time: 5:49 PM
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.dreambot.api.methods.MethodProvider
MethodProvider.LogType
-
-
Constructor Summary
Constructors Constructor Description AbstractScript()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ScriptManager.State
getCurrentState()
ScriptManifest
getManifest()
RandomManager
getRandomManager()
java.lang.Thread
getRandomThread()
java.lang.String
getSDNName()
java.lang.String
getSDNParameters()
This is arbitrary data you've included in the SDN as a StringTile
getStartTile()
int
getStoreId()
java.lang.String
getThreadURL()
double
getVersion()
boolean
isPaused()
void
onExit()
Called when the script ends.GameState
onGameState(GameState gameState)
Deprecated.This will eventually be removed.abstract int
onLoop()
Called in cycles.void
onPaint(java.awt.Graphics graphics)
Handles the graphic for the script.void
onPaint(java.awt.Graphics2D graphics)
Handles the graphic for the script.void
onPause()
Called when the script is paused.void
onResume()
Called when the script is resumed.boolean
onSolverStart(RandomSolver solver)
Called during the random solver reset stage, before solver.onStart is called.void
onStart()
Called when the script starts.void
onStart(java.lang.String... params)
Called when the script is started with parametersvoid
registerMethodContext(Client client)
Registers the method context of the scriptvoid
run()
void
setState(ScriptManager.State state)
void
stop()
-
Methods inherited from class org.dreambot.api.methods.MethodContext
getBank, getCamera, getClan, getClientSettings, getColorPicker, getCombat, getDepositBox, getDialogues, getEmotes, getEquipment, getFairyRings, getFriends, getGameObjects, getGrandExchange, getGroundItems, getInventory, getKeyboard, getLoader, getLoginUtility, getMagic, getMap, getMenu, getMouse, getMouseKeys, getNpcs, getPlayers, getPlayerSettings, getPrayer, getQuests, getShop, getSkills, getSkillTracker, getTabs, getTrade, getWalking, getWidgets, getWorldHopper, getWorlds, registerContext
-
Methods inherited from class org.dreambot.api.methods.MethodProvider
addAccount, bulkImportAccounts, containsAccount, containsAccountWithEmail, deleteAccount, getClient, getLocalPlayer, isUserSponsor, isUserVIP, log, log, log, log, logError, logError, logInfo, logInfo, setRandomThread, sleep, sleep, sleepUntil, sleepUntil, sleepUntil, sleepWhile, sleepWhile, sleepWhile
-
-
-
-
Method Detail
-
getStartTile
public Tile getStartTile()
-
getRandomThread
public java.lang.Thread getRandomThread()
-
onStart
public void onStart()
Called when the script starts.
-
onStart
public void onStart(java.lang.String... params)
Called when the script is started with parameters
-
onSolverStart
public boolean onSolverStart(RandomSolver solver)
Called during the random solver reset stage, before solver.onStart is called. Must return true in order for the solver.onStart to be called, and the solver to begin.- Parameters:
solver
- The Random Solver that is about to be activated- Returns:
- True starts the solver, false will delay the start.
-
onLoop
public abstract int onLoop()
Called in cycles.
-
onExit
public void onExit()
Called when the script ends.
-
onPause
public void onPause()
Called when the script is paused.
-
onResume
public void onResume()
Called when the script is resumed.
-
onPaint
public void onPaint(java.awt.Graphics graphics)
Handles the graphic for the script.- Specified by:
onPaint
in interfacePaintListener
- Parameters:
graphics
- The Graphics instance sent from the canvas.
-
onPaint
public void onPaint(java.awt.Graphics2D graphics)
Handles the graphic for the script.- Specified by:
onPaint
in interfacePaintListener
- Parameters:
graphics
- The Graphics2D instance sent from the canvas.
-
onGameState
@Deprecated public GameState onGameState(GameState gameState)
Deprecated.This will eventually be removed. Please useGameStateListener
instead.Handles incoming game state changes.- Parameters:
gameState
- The most recent game state change to occur.
-
registerMethodContext
public final void registerMethodContext(Client client)
Registers the method context of the script- Parameters:
client
- The client
-
stop
public void stop()
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
isPaused
public boolean isPaused()
-
setState
public void setState(ScriptManager.State state)
-
getCurrentState
public ScriptManager.State getCurrentState()
-
getManifest
public final ScriptManifest getManifest()
-
getRandomManager
public RandomManager getRandomManager()
-
getVersion
public double getVersion()
-
getSDNName
public java.lang.String getSDNName()
-
getThreadURL
public java.lang.String getThreadURL()
-
getStoreId
public int getStoreId()
-
getSDNParameters
public java.lang.String getSDNParameters()
This is arbitrary data you've included in the SDN as a String
You can use this as a way to differentiate between scripts with a similar code base, such as a basic and advanced version, without needing to maintain two separate (but extremely similar) script repos/modules.
- Returns:
- The script parameters you've set on the SDN for this script, only shown during runs loaded from the SDN. If no parameters have been set, it'll return an empty string.
-
-