VSwitcher Scripting Guide

Write OSRS automation scripts in Java with a type-safe API.

1 Install client2 Create project3 Run
java
// Chop oak trees
v.sleep(600, 1200);
var tree = v.getTileObjects()
    .search("Oak");
tree.interact("Chop down");
v.sleepUntil(5000, () ->
    v.getLocalPlayer().hasAnimation());

Getting Started

From zero to your first VSwitcher script in minutes.

1. Install

Download VSwitcher from vswitcher.com and install Java 11+. Launch the client and log in.

2. First Script

java
// Log inventory items
Widget[] items = v.getInventory().search()
    .withAction("Eat", "Drop")
    .result();

for (Widget item : items) {
    v.log("Found: " + item.getName());
}
v.sleep(800, 1200);

3. Core Patterns

java
// Sleep (anti-ban)
v.sleep(300, 500);

// Wait for condition
v.sleepUntil(5000, () ->
    v.getLocalPlayer().getHealth() > 50);

// Search pattern (works for
// inventory, NPCs, objects)
NPC[] goblins = v.getNpcs().search()
    .withName("Goblin").result();

API Reference

21 categories · 241+ methods

CORECore functionality and essential methods for VSwitcher automation.8 methods
sleepsleepUntillog
INVENTORYHandles the player's inventory items, including item management and interactions.22 methods
searcheatdroppotalch
EQUIPMENTHandles the player's equipment and worn items.4 methods
searchhasEquippedunequip
PRAYERManages the player's prayer abilities and overhead prayers.11 methods
prayisPrayingflickflickPrayerOnprayOnInvoke
BANKHandles the player's bank actions including deposits, withdrawals, and bank management.24 methods
openwithdrawdepositInventorywithdrawXenterBankPin
COMBATHandles combat actions and checks.34 methods
attackNpcisInCombatspecsetTargetcastTargetattackPlayer
NPCHandles NPC interactions including combat, dialogue, and trading.7 methods
findNearestinvokesearch
WALKINGHandles walking and movement functions for navigation.16 methods
walkToisIdlenearEntitypacketWalksceneWalk
TILE OBJECTSHandles interactions with tile objects like trees, rocks, doors, and other game objects.7 methods
findNearestinvokesearch
VARIABLESStores and retrieves custom variables for script state management and data persistence.13 methods
setVargetVarsetBoolean
GAME STATEHandles general game state actions including world management, chat, and system information.16 methods
isLoggedInhopWorldlogoutgetGameWorldrunClientThread
WIDGETSHandles widget interactions for UI elements, interfaces, and game components.6 methods
getWidgetisWidgetVisiblesearch
DIALOGHandles dialogue window interactions including NPC conversations and option selection.9 methods
chooseOptionWithKeyboardisViewingOptions
TILE ITEMSHandles interactions with items on the ground including picking up, counting, and searching.7 methods
findNearesttakesearch
GENERALGeneral control functions for automation including script management and trigger control.6 methods
stopRunningScriptsscriptOnscriptOff
LOCAL PLAYERHandles functions related to the local player including animations and player state.1 methods
hasAnimation
VARBITSHandles retrieval of varbit values for game state information and quest progress.2 methods
getValuegetVarpValue
CALLBACKHandles function callbacks for timed actions and delayed execution.1 methods
afterTicks
GRAND EXCHANGEHandles Grand Exchange trading operations including buying, selling, and offer management.21 methods
openstartBuyOffercollectAllgetEmptySlotssearchInventory
TRADEHandles player-to-player trading operations including trade requests, offers, and trade management.16 methods
tradeofferAllacceptTrade
PLAYERHandles player search and interaction functionality for finding and interacting with other players.10 methods
findNearestisPlayerNearbysearch