Splinterlands E-Sports Script V2 - For Next.Splinterlands - Tampermonkey Script

in Splinterlands11 days ago

As I previously shared, here is the updated version of the E-Sports script for Splinterlands, tailored for use with Tampermonkey. The script is designed to function seamlessly with the new design updates implemented on next.splinterlands.com.

In this new version, during team selection, you can now use the top number keys to switch between available mana values. For example, pressing '4' will toggle the selection for 4-mana cards.

ezgif-5-2cef0bbc41.gif

How to Use Tampermonkey Scripts

Installing Tampermonkey:

  • First, add the Tampermonkey extension to your browser. It is available for Chrome, Firefox, Microsoft Edge, Safari, and Opera.
    Once installed, you’ll see a new icon in your browser's toolbar, which indicates that Tampermonkey is active.

Adding a New Script:

  • Click the Tampermonkey icon in your toolbar and select “Create a new script…”.
    This will open the Tampermonkey script editor. Here, you can paste the script you want to use.

Pasting and Configuring the Script:

  • Copy the script provided above and paste it into the script editor.
    Modify the script’s header if necessary (e.g., updating the @match parameter to ensure it runs on the correct website).

Saving and Enabling the Script:

  • Click File > Save in the script editor to save your script.
    Ensure the script is enabled in Tampermonkey’s dashboard. You should see it listed with a green enabled toggle next to it.

Testing the Script:

  • Navigate to the website where the script should operate. In this case, next.splinterlands.com.
    Perform actions as usual and observe if the script behaves as expected, such as toggling card displays via keyboard shortcuts.

Troubleshooting:

  • If the script does not work, double-check the script’s @match URL and ensure it matches the website’s URL.
    Check for any errors in the browser's developer console (accessible via right-click > Inspect > Console) which can provide clues about what might be going wrong.
// ==UserScript==
// @name         SL E-Sports
// @namespace    -
// @version      0.2
// @description  Splinterlands Trigger Events on Battlescreen via Keyboard
// @author       @louis88 / Legendary Dragons
// @match        https://next.splinterlands.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=splinterlands.com
// @grant        none
// ==/UserScript==

window.onkeydown = function(event) {
    if (event.keyCode === 48) {
       document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/div[1] ", document, null, 9, null). singleNodeValue.click(); // 0 Mana Cards
    }
    if (event.keyCode === 49) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/div[2] ", document, null, 9, null). singleNodeValue.click(); // 1 Mana Cards
     }
     if (event.keyCode === 50) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/div[3] ", document, null, 9, null). singleNodeValue.click(); // 2 Mana Cards
     }
     if (event.keyCode === 51) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/div[4] ", document, null, 9, null). singleNodeValue.click(); // 3 Mana Cards
     }
     if (event.keyCode === 52) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/div[5] ", document, null, 9, null). singleNodeValue.click(); // 4 Mana Cards
     }
     if (event.keyCode === 53) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/div[6] ", document, null, 9, null). singleNodeValue.click(); // 5 Mana Cards
     }
     if (event.keyCode === 54) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/div[7] ", document, null, 9, null). singleNodeValue.click(); // 6 Mana Cards
     }
     if (event.keyCode === 55) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/div[8] ", document, null, 9, null). singleNodeValue.click(); // 7 Mana Cards
     }
     if (event.keyCode === 56) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/div[9] ", document, null, 9, null). singleNodeValue.click(); // 8 Mana Cards
     }
     if (event.keyCode === 57) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/div[10] ", document, null, 9, null). singleNodeValue.click(); // 9 Mana Cards
     }
    if (event.keyCode === 81) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[3]/div[2]/div[2] ", document, null, 9, null). singleNodeValue.click(); // Toggle Melee Cards
     }
    if (event.keyCode === 87) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[3]/div[2]/div[3] ", document, null, 9, null). singleNodeValue.click(); // Toggle Range Cards
     }
    if (event.keyCode === 69) {
        document.evaluate(" /html/body/div[1]/div[1]/div[1]/div/div[1]/div[2]/div[1]/div[2]/div/div/div[3]/div[2]/div[4] ", document, null, 9, null). singleNodeValue.click(); // Toggle Magic Cards
     }
    if (event.keyCode === 27) {
        document.evaluate(" /html/body/div[1]/div/div/div/div[1]/div[1]/div/ul[1]/li/div[1]/div[1]/div[2]/div[1]/button ", document, null, 9, null). singleNodeValue.click(); // Clear entire Board - Alert
     }
 };

Sort:  

This post has been supported by @Splinterboost with a 12% upvote! Delagate HP to Splinterboost to Earn Daily HIVE rewards for supporting the @Splinterlands community!

Delegate HP | Join Discord