How To Code a RuneScape Bot with RobotJS - Learn JavaScript by playing RuneScape 1/4

0 Просмотры
Издатель
This tutorial will teach you how to code a RuneScape bot using JavaScript. No prior programming experience required! This guide is for beginners. We'll use and the RobotJS library and use a technique called GUI automation.

* This tutorial is for educational purposes only *

Full tutorial playlist:

View the Source Code
GitHub repo:

Download Links
:
RobotJS:
Visual Studio Code:

Recommended JavaScript Resources
Eloquent JavaScript: or online edition at
W3Schools:

0:35 Disclaimer: Don't Cheat!
1:31 Using the browser console to run JavaScript
3:18 How to install
5:22 Using Notepad and PowerShell to write code
8:24 Using VSCode to write code
9:48 How to install RobotJS

A note on the "automatically install necessary tools" step of the installation:
If you already have Node installed, you can find the Additional Tools install link in the Start menu under "Node". Alternatively, you can install windows-build-tools from an elevated PowerShell or like this: npm install --global --production windows-build-tools
More details here: #building

In this tutorial series, I'm going to teach you how to program a simple Runescape bot in JavaScript. More specifically, we're going to be using and the RobotJS library to do GUI automation, and with those tools we're going to make a basic woodcutting bot. You don't need to have any prior programming experience to follow along. This tutorial is aimed at absolute beginners, so I'll be going slowly, showing you how to get everything set up, and explaining fundamental programming concepts as we go. So if you've ever been interested in programming or in JavaScript, this project should be a great place to get started.

JavaScript has always been a popular language with new programmers because it's very easy to get started with. All you need is a web browser. Every modern browser can run JavaScript.

So let's write your first line of code. If you're in Chrome, right-click anywhere on a web page and click Inspect. Then in the window that pops up, click on Console. You can do almost the exact same thing in Firefox or even the Edge browser.

This is the JavaScript console. You can write and execute JavaScript code from right here. If we type 3 + 4 and hit enter, you can see we get the expected result. You can also call a function like alert(‘Hello'); and when you hit enter, you can see a popup appear.

JavaScript is the language of frontend web development, so any programmer who wants to work on the web needs to be able to write JavaScript at some point. That's another reason why JavaScript is a good place to start learning, because most programmers will need to know it eventually anyway.

Now, for the woodcutting bot we're going to write, I'm going to teach you a technique called GUI automation. This is a technique where you write code to automate mouse movement and keyboard inputs, while using information from the screen to make decisions about what your code should do next. If you've seen my tutorial series on PyAutoGUI, we're using the same concepts here, except we'll be doing things in JavaScript instead of Python.

In order to use GUI automation, we won't be able to run our JavaScript code inside the browser. That's because browsers come with protections that prevent code from controlling a user's mouse and keyboard. This is a very good thing, because could you imagine if the websites you visited could control your mouse and that would be terrible. So we need some way to run our code as a desktop application that has permission to control our mouse and keyboard.

To do that, we'll be using , a very popular JavaScript runtime that's used by professional developers all the time.

Download and install from their website, The home page should give you a link to the recommended download for your platform. In my case that was the LTS 64-bit Windows Installer. When installing, you should click the checkbox to "Automatically install the necessary tools". If you don't, you'll get errors when we try to install the RobotJS library.

So that probably took a little while, but when it's finished, let's confirm it was installed correctly by using the terminal. On Windows, I prefer to use Git Bash, but you can also use PowerShell. Enter the command node --version and it'll output the installed version of node if it's installed correctly.

Continue with the written tutorial here:

My gear:
Категория
Приключения онлайн
Комментариев нет.
Яндекс.Метрика