### GET /login command example Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example command to check login status. ```bash ./microbot-cli login ``` -------------------------------- ### Quick Start Example Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/README.md An example demonstrating how to query for a 'Banker' NPC and interact with it. ```java var banker = Microbot.getRs2NpcCache().query() .withName("Banker") .nearestOnClientThread(); if (banker != null) { banker.interact("Bank"); } ``` -------------------------------- ### Example Cache Setup Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Illustrates how to obtain instances of the various entity caches for use in queries. ```java var npcCache = Microbot.getRs2NpcCache(); var playerCache = Microbot.getRs2PlayerCache(); var tileItemCache = Microbot.getRs2TileItemCache(); var tileObjectCache = Microbot.getRs2TileObjectCache(); // Use .query() to build queries. ``` -------------------------------- ### GET /bank command example Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example command to check bank status. ```bash ./microbot-cli bank ``` -------------------------------- ### Quick Examples - Find player Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of finding a player by name. ```java // Find player playerCache.query().withName("PlayerName").nearest(); ``` -------------------------------- ### POST /bank/deposit command examples Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Examples of how to deposit items into the bank. ```bash ./microbot-cli bank deposit-all ./microbot-cli bank deposit "Logs" ``` -------------------------------- ### GET /login response example (logged in) Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example JSON response when the user is logged in. ```json { "loggedIn": true, "gameState": "LOGGED_IN", "loginAttemptActive": false, "loginDurationMs": 120000, "activeProfile": { "name": "player@email.com", "isMember": true, "selectedWorld": 360 }, "currentWorld": 360 } ``` -------------------------------- ### CLI Example: Describe Widget Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example of using the microbot-cli to get the widget tree under a specific widget. ```bash ./microbot-cli widgets describe 134 0 --depth 3 ``` -------------------------------- ### GET /login response example (normal login screen) Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example JSON response when on the normal login screen. ```json { "loggedIn": false, "gameState": "LOGIN_SCREEN", "loginAttemptActive": false, "loginIndex": 0, "activeProfile": { "name": "player@email.com", "isMember": true, "selectedWorld": 360 }, "currentWorld": 360 } ``` -------------------------------- ### GET /dialogue command example Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example command to check dialogue status. ```bash ./microbot-cli dialogue ``` -------------------------------- ### POST /walk command examples Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Examples of how to use the ./microbot-cli walk command with different parameters. ```bash ./microbot-cli walk 3100 3500 ./microbot-cli walk 3100 3500 1 ./microbot-cli walk 3100 3500 --wait --timeout 120 ``` -------------------------------- ### Example: Navigate a settings interface Source: https://github.com/chsami/microbot/blob/main/docs/MICROBOT_CLI.md A step-by-step example of using the Microbot CLI to navigate a settings interface. ```bash # 1. Search for the settings widget ./microbot-cli widgets search "settings" # 2. Click to open settings ./microbot-cli widgets click --text "Settings" # 3. Search for the specific toggle ./microbot-cli widgets search "notification,pop-up" # 4. Describe the widget tree around the match ./microbot-cli widgets describe 134 42 --depth 2 # 5. Click the toggle ./microbot-cli widgets click 134 42 ``` -------------------------------- ### POST /bank/open command example Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example command to open the nearest bank. ```bash ./microbot-cli bank open ``` -------------------------------- ### Usage Examples for test-loop.sh Source: https://github.com/chsami/microbot/blob/main/docs/AGENTIC_TESTING_LOOP.md These examples demonstrate how to execute the `test-loop.sh` script with different target scripts and iteration counts. ```bash ./scripts/test-loop.sh ExampleScript 5 ./scripts/test-loop.sh MyWoodcuttingScript 3 ``` -------------------------------- ### Quick Examples - Find object Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of finding the nearest tile object by name. ```java // Find object tileObjectCache.query().withName("Tree").nearest(); ``` -------------------------------- ### POST /login command example Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example cURL command to trigger a login. ```bash # Block until logged in (default, up to 30s) curl -X POST -H 'Content-Type: application/json' \ -d '{"world": 360}' http://127.0.0.1:8081/login ``` -------------------------------- ### HTTP Example: Get NPC by Name Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example of making an HTTP call to get NPC information. ```bash curl http://127.0.0.1:8081/npcs?name=Banker ``` -------------------------------- ### POST /scripts/start Request Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example cURL command to start a plugin by its class name. ```bash curl -X POST -H 'Content-Type: application/json' \ -d '{"className":"net.runelite.client.plugins.microbot.example.ExamplePlugin"}' \ http://127.0.0.1:8081/scripts/start ``` -------------------------------- ### CLI Example: Search Widgets Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example of using the microbot-cli to search visible widgets by keywords. ```bash ./microbot-cli widgets search "notification,level-up" ``` -------------------------------- ### Transition Definition Example Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/statemachine/AGENTS.md Example of how to define a transition using the Transition builder. ```java Transition.from(S).when(supplier, "expr").because("reason").goTo(S) ``` -------------------------------- ### CLI Example: List Widgets Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example of using the microbot-cli to list all visible root-level widget interfaces. ```bash ./microbot-cli widgets list ``` -------------------------------- ### GET /dialogue response example Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example JSON response for the GET /dialogue endpoint. ```json { "inDialogue": true, "hasContinue": false, "hasOptions": true, "question": "What would you like?", "options": ["Buy sword", "Sell items", "Goodbye"] } ``` -------------------------------- ### Entity Guide Format Source: https://github.com/chsami/microbot/blob/main/docs/entity-guides/README.md The standard format for each entity guide, including an example of how to present code snippets for 'wrong way' vs. 'right way'. ```markdown ## N. **Why this matters:** **Pattern to follow:** **Where this applies:** **Defensive check:** ``` -------------------------------- ### GET /login response example (non-member on members world) Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example JSON response for a non-member account on a members world. ```json { "loggedIn": false, "gameState": "LOGIN_SCREEN", "loginIndex": 34, "loginError": "Non-member account cannot login to members world", "currentWorld": 360 } ``` -------------------------------- ### POST /dialogue/select command example Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example command to select a dialogue option. ```bash ./microbot-cli dialogue select "Buy sword" ``` -------------------------------- ### CLI Example: List Widgets with Limit Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example of using the microbot-cli to list widgets with a specified limit. ```bash ./microbot-cli widgets list --limit 50 ``` -------------------------------- ### POST /dialogue/continue command example Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example command to continue dialogue. ```bash ./microbot-cli dialogue continue ``` -------------------------------- ### GET /scripts Request Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example cURL command to list all microbot plugins. ```bash curl http://127.0.0.1:8081/scripts ``` -------------------------------- ### CLI Example: List NPCs Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example of using the microbot-cli to list NPCs. ```bash ./microbot-cli npcs --name Banker ``` -------------------------------- ### Run Shaded Jar Source: https://github.com/chsami/microbot/blob/main/docs/installation.md Command to run the shaded jar after installing Java 17+. ```bash java -jar client--SNAPSHOT-shaded.jar ``` -------------------------------- ### Quick Examples - Find ground item Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of finding the nearest ground item by name. ```java // Find ground item tileItemCache.query().withName("Coins").nearest(); ``` -------------------------------- ### Get All Matching Entities as List Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of retrieving all entities that match the query criteria into a list. ```java List guards = npcCache.query() .withName("Guard") .toList(); ``` -------------------------------- ### Quick Examples - Find nearest NPC Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of finding the nearest NPC by name. ```java // Find nearest NPC pcCache.query().withName("Banker").nearest(); ``` -------------------------------- ### POST /bank/withdraw command example Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example command to withdraw items from the bank. ```bash ./microbot-cli bank withdraw "Pure essence" 28 ``` -------------------------------- ### Configuration Example Source: https://github.com/chsami/microbot/blob/main/docs/MICROBOT_CLI.md Example of overriding the default port for the Agent Server. ```bash MICROBOT_PORT=9090 ./microbot-cli state ``` -------------------------------- ### Example: Talk to an NPC Source: https://github.com/chsami/microbot/blob/main/docs/MICROBOT_CLI.md A step-by-step example of using the Microbot CLI to interact with an NPC. ```bash # 1. Find the NPC ./microbot-cli npcs --name "Shop keeper" # 2. Talk to them ./microbot-cli npcs interact "Shop keeper" "Talk-to" # 3. Read the dialogue ./microbot-cli dialogue # 4. Click through dialogue ./microbot-cli dialogue continue # 5. Select an option ./microbot-cli dialogue select "What do you have for sale?" ``` -------------------------------- ### GET /profiles Request Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example cURL command to list all non-internal profiles. ```bash curl http://127.0.0.1:8081/profiles ``` -------------------------------- ### Quick Examples - Complex query Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of a complex query involving name, a predicate, distance limit, and finding the nearest result. ```java // Complex query pcCache.query() .withName("Guard") .where(npc -> !npc.isInteracting()) .within(10) .nearest(); ``` -------------------------------- ### POST /bank/close command example Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example command to close the bank. ```bash ./microbot-cli bank close ``` -------------------------------- ### Example: Mine copper ore and bank it Source: https://github.com/chsami/microbot/blob/main/docs/MICROBOT_CLI.md A step-by-step example of using the Microbot CLI to mine copper ore and bank it. ```bash # 1. Check current state ./microbot-cli state # 2. Walk to mining area ./microbot-cli walk 3285 3365 # 3. Find copper rocks ./microbot-cli objects --name "Copper rocks" --distance 10 # 4. Mine ./microbot-cli objects interact "Copper rocks" "Mine" # 5. Check if inventory is full ./microbot-cli inventory # 6. Walk to bank ./microbot-cli walk 3269 3167 # 7. Open bank and deposit ./microbot-cli bank open ./microbot-cli bank deposit-all # 8. Close bank and repeat ./microbot-cli bank close ``` -------------------------------- ### Example Performance Test Results Output Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/test/java/net/runelite/client/plugins/microbot/example/INTEGRATION_TEST_GUIDE.md This is an example of the console output format for performance test results. It includes metrics like total GameObjects, compositions retrieved, time taken, and average time per object. ```text [INFO] Performance Test Results: [INFO] Total GameObjects: 1234 [INFO] Compositions retrieved: 1234 [INFO] Time taken: 234 ms [INFO] Average time per object: 189 μs ``` -------------------------------- ### Register handler in AgentServerPlugin.startUp() Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example of how to register a new handler in the AgentServerPlugin. ```java handlers.add(new MyHandler(gson)); ``` -------------------------------- ### Login with Custom Timeout Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example of logging in with a specific timeout value. ```bash curl -X POST -H 'Content-Type: application/json' \ -d '{"world": 360, "timeout": 60}' http://127.0.0.1:8081/login ``` -------------------------------- ### Client-Thread Lookup Result Example Source: https://github.com/chsami/microbot/blob/main/docs/MICROBOT_CLI.md Example of the output format for a client-thread lookup, showing the method, evidence types, caller count, and verdict. ```text net.runelite.api.ItemContainer.getItems(): Item[] Evidence: ASSERT,LAMBDA,SUBSCRIBE Callers : 20 Verdict : REQUIRED (asserted) ``` -------------------------------- ### Run Maven Clean Install Source: https://github.com/chsami/microbot/wiki/Building-with-IntelliJ-IDEA Use this command to resolve client startup issues by cleaning and reinstalling the project. The `-DskipTests` flag bypasses test execution, and `-U` forces an update of changed or missing snapshots. ```bash clean install -DskipTests -U ``` -------------------------------- ### get Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2GameObject.md Retrieves a game object by name, with an option for exact matching. ```APIDOC ## get ### Description Retrieves a game object by name, with an option for exact matching. ### Signature `public static GameObject get(String name, boolean exact)` ``` -------------------------------- ### Query by Multiple Names Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of finding an entity that matches any of the provided names. ```java Rs2NpcModel npc = npcCache.query() .withNames("Banker", "Bank clerk", "Bank assistant"); ``` -------------------------------- ### First Matching NPC Query Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of retrieving the first NPC that matches the query criteria. ```java Rs2NpcModel npc = npcCache.query() .withName("Guard") .first(); ``` -------------------------------- ### Get plugin status Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example of how to get the status of a specific plugin using a cURL command. ```bash curl 'http://127.0.0.1:8081/scripts/status?className=net.runelite.client.plugins.microbot.example.ExamplePlugin' ``` -------------------------------- ### POST /scripts/start Response Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md JSON response structure for starting a script. ```json { "success": true, "name": "Micro Example", "className": "net.runelite.client.plugins.microbot.example.ExamplePlugin", "status": "RUNNING", "startedAt": "2026-04-06T12:00:00Z" } ``` -------------------------------- ### Getting a Snapshot Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SCRIPT_TOOLS.md Command to retrieve a state machine snapshot via HTTP. ```bash curl -s http://127.0.0.1:8081/debug/snapshot | python3 -m json.tool ``` -------------------------------- ### Quick Start Commands Source: https://github.com/chsami/microbot/blob/main/docs/MICROBOT_CLI.md Basic commands to check server state, view inventory, find NPCs, interact with them, and walk. ```bash # Check if the server is reachable and the player is logged in ./microbot-cli state # See what's in the inventory ./microbot-cli inventory # Find nearby NPCs ./microbot-cli npcs --name Guard --distance 15 # Attack the nearest guard ./microbot-cli npcs interact "Guard" "Attack" # Eat a lobster ./microbot-cli inventory interact "Lobster" "Eat" # Walk somewhere ./microbot-cli walk 3222 3218 ``` -------------------------------- ### Client-Thread Lookup Examples Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SCRIPT_TOOLS.md Demonstrates various ways to use the client-thread lookup tool, including exact method name, substring match, evidence kind filtering, and JSON output. ```bash # Exact method name ./microbot-cli ct Player.getName ``` ```bash # Substring match ./microbot-cli ct getItem --like ``` ```bash # Filter by evidence kind ./microbot-cli ct getItems --evidence ASSERT ``` ```bash # JSON output for programmatic use ./microbot-cli ct getItems --json ``` -------------------------------- ### Increase Client Initialization Wait Time Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/test/java/net/runelite/client/plugins/microbot/example/INTEGRATION_TEST_GUIDE.md Modify the setUp() method in the test to increase the Thread.sleep duration. This can resolve 'Client not initialized' errors by giving the client more time to start. ```java // In setUp() method, increase from 5000 to 10000: Thread.sleep(10000); // Give client more time to initialize ``` -------------------------------- ### openSettings Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2Settings.md Opens the main settings interface. ```APIDOC ## openSettings ### Description Opens the main settings interface. ### Signature `public static boolean openSettings()` ### Parameters None ### Returns `boolean` - Indicates if the operation was successful. ``` -------------------------------- ### Fluent Chaining Example Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Demonstrates how to chain multiple filter and retrieval methods for building complex queries. ```java npcCache.query() .withName("Guard") // Filter by name .where(npc -> !npc.isInteracting()) // Add custom filter .within(15) // Within 15 tiles .nearest(); // Get nearest match ``` -------------------------------- ### Compile Client with Gradle (Bash) Source: https://github.com/chsami/microbot/blob/main/docs/AGENTIC_TESTING_LOOP.md Command to compile the Java client using Gradle. Standard error is redirected to standard output. ```bash ./gradlew :client:compileJava 2>&1 ``` -------------------------------- ### Connection Error Response Example Source: https://github.com/chsami/microbot/blob/main/docs/MICROBOT_CLI.md Example of a JSON response for a connection error. ```json {"error": "Connection refused - is the Agent Server plugin enabled?"} ``` -------------------------------- ### loadFromInventorySetup Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2RunePouch.md Attempts to load the specified runes into the rune pouch using fuzzy logic where applicable (e.g. from Inventory Setups). ```APIDOC ## loadFromInventorySetup ### Description Attempts to load the specified runes into the rune pouch using fuzzy logic where applicable (e.g. from Inventory Setups). ### Signature public static boolean loadFromInventorySetup(Map inventorySetupRunes) ### Parameters #### Path Parameters - **inventorySetupRunes** (Map) - Required - A map of runes and their associated InventorySetupsItem for loading. ### Returns - boolean: True if the runes were successfully loaded, false otherwise. ``` -------------------------------- ### Performance Tip: Use Method References Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of using method references for cleaner and potentially faster filter predicates. ```java // Good - cleaner and potentially faster tileItemCache.query() .where(Rs2TileItemModel::isLootAble) .nearest(); ``` -------------------------------- ### Action Response Example Source: https://github.com/chsami/microbot/blob/main/docs/MICROBOT_CLI.md Example of a JSON response for an action, indicating success or failure. ```json {"success": true, "action": "Attack", "npc": {"name": "Guard", "id": 3010}} ``` ```json {"success": false, "reason": "NPC not found"} ``` -------------------------------- ### Performance Tip: Use Specific Filters Early Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of using specific filters early in the query for better performance. ```java // Good - filters by name first pcCache.query() .withName("Guard") .where(npc -> !npc.isInteracting()) .nearest(); ``` -------------------------------- ### JSON Response Example Source: https://github.com/chsami/microbot/blob/main/docs/MICROBOT_CLI.md Example of a JSON response for a successful query returning structured data. ```json { "count": 3, "total": 3, "npcs": [ {"id": 3010, "name": "Guard", "combatLevel": 21, "distance": 5, "position": {"x": 3215, "y": 3219, "plane": 0}} ] } ``` -------------------------------- ### Run Integration Tests with Maven Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/test/java/net/runelite/client/plugins/microbot/example/README.md Execute the integration tests for ExamplePluginIntegrationTest using Maven. This command requires specifying OSRS credentials and membership status. ```bash mvn test -DskipTests=false \ -Dtest=ExamplePluginIntegrationTest \ -Dtest.username=your_username \ -Dtest.password=your_password \ -Dtest.isMember=true ``` -------------------------------- ### Migration Step 1: Replace direct method calls Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/api/QUERYABLE_API.md Example of replacing a legacy NPC fetching method with the Queryable API. ```java // Before NPC banker = Rs2Npc.getNpc("Banker"); // After Rs2NpcModel banker = npcCache.query().withName("Banker"); ``` -------------------------------- ### Activate Microbot Test Harness Source: https://github.com/chsami/microbot/blob/main/docs/AGENTIC_TESTING_LOOP.md Use JVM system properties to enable test mode, specify the script, set a timeout, and define the output directory. No code changes are required. ```bash java -jar microbot.jar \ -Dmicrobot.test.mode=true \ -Dmicrobot.test.script=ExampleScript \ -Dmicrobot.test.timeout=120000 \ -Dmicrobot.test.output=~/.runelite/test-results ``` -------------------------------- ### Simulate Typing and Key Presses Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2Keyboard.md Demonstrates common keyboard actions including typing a string, pressing a single character, holding and releasing the shift key, and simulating an enter key press. Also shows how to check if a key is currently pressed. ```java Rs2Keyboard.typeString("Hello, world!"); ``` ```java Rs2Keyboard.keyPress('a'); ``` ```java Rs2Keyboard.holdShift(); ``` ```java Rs2Keyboard.releaseShift(); ``` ```java Rs2Keyboard.enter(); ``` ```java boolean isShiftPressed = Rs2Keyboard.isKeyPressed(KeyEvent.VK_SHIFT); ``` -------------------------------- ### Run Full Fail-Fast Suite Source: https://github.com/chsami/microbot/blob/main/docs/F2P_WEBWALKER_HARNESS.md Command to execute the complete F2P Web Walker Harness suite. ```bash scripts/run-f2p-webwalker-harness.sh ``` -------------------------------- ### Correct Maven Command with Credentials Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/test/java/net/runelite/client/plugins/microbot/example/INTEGRATION_TEST_GUIDE.md Demonstrates the correct way to pass username and password arguments to the Maven test command. This is crucial for authentication during integration tests. ```bash mvn test -DskipTests=false \ -Dtest=ExamplePluginIntegrationTest \ -Dtest.username=myuser \ -Dtest.password=mypass ``` -------------------------------- ### getY Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2WorldPoint.md Gets the Y coordinate of the Rs2WorldPoint. ```APIDOC ## getY ### Description Gets the Y coordinate of the `Rs2WorldPoint`. ### Signature `public int getY()` ``` -------------------------------- ### get Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2Inventory.md Retrieves an item by ID. ```APIDOC ## get ### Description Retrieves an item by ID. ### Parameters #### Request Body - **id** (`int`) - Required - The item's ID. ### Returns `Rs2Item` - The item, or null if not found. ``` -------------------------------- ### PreMapLoad Event Source: https://github.com/chsami/microbot/blob/main/docs/client-thread-manifest.md Fired just before the game map is loaded. ```APIDOC ## `net.runelite.api.events.PreMapLoad` ### Description This event is triggered just before the game map is loaded. ### Methods - `getScene(): Scene` - Returns the current scene object. ``` -------------------------------- ### Rs2Settings Methods Source: https://github.com/chsami/microbot/blob/main/docs/client-thread-manifest.md Provides utility for interacting with game settings. ```APIDOC ## Rs2Settings ### Description Provides utility for interacting with game settings. ### Methods - `findSettingsSearchClickable(String[]): Widget` ``` -------------------------------- ### getX Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2WorldPoint.md Gets the X coordinate of the Rs2WorldPoint. ```APIDOC ## getX ### Description Gets the X coordinate of the `Rs2WorldPoint`. ### Signature `public int getX()` ``` -------------------------------- ### Build & Run Commands Source: https://github.com/chsami/microbot/blob/main/docs/development.md Common Gradle commands for compiling, running, building, cleaning, and testing the project. ```bash ./gradlew :client:compileJava ``` ```bash ./gradlew :client:run ``` ```bash ./gradlew buildAll ``` ```bash ./gradlew cleanAll ``` ```bash ./gradlew :client:runUnitTests ``` ```bash ./gradlew :client:runIntegrationTest ``` ```bash ./gradlew :client:assemble ``` -------------------------------- ### getPlane Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2WorldPoint.md Gets the plane (height level) of the Rs2WorldPoint. ```APIDOC ## getPlane ### Description Gets the plane (height level) of the `Rs2WorldPoint`. ### Signature `public int getPlane()` ``` -------------------------------- ### getAveragePrice Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2GrandExchange.md Gets the average price of an item over a specified time interval. ```APIDOC ## getAveragePrice ### Description Gets average price over a specific time period using time-series data. ### Method public static int getAveragePrice(int itemId, TimeSeriesInterval interval) ### Parameters #### Path Parameters - **itemId** (int) - Required - The ID of the item. - **interval** (TimeSeriesInterval) - Required - The time series interval. ### Response #### Success Response (int) - The average price of the item. ``` -------------------------------- ### getAveragePrice Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2GrandExchange.md Gets the average price of an item on the Grand Exchange over the last hour. ```APIDOC ## getAveragePrice ### Description Gets average price over the last hour. ### Signature `public static int getAveragePrice(int itemId)` ``` -------------------------------- ### getTotalGemCount Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2Gembag.md Gets the total count of all gems currently stored in the gem bag. ```APIDOC ## getTotalGemCount ### Description Gets the total count of all gems currently stored in the gem bag. ### Signature `public static int getTotalGemCount()` ``` -------------------------------- ### Run on Client Thread Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/settings/AGENTS.md Example of how to run a method on the client thread, necessary for certain widget operations. ```java Microbot.getClientThread().runOnClientThreadOptional(...) ``` -------------------------------- ### Add a new endpoint Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md Example of how to create a new handler for an endpoint. ```java public class MyHandler extends AgentHandler { public MyHandler(Gson gson) { super(gson); } @Override public String getPath() { return "/my-endpoint"; } @Override protected void handleRequest(HttpExchange exchange) throws IOException { requireGet(exchange); // or requirePost // your logic sendJson(exchange, 200, result); } } ``` -------------------------------- ### openShop (by NPC name and exact match) Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2Shop.md Opens the shop interface by interacting with the specified NPC. ```APIDOC ## openShop (by NPC name and exact match) ### Description Opens the shop interface by interacting with the specified NPC. ### Method `public static boolean openShop(String npcName, boolean exact)` ``` -------------------------------- ### GET /scripts Response Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md JSON response structure for the /scripts endpoint. ```json { "count": 12, "scripts": [ {"name": "Micro Guard Killer", "className": "net.runelite.client.plugins.microbot.guardkiller.GuardKillerPlugin", "active": false, "enabled": false}, {"name": "Micro Example", "className": "net.runelite.client.plugins.microbot.example.ExamplePlugin", "active": true, "enabled": true} ] } ``` -------------------------------- ### GET /profiles Response Source: https://github.com/chsami/microbot/blob/main/docs/AGENT_SERVER.md JSON response structure for the /profiles endpoint. ```json { "count": 2, "activeProfile": "player@email.com", "profiles": [ { "name": "player@email.com", "isMember": true, "selectedWorld": "random-members", "active": true }, { "name": "alt-account@email.com", "isMember": false, "selectedWorld": 383, "active": false } ] } ``` -------------------------------- ### Run Test Client with Gradle (Bash) Source: https://github.com/chsami/microbot/blob/main/docs/AGENTIC_TESTING_LOOP.md Command to run a specific test script in the client using Gradle. It sets test mode, specifies the script name, and defines a timeout. The exit code is captured. ```bash ./gradlew :client:runTest \ -Dmicrobot.test.mode=true \ -Dmicrobot.test.script="Guard Killer Test" \ -Dmicrobot.test.timeout=120000 EXIT_CODE=$? ``` -------------------------------- ### Run Microbot with Xvfb Source: https://github.com/chsami/microbot/blob/main/docs/AGENTIC_TESTING_LOOP.md For headless environments like CI, use Xvfb to simulate a display. Set the DISPLAY environment variable before running the Microbot client. ```bash Xvfb :99 -screen 0 1280x720x24 & export DISPLAY=:99 java -jar microbot.jar -Dmicrobot.test.mode=true ... ``` -------------------------------- ### getOfferDetailsForCancellation Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2GrandExchange.md Provides enhanced slot management by getting detailed offer information before cancellation. ```APIDOC ## getOfferDetailsForCancellation ### Description Enhanced slot management: Gets detailed information about an offer before cancelling it. ### Method public static Map getOfferDetailsForCancellation(GrandExchangeSlots slot) ### Parameters #### Path Parameters - **slot** (GrandExchangeSlots) - Required - The Grand Exchange slot. ### Response #### Success Response (Map) - Detailed information about the offer for cancellation. ``` -------------------------------- ### getTotalTiles Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2Walker.md Gets the total amount of tiles to travel to destination. Returns Integer.MAX_VALUE if unreachable. ```APIDOC ## getTotalTiles ### Description Gets the total amount of tiles to travel to destination. Returns `Integer.MAX_VALUE` if unreachable. ### Signature `public static int getTotalTiles(WorldPoint destination)` ``` -------------------------------- ### Configure IntelliJ IDEA for Integration Tests Source: https://github.com/chsami/microbot/blob/main/runelite-client/src/test/java/net/runelite/client/plugins/microbot/example/README.md Set up VM options in IntelliJ IDEA's run configuration to provide OSRS credentials for integration tests. Remember to remove the @Ignore annotation from the test class. ```java -Dtest.username=your_username -Dtest.password=your_password -Dtest.isMember=true ``` -------------------------------- ### onWidgetLoaded Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2RunePouch.md Handles reading rune pouch loadouts from the bank interface widgets. ```APIDOC ## onWidgetLoaded ### Description Handles reading rune pouch loadouts from the bank interface widgets. ### Signature public static void onWidgetLoaded(WidgetLoaded ev) ### Parameters #### Path Parameters - **ev** (WidgetLoaded) - Required - The WidgetLoaded event object. ``` -------------------------------- ### itemBounds Source: https://github.com/chsami/microbot/blob/main/docs/api/Rs2DepositBox.md Gets the bounding rectangle for an item's slot within the deposit box. ```APIDOC ## itemBounds ### Description Gets the bounding rectangle for the slot of the specified item in the deposit box. ### Method `public static Rectangle itemBounds(Rs2ItemModel rs2Item)` ```