public abstract class Script extends java.lang.Object implements IScript
Modifier and Type | Field and Description |
---|---|
static int[] |
BANKERS
An array of all the Banker NPC IDs.
|
static int[] |
BONES
An array of all the bone item IDs.
|
static int |
DIR_EAST |
static int |
DIR_NORTH |
static int |
DIR_NORTHEAST |
static int |
DIR_NORTHWEST |
static int |
DIR_SOUTH |
static int |
DIR_SOUTHEAST |
static int |
DIR_SOUTHWEST |
static int |
DIR_WEST |
static java.lang.String[] |
FIGHTMODES
An array containing: "Controlled", "Strength", "Attack", "Defence"
|
static int |
MAX_INV_SIZE
The maximum number of items the client's inventory can hold.
|
static java.lang.String[] |
SKILL
An array of all the skill names.
|
static java.lang.String[] |
SPELL
An array of all the spell names.
|
Constructor and Description |
---|
Script() |
Modifier and Type | Method and Description |
---|---|
void |
acceptTrade()
Attempts to accept the trade offer.
|
void |
addFriend(java.lang.String name) |
void |
addIgnore(java.lang.String name) |
void |
answer(int i)
Selects the quest menu option with the given position.
|
void |
atObject(int x,
int y)
Attempts to perform the primary action on the object at the given coordinates.
|
void |
atObject2(int x,
int y)
Attempts to perform the secondary action on the object at the given coordinates.
|
void |
attackNpc(int local_index)
Attempts to start melee combat with the NPC with the given local index.
|
void |
attackPlayer(int local_index)
Attempts to start melee combat with the given player.
|
void |
atWallObject(int x,
int y)
Attempts to perform the primary action on the boundary at the given coordinates.
|
void |
atWallObject2(int x,
int y)
Attempts to perform the secondary action on the boundary at the given coordinates.
|
void |
autohop(boolean veteran)
Hops to the next world in a predefined sequence.
|
int |
bankCount(int... ids)
Returns the number of items with the given ids(s) in the client's bank if the bank is visible.
|
void |
buyShopItem(int i,
int amount)
Attempts to buy the given number of the item at the given position from the visible shop.
|
boolean |
canCastSpell(int spell)
Returns true if the client has the required magic level and reagents to cast the given spell.
|
boolean |
canLogout()
Returns true if the client can log out.
|
void |
castOnGroundItem(int spell,
int item_id,
int item_x,
int item_y)
Casts a spell on a ground item.
|
void |
castOnItem(int spell,
int slot)
Casts the specified spell on the specified slot in the player's inventory.
|
void |
castOnSelf(int spell)
Casts a spell with the given id on the local player.
|
void |
closeBank()
Closes the client's bank.
|
void |
closeShop()
Attempts to close the shop screen.
|
void |
confirmTrade()
Attempts to confirm the trade offer.
|
int |
countNpcs()
Returns the number of NPCs visible to the this.
|
int |
countPlayers()
Returns the number of players visible to the this.
|
void |
declineTrade()
Attempts to decline the trade.
|
void |
deposit(int id,
int amount)
Attempts to deposit the given amount of the given item in the client's bank.
|
void |
disableKeys()
Disables keys used by the bot so they can be used by the script.
|
void |
disablePrayer(int prayer)
Attempts to disable a prayer.
|
int |
distanceTo(int x,
int y)
Returns the distance between the client and the tile at x, y.
|
static int |
distanceTo(int x1,
int y1,
int x2,
int y2)
Returns the distance between x1, y1 and x2, y2.
|
int |
distanceTo(java.awt.Point coordinate)
Returns the distance between the client and the tile at x, y.
|
void |
drawBoxAlphaFill(int x,
int y,
int width,
int height,
int trans,
int colour)
Draws a filled equiangular quadrilateral with transparency on the game.
|
void |
drawBoxFill(int x,
int y,
int width,
int height,
int colour)
Draws a filled equiangular quadrilateral on the game.
|
void |
drawBoxOutline(int x,
int y,
int width,
int height,
int colour)
Draws a 1px outline of a equiangular quadrilateral on the game.
|
void |
drawCircleFill(int x,
int y,
int radius,
int colour,
int trans)
Draws a filled circle with optional transparency (use 255 for solid) on the game.
|
void |
drawHLine(int x,
int y,
int length,
int colour)
Draws a horizontal 1px line on the game.
|
void |
drawImage(java.awt.Image image,
int start_x,
int start_y)
Draws an image on the game.
|
void |
drawString(java.lang.String str,
int x,
int y,
int size,
int colour)
Draws a string on the game's canvas.
|
void |
drawVLine(int x,
int y,
int length,
int colour)
Draws a vertical 1px line on the game.
|
void |
dropItem(int slot)
Attempts to drop an item in the client's inventory.
|
void |
enablePrayer(int prayer)
Attempts to enable a prayer.
|
void |
followPlayer(int server_index)
Attempts to start following the player with the given server index.
|
double |
getAccurateFatigue() |
double |
getAccurateXpForLevel(int skill)
Returns the client's experience in the given skill.
|
int[] |
getAllNpcById(int... ids)
Locates the nearest NPC with the given id(s).
|
int |
getBankId(int i) |
int |
getBankSize() |
int |
getBankStack(int i) |
int |
getCurrentLevel(int skill)
Returns the client's current level in the given skill.
|
int |
getEmptySlots()
Returns the number of unoccupied slots in the client's inventory.
|
int[] |
getEquippedItemIds() |
int |
getFatigue()
Returns the client's fatigue percentage.
|
int |
getFightMode()
Returns the client's combat style.
|
int |
getFriendCount() |
java.lang.String |
getFriendName(int i) |
int |
getGameHeight() |
int |
getGameWidth() |
int |
getGroundItemCount() |
int |
getGroundItemId(int index) |
int |
getHpPercent()
Returns the percentage of hitpoints the client has remaining.
|
int |
getIgnoredCount() |
java.lang.String |
getIgnoredName(int i) |
int |
getInventoryCount()
Returns the number of individual items in the client's inventory.
|
int |
getInventoryCount(int... ids)
Returns the total number of items in the client's inventory with the specified IDs.
|
int |
getInventoryId(int slot) |
int |
getInventoryIndex(int... ids)
Returns the position of the item with the given ID in the client's inventory.
|
int |
getInventoryStack(int slot) |
int |
getItemBasePrice(int slot)
Returns the approximate value of an item in the client's inventory.
|
static int |
getItemBasePriceId(int id) |
int[] |
getItemById(int... ids)
Locates the nearest ground item with the given id(s).
|
java.lang.String |
getItemCommand(int slot)
Returns the primary action ("eat", "bury") of an item in the client's inventory.
|
static java.lang.String |
getItemCommandId(int id) |
java.lang.String |
getItemDescription(int slot)
Returns the description (examine text) of an item in the client's inventory.
|
static java.lang.String |
getItemDescriptionId(int id) |
java.lang.String |
getItemName(int slot)
Returns the name of an item in the client's inventory.
|
static java.lang.String |
getItemNameId(int id) |
int |
getItemX(int index) |
int |
getItemY(int index) |
int |
getLevel(int skill)
Returns the client's level in the given skill.
|
int |
getLocalTradeItemCount() |
int |
getLocalTradeItemId(int i) |
int |
getLocalTradeItemStack(int i) |
int |
getMenuIndex(java.lang.String str)
Returns the position of the specified quest menu option, or -1 if the option could not be
found.
|
int[] |
getNpcById(int... ids)
Locates the nearest NPC with the given id(s).
|
int[] |
getNpcByIdNotTalk(int... ids)
Locates the nearest NPC with the given id(s).
|
int |
getNpcCombatLevel(int index)
Returns the combat level of the given NPC.
|
static int |
getNpcCombatLevelId(int id) |
java.lang.String |
getNpcDescription(int index)
Returns the description (examine text) of the given NPC.
|
static java.lang.String |
getNpcDescriptionId(int id) |
int |
getNpcId(int index) |
int[] |
getNpcInExtendedRadius(int id,
int start_x,
int start_y,
int latitude,
int longitude)
Locates the nearest NPC with the given id(s) within a radius.
|
int[] |
getNpcInRadius(int id,
int start_x,
int start_y,
int radius)
Locates the nearest NPC with the given id within a radius.
|
java.lang.String |
getNpcName(int index)
Returns the name of the given NPC.
|
static java.lang.String |
getNpcNameId(int id) |
int |
getNpcServerIndex(int local_index) |
int |
getNpcX(int index) |
int |
getNpcY(int index) |
int[] |
getObjectById(int... ids)
Locates the nearest object with the given id(s).
|
int |
getObjectCount() |
static java.lang.String |
getObjectDesc(int id) |
int |
getObjectId(int index) |
int |
getObjectIdFromCoords(int x,
int y)
Returns the id of the object at the given coordinates, or -1 if no object could be found.
|
static java.lang.String |
getObjectName(int id) |
int |
getObjectX(int index) |
int |
getObjectY(int index) |
int |
getOurTradedItemCount()
Deprecated.
use Script#getLocalTradeItemCount()
|
int[] |
getPlayerByName(java.lang.String name)
Locates the player with the given display name.
|
int[] |
getPlayerByPid(int server_index)
Deprecated.
Unreliable in comparison to
getPlayerByName(String) . |
int |
getPlayerCombatLevel(int local_index)
Returns the combat level of the given player.
|
int |
getPlayerDirection(int local_index)
Returns the direction the given player is facing.
|
java.lang.String |
getPlayerName(int local_index)
Returns the display name of the given player.
|
int |
getPlayerPID(int local_index)
Returns the server index of the given player.
|
int |
getPlayerX(int index) |
int |
getPlayerY(int index) |
static int |
getPrayerCount() |
static int |
getPrayerLevel(int i) |
static java.lang.String |
getPrayerName(int i) |
int |
getQuestCount() |
java.lang.String |
getQuestMenuOption(int i) |
java.lang.String |
getQuestName(int i) |
int |
getQuestStage(int questId)
Retrieves the quest stage for the specified quest ID.
|
int |
getRemoteTradeItemCount() |
int |
getRemoteTradeItemId(int i) |
int |
getRemoteTradeItemStack(int i) |
int |
getShopItemAmount(int i)
Returns the size of the stack the shop has for the item at the given shop position, starting at
0.
|
int |
getShopItemById(int id)
Returns the position of the item with the given id in the shop screen.
|
int |
getShopItemId(int i)
Returns the ID of the item at the given shop position, starting at 0.
|
int |
getSleepingFatigue()
Deprecated.
Use
getFatigue() . |
int |
getTheirTradedItemCount()
Deprecated.
use Script#getRemoteTradeItemCount()
|
int[] |
getWallObjectById(int... ids)
Locates the nearest boundary with the given id(s).
|
int |
getWallObjectCount() |
static java.lang.String |
getWallObjectDesc(int id) |
int |
getWallObjectId(int index) |
int |
getWallObjectIdFromCoords(int x,
int y)
Returns the id of the boundary at the given coordinates, or -1.
|
static java.lang.String |
getWallObjectName(int id) |
int |
getWallObjectX(int index) |
int |
getWallObjectY(int index) |
int |
getWorld()
Returns the world the client is logged in to.
|
int |
getX()
Returns the X position of the tile the client is standing on.
|
int |
getXpForLevel(int skill)
Returns the client's experience in the given skill.
|
int |
getY()
Returns the Y position of the tile the client is standing on.
|
boolean |
hasBankItem(int id)
Returns true if the client's bank contains at least one item with the given id if the bank is
visible.
|
boolean |
hasInventoryItem(int id)
Returns true if the client's inventory contains at least one item with the given ID.
|
boolean |
hasOtherTraded(int id,
int amount)
Returns true if the other player's trade offer contains at least the given number of the given
item.
|
boolean |
hasRemoteAcceptedTrade() |
void |
hop(int world)
Hops to the specified world.
|
static boolean |
inArray(int[] haystack,
int needle)
Returns true if the int[] contains the int.
|
boolean |
inCombat()
Returns true if the client is in combat.
|
void |
init(java.lang.String params)
Called when the Script is selected by the user - override it and use it to process the
parameters.
|
boolean |
isAtApproxCoords(int x,
int y,
int radius)
Returns true if the tile the client is standing on is within radius distance of x, y.
|
boolean |
isAuthentic()
Whether or not the server is configured to be authentic.
|
boolean |
isAutoLogin()
|
boolean |
isBanking()
Returns true if the bank screen is visible.
|
boolean |
isBatching()
New APOS function. On Coleslaw, returns whether or not we are currently batching.
|
static boolean |
isCastableOnGroundItem(int spell) |
static boolean |
isCastableOnInv(int spell) |
static boolean |
isCastableOnSelf(int spell) |
static boolean |
isCombatSpell(int spell) |
boolean |
isControllerSet() |
boolean |
isFriend(java.lang.String name) |
boolean |
isHpBarShowing() |
boolean |
isIgnored(java.lang.String name) |
boolean |
isInTradeConfirm()
Returns true if the trade confirm screen is visible.
|
boolean |
isInTradeOffer()
Returns true if the trade offer screen is visible.
|
boolean |
isItemAt(int id,
int x,
int y)
Returns true if there is a ground item with the specified id on the specified tile.
|
boolean |
isItemEquipped(int slot)
Returns true if the specified SLOT is equipped.
|
boolean |
isItemIdEquipped(int itemId)
Returns true if the specified itemId is equipped.
|
boolean |
isItemStackable(int slot) |
static boolean |
isItemStackableId(int id) |
boolean |
isItemTradable(int slot)
Returns true if an item in the client's inventory is tradeable.
|
static boolean |
isItemTradableId(int id) |
boolean |
isLoggedIn() |
boolean |
isNpcHpBarVisible(int index) |
boolean |
isNpcInCombat(int index) |
boolean |
isNpcTalking(int index) |
boolean |
isObjectAt(int x,
int y)
Returns true if the tile at the given coordinates contains an object.
|
boolean |
isPaintOverlay()
|
boolean |
isPlayerHpBarVisible(int index) |
boolean |
isPlayerInCombat(int local_index)
Returns true if the given player is in combat.
|
boolean |
isPlayerTalking(int local_index)
Returns true if the given player is talking.
|
boolean |
isPlayerWalking(int local_index)
Returns true if the given player is walking.
|
boolean |
isPrayerEnabled(int prayer)
Returns true if the specified prayer is enabled.
|
boolean |
isQuestComplete(int i) |
boolean |
isQuestMenu()
Returns true if a quest menu is visible.
|
boolean |
isReachable(int x,
int y)
Returns true if it is possible for the client to walk to x, y.
|
boolean |
isRendering()
|
boolean |
isShopOpen()
Returns true if the shop screen is visible.
|
boolean |
isSkilling()
Returns true if an icon is visible over the client's head.
|
boolean |
isSkipLines()
|
boolean |
isSleeping()
Returns true if the sleeping/fatigue screen is visible.
|
boolean |
isTalking() |
boolean |
isTricking()
Deprecated.
For internal use. Legacy.
|
boolean |
isWalking()
Returns true if the client is walking.
|
boolean |
isWithinArea(java.awt.Point northEast,
java.awt.Point southWest)
Returns true if we are within the given NE/SW coordinates.
|
boolean |
isWithinArea(java.awt.Point coord,
java.awt.Point[] points)
Returns true if the coordinate is within an area of points.
|
boolean |
isWithinArea(java.awt.Point searchCoord,
java.awt.Point northEast,
java.awt.Point southWest)
Returns true if the coordinate is within a basic square area, using North East and South West
coordinates.
|
void |
log(java.lang.String text)
Logs text to the console, bot log window, and OpenRSC applet.
|
void |
log(java.lang.String text,
java.lang.String rsTextColor)
Logs text to the console, bot log window, and OpenRSC applet with the specified @col@.
|
void |
logout()
Attempts to log the client out.
|
void |
mageNpc(int local_index,
int spell)
Attempts to cast a spell on the NPC with the given local index.
|
void |
magePlayer(int local_index,
int spell)
Attempts to cast a spell on the given player.
|
int |
main()
The bot will wait for the milliseconds main() returns before calling it again.
|
boolean |
next()
Types the next character of the setTypeLine or newline if it has reached the end of the String.
|
void |
offerItemTrade(int slot,
int amount)
Attempts to add items to the current trade offer.
|
void |
onChatMessage(java.lang.String msg,
java.lang.String name,
boolean mod,
boolean admin)
Called when a player speaks in public chat.
|
void |
onKeyPress(int keycode)
Called when the user presses a key on the keyboard and the client is the active window.
|
void |
onPrivateMessage(java.lang.String msg,
java.lang.String name,
boolean mod,
boolean admin)
Called when a player speaks in private chat.
|
void |
onServerMessage(java.lang.String str)
Called when a server message is sent, i.e "Welcome to RuneScape!".
|
void |
onTradeRequest(java.lang.String name)
Called when a trade request is recieved by your player.
|
void |
paint()
Called when the game is re-drawn.
|
void |
pickupItem(int id,
int x,
int y)
Takes an item from the ground by the item's id, x, y
|
void |
print(java.lang.String toPrint) |
int |
questMenuCount()
Returns the number of visible quest menu options.
|
java.lang.String[] |
questMenuOptions()
Returns an array of the visible quest menu options.
|
static int |
random(int min,
int max)
Generates a psuedo-random number.
|
void |
removeFriend(java.lang.String name) |
void |
removeIgnore(java.lang.String name) |
void |
removeItem(int slot)
Attemps to unequip an item in the client's inventory.
|
void |
sellShopItem(int i,
int amount)
Attempts to sell the given number of the item at the given position from the visible shop.
|
void |
sendPrivateMessage(java.lang.String msg,
java.lang.String name)
Attempts to send a private message to the player with the given display name.
|
void |
sendTradeRequest(int server_index)
Attempts to send a trade request to the player with the given server index.
|
void |
setAutoLogin(boolean flag)
Enables or disables autologin.
|
static void |
setController(Controller _controller)
Used internally by the bot to set
Controller , as that is what adapts APOS to
IdleRSC. |
void |
setFightMode(int style)
Sets the client's combat style.
|
void |
setPaintOverlay(boolean flag)
If paint_overlay is disabled,
paint() will not be called and the built-in bot
display (if any) will be hidden. |
void |
setPixel(int x,
int y,
int colour)
Sets a pixel on the game.
|
void |
setRendering(boolean flag)
When disabled (false), may cause the game to enter a non-standard (implemented by the bot) low
graphics mode.
|
void |
setSkipLines(boolean flag)
Some implementations support a low graphics mode that skips lines when rendering (usually
toggled by pressing F1).
|
void |
setTrickMode(boolean flag)
Enables or disables fatigue tricking, which is disabled by default.
|
void |
setTypeLine(java.lang.String str)
Sets the line to be typed by next().
|
static void |
sleep(int ms)
Deprecated.
Will cause the entire game to freeze when called in main()'s thread. The RSC
servers expect a ping every 5 seconds among other things, so use of this method is
definitely not recommended. If you find yourself using this, consider updating your code to
make use of System.currentTimeMillis() or System.nanoTime().
|
void |
stopScript()
Stops the script.
|
void |
takeScreenshot(java.lang.String file)
Attempts to save a screenshot with the specified file name in the Screenshots directory.
|
void |
talkToNpc(int local_index)
Attempts to start talking to the NPC with the given local index.
|
void |
thieveNpc(int local_index)
Attempts to pickpocket the NPC with the given local index.
|
void |
useItem(int slot)
Attempts to perform the primary action on an item in the client's inventory.
|
void |
useItemOnGroundItem(int item_slot,
int ground_id,
int ground_x,
int ground_y)
Uses an item based on its position in the players inventory with an item on the ground based on
its id, x position, y position.
|
void |
useItemOnObject(int item_id,
int object_id)
Uses an item by id with an object by id - only works if the player has the item, and the object
is within distance.
|
void |
useItemOnObject(int item_id,
int object_x,
int object_y)
Uses an item by id with the object at the specified coordinates.
|
void |
useItemOnWallObject(int slot,
int x,
int y)
Attempts to use an item in the client's inventory with the boundary at the given coordinates.
|
void |
useItemWithItem(int slot_1,
int slot_2)
Uses one item with another based on their positions in the player's inventory.
|
void |
useItemWithPlayer(int local_index,
int slot)
Attempts to use an item in the client's inventory with a player.
|
void |
useOnNpc(int local_index,
int slot)
Attempts to use an item in the client's inventory with a NPC.
|
void |
useSleepingBag()
Uses the client's sleeping bag.
|
void |
useSlotOnObject(int slot,
int object_x,
int object_y) |
void |
walkTo(int x,
int y)
Attempts to walk to the given x, y coordinates.
|
void |
wearItem(int slot)
Attempts to equip an item in the client's inventory.
|
void |
withdraw(int id,
int amount)
Attempts to withdraw the given amount of the given item from the client's bank.
|
void |
writeLine(java.lang.String str)
Prints a line of text in the in-game chat box and console.
|
public static final int[] BANKERS
public static final int[] BONES
public static java.lang.String[] SKILL
public static java.lang.String[] SPELL
public static final java.lang.String[] FIGHTMODES
public static final int MAX_INV_SIZE
public static final int DIR_NORTH
public static final int DIR_NORTHWEST
public static final int DIR_WEST
public static final int DIR_SOUTHWEST
public static final int DIR_SOUTH
public static final int DIR_SOUTHEAST
public static final int DIR_EAST
public static final int DIR_NORTHEAST
public static void setController(Controller _controller)
Controller
, as that is what adapts APOS to
IdleRSC._controller
- controllerpublic void init(java.lang.String params)
public int main()
public void paint()
public void onServerMessage(java.lang.String str)
onServerMessage
in interface IScript
str
- the message.public void onTradeRequest(java.lang.String name)
onTradeRequest
in interface IScript
name
- the display name of the player who sent the request.public void onChatMessage(java.lang.String msg, java.lang.String name, boolean mod, boolean admin)
onChatMessage
in interface IScript
msg
- the message.name
- the display name of the player who sent the message.mod
- true if the sender is a player moderator (silver crown).admin
- true if the sender is a Jagex moderator (gold crown).public void onPrivateMessage(java.lang.String msg, java.lang.String name, boolean mod, boolean admin)
onPrivateMessage
in interface IScript
msg
- the message.name
- the display name of the player who sent the message.mod
- true if the sender is a player moderator (silver crown).admin
- true if the sender is a jagex moderator (gold crown).public void onKeyPress(int keycode)
onKeyPress
in interface IScript
keycode
- the key pressed expressed as an integerdisableKeys()
public void disableKeys()
public void hop(int world)
world
- the world.public void autohop(boolean veteran)
veteran
- true to enable hopping to world onepublic int getWorld()
public void stopScript()
setAutoLogin(boolean)
public void logout()
public boolean isSleeping()
isSleeping
in interface IScript
public int getFatigue()
getFatigue
in interface IScript
public double getAccurateFatigue()
public int getX()
public int getY()
public boolean canLogout()
public boolean isTalking()
public boolean isHpBarShowing()
public boolean inCombat()
public boolean isWithinArea(java.awt.Point northEast, java.awt.Point southWest)
northEast
- The North East coordinate.southWest
- The South West coordinate.public boolean isWithinArea(java.awt.Point searchCoord, java.awt.Point northEast, java.awt.Point southWest)
searchCoord
- The coordinate to checknorthEast
- The North East coordinate.southWest
- The South West coordinate.public boolean isWithinArea(java.awt.Point coord, java.awt.Point[] points)
coord
- The coordinate to checkpoints
- The area of points to search withinpublic int distanceTo(java.awt.Point coordinate)
coordinate
- The X/Y coordinate to check the distance.public boolean isSkilling()
public boolean isWalking()
@Deprecated public boolean isTricking()
isTricking
in interface IScript
public void setTrickMode(boolean flag)
flag
- on/off@Deprecated public int getSleepingFatigue()
getFatigue()
.public void setTypeLine(java.lang.String str)
str
- the line.public boolean next()
public int getFightMode()
public void setFightMode(int style)
style
- the combat style's position in the list starting at 0.public int getLevel(int skill)
skill
- the skill's identifer (position in the list starting at 0).getCurrentLevel(int)
public int getCurrentLevel(int skill)
skill
- the skill's identifer (position in the list starting at 0).getLevel(int)
public int getXpForLevel(int skill)
skill
- the skill's identifer (position in the list starting at 0).public double getAccurateXpForLevel(int skill)
skill
- the skill's identifer (position in the list starting at 0).public int getHpPercent()
public void castOnSelf(int spell)
spell
- the spell's identifier (position in the list starting at 0).public void walkTo(int x, int y)
x
- the x position of the target tile.y
- the y position of the target tile.public int getInventoryCount()
public int getEmptySlots()
public int getInventoryCount(int... ids)
ids
- the IDs of the items to search for.public boolean hasInventoryItem(int id)
id
- the ID of the item to search for.public int getInventoryIndex(int... ids)
ids
- the identifiers of the items to search for.public void useSleepingBag()
public void log(java.lang.String text)
text
- Stringpublic void log(java.lang.String text, java.lang.String rsTextColor)
text
- StringrsTextColor
- -- the color of the text, such as "red" or "cya". Do not wrap in @'s.public int getGroundItemCount()
public int getGroundItemId(int index)
public int getItemX(int index)
public int getItemY(int index)
public int[] getItemById(int... ids)
ids
- the item id(s) to search for.public boolean isItemAt(int id, int x, int y)
id
- the item to search for.x
- the x position of the tile to examine.y
- the y position of the tile to examine.public boolean isAuthentic()
public boolean isItemEquipped(int slot)
slot
- the position of the item in the client's inventory, starting at 0.getInventoryIndex(int...)
public int[] getEquippedItemIds()
public boolean isItemIdEquipped(int itemId)
itemId
- the position of the item in the client's inventory, starting at 0.getInventoryIndex(int...)
public void useItem(int slot)
slot
- the position of the item in the client's inventory, starting at 0.getInventoryIndex(int...)
public void dropItem(int slot)
slot
- the position of the item in the client's inventory, starting at 0.public void wearItem(int slot)
slot
- the position of the item in the client's inventory, starting at 0.getInventoryIndex(int...)
public void removeItem(int slot)
slot
- the position of the item in the client's inventory, starting at 0.getInventoryIndex(int...)
public void useItemWithItem(int slot_1, int slot_2)
slot_1
- the position of the item in the client's inventory.slot_2
- the position of the item in the client's inventory.getInventoryIndex(int...)
public void castOnItem(int spell, int slot)
spell
- the spell's ID (position in the list starting at 0).slot
- the position of the item in the client's inventory, starting at 0.getInventoryIndex(int...)
public void pickupItem(int id, int x, int y)
id
- the id of the ground item.x
- the x position of the ground item.y
- the y position of the ground item.public void useItemOnGroundItem(int item_slot, int ground_id, int ground_x, int ground_y)
item_slot
- the position of the item in the players inventory, starting at 0.ground_id
- the id of the ground item.ground_x
- the x position of the ground item.ground_y
- the y position of the ground item.getItemById(int...)
,
getInventoryIndex(int...)
public void castOnGroundItem(int spell, int item_id, int item_x, int item_y)
spell
- the spell's position in the list starting at 0.item_id
- the item's id.item_x
- the item's x position.item_y
- the item's y position.getItemById(int...)
public void useItemOnObject(int item_id, int object_id)
item_id
- the ID of the item to use.object_id
- the ID of the object to use the item on.public void useItemOnObject(int item_id, int object_x, int object_y)
item_id
- the id of the item to use.object_x
- x tile of the object.object_y
- y tile of the object.public void useSlotOnObject(int slot, int object_x, int object_y)
public int[] getAllNpcById(int... ids)
ids
- the NPC id(s) to search for.getNpcById(int...)
,
getNpcByIdNotTalk(int...)
,
getNpcInExtendedRadius(int, int, int, int, int)
,
getNpcInRadius(int, int, int, int)
public int[] getNpcById(int... ids)
ids
- the NPC id(s) to search for.getAllNpcById(int...)
,
getNpcByIdNotTalk(int...)
,
getNpcInExtendedRadius(int, int, int, int, int)
,
getNpcInRadius(int, int, int, int)
public int[] getNpcByIdNotTalk(int... ids)
ids
- the NPC id(s) to search for.getAllNpcById(int...)
,
getNpcById(int...)
,
getNpcInExtendedRadius(int, int, int, int, int)
,
getNpcInRadius(int, int, int, int)
public final int[] getNpcInRadius(int id, int start_x, int start_y, int radius)
id
- the ID of the NPC to search for.start_x
- the center X of the circle area.start_y
- the center Y of the circle area.radius
- the radius of the circle area.getNpcInExtendedRadius(int, int, int, int, int)
,
getAllNpcById(int...)
,
getNpcById(int...)
,
getNpcByIdNotTalk(int...)
public int[] getNpcInExtendedRadius(int id, int start_x, int start_y, int latitude, int longitude)
id
- the ID of the NPC to search for.start_x
- the center X of the circle area.start_y
- the center Y of the circle area.latitude
- the distance east and west of center X's area.longitude
- the distance north and south of center Y's area.getNpcInRadius(int, int, int, int)
,
getAllNpcById(int...)
,
getNpcById(int...)
,
getNpcByIdNotTalk(int...)
public void attackNpc(int local_index)
local_index
- the NPC's local index.getNpcById(int...)
,
getAllNpcById(int...)
,
getNpcInRadius(int, int, int, int)
,
getNpcInExtendedRadius(int, int, int, int, int)
public void talkToNpc(int local_index)
local_index
- the NPC's local index.getNpcByIdNotTalk(int...)
public void thieveNpc(int local_index)
local_index
- the NPC's local index.getNpcById(int...)
,
getNpcInRadius(int, int, int, int)
,
getNpcInExtendedRadius(int, int, int, int, int)
public void mageNpc(int local_index, int spell)
local_index
- the NPC's local index.spell
- the spell's ID (position in the list starting at 0).getAllNpcById(int...)
public int getQuestStage(int questId)
questId
- the ID of the questpublic void useOnNpc(int local_index, int slot)
local_index
- the NPC's local index.slot
- the item's ID.getAllNpcById(int...)
,
getNpcByIdNotTalk(int...)
public boolean isQuestMenu()
public java.lang.String[] questMenuOptions()
public int questMenuCount()
public java.lang.String getQuestMenuOption(int i)
public int getMenuIndex(java.lang.String str)
str
- the string to compare to the visible options.public void answer(int i)
i
- the option's position in the list, starting at 0.getMenuIndex(String)
,
questMenuOptions()
public int[] getPlayerByName(java.lang.String name)
name
- the display name of the player to search for.@Deprecated public int[] getPlayerByPid(int server_index)
getPlayerByName(String)
.server_index
- the server index of the player to search for.public java.lang.String getPlayerName(int local_index)
local_index
- the player's local index.countPlayers()
public int getPlayerPID(int local_index)
local_index
- the player's local index.countPlayers()
,
getPlayerByName(String)
public int getNpcServerIndex(int local_index)
public int getPlayerX(int index)
public int getPlayerY(int index)
public int getPlayerDirection(int local_index)
local_index
- the player's local index.countPlayers()
,
getPlayerByName(String)
public int getPlayerCombatLevel(int local_index)
local_index
- the player's local index.countPlayers()
,
getPlayerByName(String)
public boolean isPlayerInCombat(int local_index)
local_index
- the player's local index.countPlayers()
,
getPlayerByName(String)
public boolean isPlayerHpBarVisible(int index)
public boolean isPlayerTalking(int local_index)
local_index
- the player's local index.countPlayers()
,
getPlayerByName(String)
public boolean isPlayerWalking(int local_index)
local_index
- the player's local index.countPlayers()
,
getPlayerByName(String)
public int countPlayers()
public void attackPlayer(int local_index)
local_index
- the player's local index.countPlayers()
,
getPlayerByName(String)
public void magePlayer(int local_index, int spell)
local_index
- the player's local index.spell
- the spell's identifier (position in the list starting at 0).countPlayers()
,
getPlayerByName(String)
public int[] getObjectById(int... ids)
ids
- the object id(s) to search for.public int getObjectCount()
public int getObjectId(int index)
public int getObjectX(int index)
public int getObjectY(int index)
public static java.lang.String getObjectName(int id)
public static java.lang.String getObjectDesc(int id)
public int getObjectIdFromCoords(int x, int y)
x
- the x position of the tile to examine.y
- the y position of the tile to examine.public boolean isObjectAt(int x, int y)
x
- the x position of the tile to examine.y
- the y position of the tile to examine.public void atObject(int x, int y)
x
- the x position of the object to interact with.y
- the y position of the object to interact with.getObjectById(int...)
,
atObject2(int, int)
public void atObject2(int x, int y)
x
- the x position of the object to interact with.y
- the y position of the object to interact with.getObjectById(int...)
,
atObject(int, int)
public int[] getWallObjectById(int... ids)
ids
- the boundary id(s) to search for.public int getWallObjectIdFromCoords(int x, int y)
x
- the x position of the tile to examine.y
- the y position of the tile to examine.public int getWallObjectCount()
public int getWallObjectId(int index)
public int getWallObjectX(int index)
public int getWallObjectY(int index)
public static java.lang.String getWallObjectName(int id)
public static java.lang.String getWallObjectDesc(int id)
public void atWallObject(int x, int y)
x
- the x position of the boundary to interact with.y
- the y position of the boundary to interact with.getWallObjectById(int...)
,
atWallObject2(int, int)
public void atWallObject2(int x, int y)
x
- the x position of the boundary to interact with.y
- the y position of the boundary to interact with.getWallObjectById(int...)
,
atWallObject(int, int)
public void useItemOnWallObject(int slot, int x, int y)
slot
- the position of the item in the client's inventory, starting at 0.x
- the x position of the boundary to interact with.y
- the y position of the boundary to interact with.public void deposit(int id, int amount)
id
- the id of the item to deposit.amount
- the number of the given item to deposit.public void withdraw(int id, int amount)
id
- the id of the item to withdraw.amount
- the number of the given item to withdraw.public int bankCount(int... ids)
ids
- the item id(s) to search for.public int getBankSize()
public int getBankId(int i)
public int getBankStack(int i)
public boolean hasBankItem(int id)
id
- the item to search for.public boolean isBanking()
public void closeBank()
public int distanceTo(int x, int y)
x
- the x position of the tile to compare to the client's position.y
- the y position of the tile to compare to the client's position.public static int distanceTo(int x1, int y1, int x2, int y2)
x1
- the first x coordinate.y1
- the first y coordinate.x2
- the second x coordinate.y2
- the second y coordinate.public boolean isAtApproxCoords(int x, int y, int radius)
x
- the x position of the comparison tile.y
- the y position of the comparison tile.radius
- the maximum distance between the client and x, y for the method to return true.public boolean isReachable(int x, int y)
x
- the x position of the comparison tile.y
- the y position of the comparison tile.public void enablePrayer(int prayer)
prayer
- the position of the prayer in the list, starting at 0.public void disablePrayer(int prayer)
prayer
- the position of the prayer in the list, starting at 0.public boolean isPrayerEnabled(int prayer)
prayer
- the position of the prayer in the list, starting at 0.public boolean isShopOpen()
public int getShopItemById(int id)
id
- the item id to search for.public void print(java.lang.String toPrint)
public int getShopItemId(int i)
i
- the position.public int getShopItemAmount(int i)
i
- the position of the item in the shop screen.getShopItemById(int)
public void buyShopItem(int i, int amount)
i
- the position of the item in the shop screen.amount
- the number to buy.public void sellShopItem(int i, int amount)
i
- the position of the item in the shop screen.amount
- the number to sell.public void closeShop()
public void sendTradeRequest(int server_index)
server_index
- the server index of the player to send the request to.getPlayerPID(int)
public void followPlayer(int server_index)
server_index
- the server index of the player to start following.getPlayerPID(int)
public void useItemWithPlayer(int local_index, int slot)
local_index
- the NPC's local index.slot
- the item's ID.getAllNpcById(int...)
,
getNpcByIdNotTalk(int...)
public boolean isInTradeOffer()
isInTradeConfirm()
public boolean isInTradeConfirm()
isInTradeOffer()
public void offerItemTrade(int slot, int amount)
slot
- the position of the item to offer in the client's inventory, starting at 0.amount
- the number of the given item to offer.public boolean hasOtherTraded(int id, int amount)
id
- the id of the item to search for.amount
- the number of the item to ensure is there.@Deprecated public int getOurTradedItemCount()
public int getLocalTradeItemCount()
public int getLocalTradeItemId(int i)
public int getLocalTradeItemStack(int i)
@Deprecated public int getTheirTradedItemCount()
public int getRemoteTradeItemCount()
public int getRemoteTradeItemId(int i)
public int getRemoteTradeItemStack(int i)
public boolean hasRemoteAcceptedTrade()
public void acceptTrade()
confirmTrade()
,
declineTrade()
public void confirmTrade()
acceptTrade()
,
declineTrade()
public void declineTrade()
acceptTrade()
,
confirmTrade()
public void drawString(java.lang.String str, int x, int y, int size, int colour)
str
- the string to draw.x
- the x position to start at.y
- the y position to start at.size
- the size of the text.colour
- the hex colour (24-bit RGB) of the text.public void drawHLine(int x, int y, int length, int colour)
x
- the x position to start at.y
- the y position to start at.length
- the length of the line in pixels.colour
- the hex colour (24-bit RGB) of the line.public void drawVLine(int x, int y, int length, int colour)
x
- the x position to start at.y
- the y position to start at.length
- the length of the line in pixels.colour
- the hex colour (24-bit RGB) of the line.public void drawBoxOutline(int x, int y, int width, int height, int colour)
x
- the x position to start at.y
- the y position to start at.width
- the width of the shape.height
- the height of the shape.colour
- the hex colour (24-bit RGB) of the shape.public void drawBoxFill(int x, int y, int width, int height, int colour)
x
- the x position to start at.y
- the y position to start at.width
- the width of the shape.height
- the height of the shape.colour
- the colour (24-bit RGB) of the shape.public void drawBoxAlphaFill(int x, int y, int width, int height, int trans, int colour)
x
- the x position to start at.y
- the y position to start at.width
- the width of the shape.height
- the height of the shape.trans
- transparency of the shape (255-0).colour
- the colour (24-bit RGB) of the shape.public void drawCircleFill(int x, int y, int radius, int colour, int trans)
x
- the x position of the centre of the circle.y
- the y position of the centre of the circle.radius
- the radius of the circle.colour
- the colour (24-bit RGB) of the shape.trans
- transparency of the shape (255-0).public void setPixel(int x, int y, int colour)
x
- the x position of the pixel.y
- the y position of the pixel.colour
- the colour (24-bit RGB) to set.public void drawImage(java.awt.Image image, int start_x, int start_y)
image
- the image to draw.start_x
- the x position to start drawing.start_y
- the y position to start drawing.public void writeLine(java.lang.String str)
str
- the text to print.public int countNpcs()
public int getNpcId(int index)
public int getNpcX(int index)
public int getNpcY(int index)
public boolean isNpcInCombat(int index)
public boolean isNpcTalking(int index)
public boolean isNpcHpBarVisible(int index)
public java.lang.String getNpcName(int index)
index
- the NPC's local index.public static java.lang.String getNpcNameId(int id)
public java.lang.String getNpcDescription(int index)
index
- the NPC's local index.public static java.lang.String getNpcDescriptionId(int id)
public int getNpcCombatLevel(int index)
index
- the NPC's local index.public static int getNpcCombatLevelId(int id)
public int getInventoryId(int slot)
public int getInventoryStack(int slot)
public java.lang.String getItemName(int slot)
slot
- the position of the item in the client's inventory, starting at 0.public static java.lang.String getItemNameId(int id)
public java.lang.String getItemDescription(int slot)
slot
- the position of the item in the client's inventory, starting at 0.public static java.lang.String getItemDescriptionId(int id)
public java.lang.String getItemCommand(int slot)
slot
- the position of the item in the client's inventory, starting at 0.public static java.lang.String getItemCommandId(int id)
public boolean isItemTradable(int slot)
slot
- the position of the item in the client's inventory, starting at 0.public static boolean isItemTradableId(int id)
public boolean isItemStackable(int slot)
public static boolean isItemStackableId(int id)
public int getItemBasePrice(int slot)
slot
- the position of the item in the client's inventory, starting at 0.public static int getItemBasePriceId(int id)
public boolean canCastSpell(int spell)
spell
- the spell's position in the list starting at 0.public void setAutoLogin(boolean flag)
flag
- on/offstopScript()
public boolean isAutoLogin()
setAutoLogin(boolean)
. This checks the set flag.public void setRendering(boolean flag)
flag
- the rendering flag.public boolean isRendering()
setRendering(boolean)
. This checks the set flag.public void setSkipLines(boolean flag)
flag
- the skip_lines flag.public boolean isSkipLines()
setSkipLines(boolean)
. This checks the set flag.public void setPaintOverlay(boolean flag)
paint()
will not be called and the built-in bot
display (if any) will be hidden. May be effected by the rendering flag setRendering(boolean)
.flag
- the paint_overlay flag.public boolean isPaintOverlay()
setPaintOverlay(boolean)
. This checks the set flag.public void takeScreenshot(java.lang.String file)
file
- the file name (excluding extension) to save the screenshot as.public static int random(int min, int max)
min
- lowest possible number to generate.max
- highest possible number to generate.public static boolean inArray(int[] haystack, int needle)
haystack
- int[] to search.needle
- int to search for.@Deprecated public static void sleep(int ms)
ms
- time in milliseconds to sleep for.public void sendPrivateMessage(java.lang.String msg, java.lang.String name)
msg
- the message to send.name
- the display name to send the private message to.public void addFriend(java.lang.String name)
public void removeFriend(java.lang.String name)
public void addIgnore(java.lang.String name)
public void removeIgnore(java.lang.String name)
public int getFriendCount()
public java.lang.String getFriendName(int i)
public int getIgnoredCount()
public java.lang.String getIgnoredName(int i)
public boolean isFriend(java.lang.String name)
public boolean isIgnored(java.lang.String name)
public boolean isLoggedIn()
public static boolean isCombatSpell(int spell)
public static boolean isCastableOnInv(int spell)
public static boolean isCastableOnGroundItem(int spell)
public static boolean isCastableOnSelf(int spell)
public static int getPrayerCount()
public static java.lang.String getPrayerName(int i)
public static int getPrayerLevel(int i)
public int getQuestCount()
public java.lang.String getQuestName(int i)
public boolean isQuestComplete(int i)
public int getGameWidth()
public int getGameHeight()
public boolean isBatching()
public boolean isControllerSet()