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 methodssearcheatdroppotalch
EQUIPMENTHandles the player's equipment and worn items.4 methodssearchhasEquippedunequip
PRAYERManages the player's prayer abilities and overhead prayers.11 methodsprayisPrayingflickflickPrayerOnprayOnInvoke
BANKHandles the player's bank actions including deposits, withdrawals, and bank management.24 methodsopenwithdrawdepositInventorywithdrawXenterBankPin
COMBATHandles combat actions and checks.34 methodsattackNpcisInCombatspecsetTargetcastTargetattackPlayer
NPCHandles NPC interactions including combat, dialogue, and trading.7 methodsfindNearestinvokesearch
WALKINGHandles walking and movement functions for navigation.16 methodswalkToisIdlenearEntitypacketWalksceneWalk
TILE OBJECTSHandles interactions with tile objects like trees, rocks, doors, and other game objects.7 methodsfindNearestinvokesearch
VARIABLESStores and retrieves custom variables for script state management and data persistence.13 methodssetVargetVarsetBoolean
GAME STATEHandles general game state actions including world management, chat, and system information.16 methodsisLoggedInhopWorldlogoutgetGameWorldrunClientThread
WIDGETSHandles widget interactions for UI elements, interfaces, and game components.6 methodsgetWidgetisWidgetVisiblesearch
DIALOGHandles dialogue window interactions including NPC conversations and option selection.9 methodschooseOptionWithKeyboardisViewingOptions
TILE ITEMSHandles interactions with items on the ground including picking up, counting, and searching.7 methodsfindNearesttakesearch
GENERALGeneral control functions for automation including script management and trigger control.6 methodsstopRunningScriptsscriptOnscriptOff
LOCAL PLAYERHandles functions related to the local player including animations and player state.1 methodshasAnimation
VARBITSHandles retrieval of varbit values for game state information and quest progress.2 methodsgetValuegetVarpValue
CALLBACKHandles function callbacks for timed actions and delayed execution.1 methodsafterTicks
GRAND EXCHANGEHandles Grand Exchange trading operations including buying, selling, and offer management.21 methodsopenstartBuyOffercollectAllgetEmptySlotssearchInventory
TRADEHandles player-to-player trading operations including trade requests, offers, and trade management.16 methodstradeofferAllacceptTrade
PLAYERHandles player search and interaction functionality for finding and interacting with other players.10 methodsfindNearestisPlayerNearbysearch