Getting Started

From zero to your first VSwitcher script in minutes.

What is VSwitcher?

VSwitcher is an OSRS (Old School RuneScape) scripting client that lets you automate in-game actions using Java-based scripts. It provides a comprehensive API for interacting with the game — from inventory management and combat to banking and navigation.

This guide covers the VSwitcher scripting API. You'll learn how to read the docs, write your first script, and understand the core patterns that every script uses.

Installation

  1. Download VSwitcher from vswitcher.com
  2. Install Java 11+ if you don't have it
  3. Launch the VSwitcher client and log into your account
  4. Navigate to the Script Editor to start writing scripts

Tip: Make sure you're using a supported Java version. VSwitcher works best with Java 11 through 17.

Your First Script

Let's write a simple script that checks your inventory and logs what items you have. This covers the two most common operations: sleeping and inventory interaction.

java
// My first VSwitcher script
// This logs all items in your inventory

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

// Log each item
for (Widget item : items) {
    v.log("Found item: " + item.getName());
}

// Wait a bit before next action (human-like)
v.sleep(800, 1200);

// Check if inventory is full
if (v.getInventory().inventoryFull()) {
    v.log("Inventory is full!");
}

What's happening here?

  • v.getInventory().search() — Creates a search query for inventory items
  • .withAction() — Filters to items with specific right-click options
  • .result() — Executes the search and returns matching items
  • v.log() — Prints a message to the console for debugging
  • v.sleep(800, 1200) — Pauses for a random time between 800-1200ms

Core Concepts

Sleeping & Timing

Every script needs delays between actions to avoid detection and behave like a human player. Use v.sleep(min, max) for random delays and v.sleepUntil(timeout, condition) to wait for game state changes.

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

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

The v. Prefix

Almost every VSwitcher API call starts with v. — this is your entry point to the entire API. From v. you can access inventory, equipment, bank, NPCs, combat, navigation, and much more.

Search Pattern

Many APIs use a builder pattern: start a search, add filters, then get results. This is the same pattern across inventory, bank, NPCs, and objects.

java
// Inventory search
Widget[] food = v.getInventory().search()
    .withAction("Eat")
    .result();

// NPC search
NPC[] goblins = v.getNpcs().search()
    .withName("Goblin")
    .result();

// Object search
TileObject[] trees = v.getTileObjects().search()
    .withName("Tree")
    .withAction("Chop down")
    .result();

Important: Always add sleep delays between actions. Scripts that act too fast can be detected. Use v.sleep(min, max) with randomized values.