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

Поделиться
HTML-код
  • Опубликовано: 4 авг 2024
  • 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 Node.js and the RobotJS library and use a technique called GUI automation.
    * This tutorial is for educational purposes only *
    Full tutorial playlist: • Learn JavaScript by pl...
    View the Source Code
    GitHub repo: github.com/learncodebygaming/...
    Download Links
    Node.js: nodejs.org/
    RobotJS: robotjs.io/
    Visual Studio Code: code.visualstudio.com/download
    Recommended JavaScript Resources
    Eloquent JavaScript: amzn.to/3deUEfb or online edition at eloquentjavascript.net/
    W3Schools: www.w3schools.com/js/default.asp
    0:35 Disclaimer: Don't Cheat!
    1:31 Using the browser console to run JavaScript
    3:18 How to install Node.js
    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 Node.js 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 CMD.exe like this: npm install --global --production windows-build-tools
    More details here: www.npmjs.com/package/robotjs...
    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 Node.js 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 keyboard... 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 Node.js, a very popular JavaScript runtime that's used by professional developers all the time.
    Download and install Node.js from their website, nodejs.org. 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: learncodebygaming.com/blog/ho...
    Join me on Discord: / discord

Комментарии • 279

  • @davebudhc
    @davebudhc 4 года назад +70

    I was just in discord with my friends like, "I wish I could learn how to code a bot in RS just to learn java." One google search later, I find this man.

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +2

      Haha, that's awesome!

    • @piggiesgosqueal8066
      @piggiesgosqueal8066 4 года назад +16

      David Baxter worth noting that Java and JavaScript are two completely different languages.

    • @michaellk2254
      @michaellk2254 3 года назад

      Sucks for you. Because JavaScript is awful compared to java

    • @nick9198
      @nick9198 3 года назад +3

      @@michaellk2254 you suck

    • @dylanperri7508
      @dylanperri7508 2 года назад

      So violent men with that toxic masculinity get that out of here

  • @Vivezoz
    @Vivezoz Год назад +2

    This video took me from 0 javascript skills to being able to write some cool scripts, thank you so much for this video, would love to see more!

  • @OborCS
    @OborCS 3 года назад +6

    your personality gives me a very chill feeling, love the content

  • @free5370
    @free5370 4 года назад +16

    Just wanted to say thank you for these videos! You’re above most with your editing, a lot of tutorials are unwatchable because the people making them don’t ever zoom in on their screen so the viewer has to do guessing work 50% of the time
    Great video man

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +1

      Thank you, happy to hear that people appreciate the editing.

  • @jdubb6557
    @jdubb6557 3 года назад +14

    Yes!! This is EXACTLY what I needed to help me get into learning how to code. Instead of lesson after lesson I can implement my own fun ideas like this and still learn👍

    • @wikkidklown
      @wikkidklown 7 месяцев назад

      I completely agree

  • @mattdabl3363
    @mattdabl3363 3 года назад

    Instead of spending weekend with my friends I will watch this!!! Previous material about OpenCV was so enjoyable and made me to take advantaged from this one!

  • @mechanical00toaster
    @mechanical00toaster 4 года назад +2

    This video is really helpful! The way you teach is very clear and precise. Thank you!

  • @dirtindemand5743
    @dirtindemand5743 3 года назад +2

    thanks bro you are so generous with your knowledge. The world needs more people like you, really appreciate all this effort just to help out people! You're a champion mate.

  • @The8Music8Guy
    @The8Music8Guy Год назад

    Brilliant video! This has gotten me very excited to learn coding. On to the next video!

  • @matthewholton5812
    @matthewholton5812 3 года назад +1

    I am still a beginner and needed a coding project to help me learn and this is exactly what I was looking for.

  • @bgame1996
    @bgame1996 3 года назад

    This video is very well put together! Thank you for the lesson, you are a good teacher.

  • @HealthHabitsHQ.
    @HealthHabitsHQ. 4 года назад +1

    i have been looking for a JavaScript tutorial for bots for such a long time thank you :) please make more like this !!!!

  • @freeus6085
    @freeus6085 2 года назад +4

    Thank you for this!!!! I am a CS major and I've been looking for ways to combine my knowledge with my extracurricular activities so this was spot on! I usually have rs running in the background chatting and skilling while I'm doing my school work, listening to lectures, etc.. so this is a neat project to combine both of my passions video games especially my OG favorite runescape and my "adulting" passion which is computer science and programming. So anyways thank you so much for this *disclaimer* I will not be using this knowledge to cheat Jagex or the RS community, I wholeheartedly believe in fair gaming and this is just an interesting way to learn the mechanics of both worlds! THANK YOU!!!!

  • @aftloki
    @aftloki 4 года назад +21

    this videos honestly got me more interested in coding than a year of secondary school python, great job

  • @ahmedmoustafa3996
    @ahmedmoustafa3996 2 года назад

    this has been a kid dream of mine, man. Respect + for you

  • @ReverenceQ2
    @ReverenceQ2 4 года назад +1

    thanks for this! looking forward to learning more

  • @petarbg123
    @petarbg123 3 года назад +6

    God bless you man, this is inspiring me to learn to code through the games I love! It's so exciting

  • @Tradie1
    @Tradie1 2 года назад

    Underrated channel mate, subbed

  • @Furrierity
    @Furrierity 4 года назад +1

    really looking forward to watching this full serious so good so far!!

  • @xStarlightHQx
    @xStarlightHQx Год назад

    really like the tutorial, i am learning JS at the moment so this is a fun way of learning it to. hope i can do what you can do one day :).

  • @_chappie_
    @_chappie_ 4 года назад

    Good video bro. Keep growing this channel.

  • @vesacksi
    @vesacksi 2 года назад

    Great stuff, lots of things i wanted to learn :) Smart !

  • @TheLastLogicalOne
    @TheLastLogicalOne 10 месяцев назад

    Thanks, for helping me select a automation library and download/install it :)

  • @diegorivera_cr
    @diegorivera_cr 4 года назад +1

    Great video, thanks for all the valuable info!

  • @SangharshSeth
    @SangharshSeth 4 года назад +1

    Really a refreshing way to learn javascript.I am pumped💪💪💪

  • @selfregulator
    @selfregulator 4 года назад +5

    Richard from Silicon Valley giving us a really nice tutorial very concise and well explained

  • @jennifermariabrocco4608
    @jennifermariabrocco4608 3 года назад

    This is a really great video, thank you!!

  • @aa898246
    @aa898246 Год назад +1

    really cool series! thank you

  • @bigjoe6504
    @bigjoe6504 3 года назад +4

  • @kouaher4045
    @kouaher4045 4 года назад +1

    Amsome video! Already a fan.

  • @mile.9768
    @mile.9768 3 года назад

    Underrated channel

  • @piggiesgosqueal8066
    @piggiesgosqueal8066 4 года назад +2

    Very well made / useful tutorial. Thank you!
    I am learning website development but I haven’t learned JS yet. Finally I have a fun way to actually learn it.
    Edit: Do you have any tutorials to learn Java through bots? Java is the main language I’ve been wanting to learn for years but OOP really stumps me and without a project to keep me interested I eventually give up.

  • @hakanates1188
    @hakanates1188 3 года назад

    Awesome tutorial thanks!

  • @brandonproductions2575
    @brandonproductions2575 4 года назад +2

    Awesome video mate.

  • @anthonyreeves100
    @anthonyreeves100 Год назад

    Great video I love how detailed you was. I was wanting to learn more about coding is there any (hopefully free) coding documents/link guides for beginners you recommend?

  • @dragonmodded.
    @dragonmodded. Год назад

    just found this gem of a channel

  • @iQCudi
    @iQCudi 3 года назад +1

    really nice content! new sub here! happy new year from Panama bro!

  • @jaroslawbajon512
    @jaroslawbajon512 4 года назад +2

    cant wait for part 2 ! keep it up Ben !!
    by the way do you think programming this kind of bot is easier and more efficient in JAvaScript or Python ?

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +1

      I think the easiness is about the same. Python has a few more GUI automation libraries floating around right now than JavaScript, so you get more options. Python is also more popular for machine learning, if you plan on doing that eventually. But there isn't anything holding JavaScript back either. It's really just up to what you prefer.

  • @caiomedeiros6079
    @caiomedeiros6079 4 года назад +1

    good video bro, i'm from Brazil, and, even though I don't speak english very well, I really liked that

  • @JorgeMartinez-zg1wj
    @JorgeMartinez-zg1wj 3 года назад

    Super hyped!

  • @SSClown
    @SSClown 2 года назад

    Thanks! One tip for people who got the error - make sure when the thing pops up you click a key twice, and not just exit the tab.

  • @marcostrevinorodriguez1254
    @marcostrevinorodriguez1254 Год назад

    Amazing videos man

  • @mattwalkerproductions3558
    @mattwalkerproductions3558 3 года назад

    Great idea, good stuff...

  • @patrickmueller9658
    @patrickmueller9658 Год назад

    Great tutorials to follow along - one thing I noticed in your videos - you’re absolutely obsessed with everything that has to do with AutoGUI😂

  • @saadch7003
    @saadch7003 4 года назад +1

    GREAT TUTORIAL!

  • @gauravkumarjain
    @gauravkumarjain 3 года назад

    Yes you are very right. JavaScript is the best one with start with for understanding coding

  • @DRocksRecords
    @DRocksRecords 3 года назад

    Wow I'm amazed thanks man

  • @bijanchipz517
    @bijanchipz517 4 года назад

    thank you man

  • @danny8335
    @danny8335 3 года назад +1

    keep up the good work!

  • @toplifehype976
    @toplifehype976 4 года назад +2

    HELLO I WAS AFRAID TO LEARN NODE.JS BUT AFTER YOUR VIDEO I UNDERSTAND THAT NODE.JS IS NOT SO HARD I LIKE HOW YOU EXPLAIN ALL THINGS AND YOUR TALING MANERE JUST KEEP IT UP P.S THAT'S MY FIRST COMMENT ON RUclips + LIKE + SUBSCRIBE

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад

      Thanks, glad it helped you!

    • @thethievesdomain8360
      @thethievesdomain8360 4 года назад

      Just a tip, all caps is perceived as yelled in text. Knowing that, read your comment again and it turns a bit humorous. ;)

  • @digitalminister5687
    @digitalminister5687 3 года назад

    Wow, you got my sub!

  • @boey6236
    @boey6236 3 года назад +2

    such a sick channel! I wish I found this earlier

  • @erin2150
    @erin2150 4 года назад +2

    Thank you for the video so far I like your teaching style. I also like that I get to learn how to code with a game I love in a way that maintains integrity! For anyone that gets stuck around the 7:30 mark. I found that I had to go into the OneDrive directory first, then Desktop to woodcutter. Hope that helps :)

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад

      Thanks glad you like it! And thanks for the tip in case anyone else gets stuck there.

  • @TroubleMakery
    @TroubleMakery 3 года назад

    I’m having an issue where the robot can move the cursor in all applications beside runescape. I’m using the dreamscape RSPS because Ikov seems to not be working anymore. How could I go about fixing this? Is there something that dreamscape is using to prevent bots maybe?

  • @jhjh151
    @jhjh151 4 года назад +1

    Thank you so much

  • @gabrielcheda8693
    @gabrielcheda8693 4 года назад +1

    awesome!!!!

  • @Alucard.2024
    @Alucard.2024 9 месяцев назад

    YOU ARE AMAZIIIIING 🇧🇷

  • @hughpapaheffner4957
    @hughpapaheffner4957 4 года назад +21

    Do more advanced stuff with runescape, very interesting and fun!

  • @HiagoxX
    @HiagoxX 4 года назад +1

    Great video!! I always thought that runescape bots had to be written in Java,

  • @WSBWallstreetBets
    @WSBWallstreetBets 4 года назад +2

    This is exactly what I've been looking for... I started coding python but find it hard to keep learning without real exercises. So I guess JS would be a nice way to learn. By any chance do you have a Discord community or an account I can reach you for specific questions if I'm ever stuck? I would really appreciate it. (Or play IKOV together lmao). Lmk!

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад

      Yeah I think doing projects is the best way to learn. You can do this with Python, too, using PyAutoGUI. I've got another video series about how to use that. I don't have a Discord channel setup, but several people have asked for it. For now you can email me questions at ben@learncodebygaming.com and I'd be glad to help, it just might take me a while to get back to you. I've been super busy with client work lately. Good luck, and have fun!

  • @santiagocalvo
    @santiagocalvo 6 месяцев назад

    you are awesome!

  • @Backflipmarine
    @Backflipmarine 4 года назад

    Hi, can you please help with an issue:
    The longer the script runs the more ram "node js server side javascript" uses, upto the point where it's >28gb of ram within 20 mins. Is there a way I should be flushing the ram somehow?
    Does each screenshot get stored in ram? I'm doing a slightly more complicated bot and within a minute its using 2gb+ of ram and withing 10 mins its >10gb's. Any help to resolve this is appreciated! :)

  • @Themusicbiz
    @Themusicbiz 3 года назад

    IF one were to try and make an undetectable bot, would there be a benefit in python over JS? IF I am not modifying the code or using reflection to run commands, only object recog and autuGUI. Seems undetectable to me.

  • @hapogenmanrow8038
    @hapogenmanrow8038 3 года назад

    hey i have a problem when doing "npm install robotjs" as alot of python error came up then gyp errors then npm errors
    maybe this is because im woorking with react?

  • @pl9820
    @pl9820 6 месяцев назад

    great video

  • @1soultaker1
    @1soultaker1 3 года назад

    PEACE AND LOVE THANK YOU BRO!

  • @LearnCodeByGaming
    @LearnCodeByGaming  4 года назад +1

    Expect about 4 days between the release of each video in this series. Stay tuned!

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад

      @@maxra2142 Yes you can! There are a few OpenCV packages for NodeJS. It looks like opencv4nodejs is the most popular. The syntax will be different for JavaScript, but the functions and concepts are the same as what I cover in the OpenCV videos. I haven't used it before, so let us know how it goes if you give it a try! www.npmjs.com/package/opencv4nodejs

  • @wilsonlim5462
    @wilsonlim5462 3 года назад

    I'm stuck at 10:03 mark, how do I get to the next line? The cursor keeps staying at the end of "woodcutter", and when I press enter, it just copies itself instead of going to the next line where I'm supposed to input the "npm init -y" command. Could you please help, thank you.

  • @harmindersinghnijjar
    @harmindersinghnijjar 3 года назад

    God bless, a real one 🙏🏽

  • @haroldzeeboo9685
    @haroldzeeboo9685 2 года назад

    Been trying for days to get scroll mouse to work but cant, do you think you could look into in :)

  • @nickolasholden6624
    @nickolasholden6624 4 года назад +2

    Are you going to be using computer vision to detect game objects or some type of injection/hooking?

    • @LearnCodeByGaming
      @LearnCodeByGaming  4 года назад +4

      I'll be using pixel color matching to detect game objects. Will be teaching that in part 3.

  • @aleaus
    @aleaus 3 года назад

    I'm kinda confused having issues running the robotjs install inside WSL. but as able to install it through powershell

  • @mattbown
    @mattbown 3 года назад +3

    For Mac users:
    You need to use "/" not "\" in terminal. AND After installing Node.js. You need to install "xcode command line tools"; type into the terminal: "xcode-select --install" .THEN you can install robotjs by typing in "npm i robotjs"

    • @LearnCodeByGaming
      @LearnCodeByGaming  3 года назад +1

      Thanks for sharing!

    • @mattbown
      @mattbown 3 года назад +1

      @@LearnCodeByGaming Great series you put up! Thanks for liking the comment!

  • @rodolforp4200
    @rodolforp4200 4 года назад +2

    Lets do it!!!

  • @erin2150
    @erin2150 4 года назад +4

    Another tip for those having issues with moveMouse. When I attempted it I could not get my mouse to work, and Robotjs didn't have a specific error to that simple function. I believe they are not registering correctly when you are either in full screen, have multiple monitors, or a specific size of monitor. Through trial and error I found when I make VSCode smaller and not full screen it will move my mouse to the top left corner, when it's full screen however, nothing happens.

    • @dracoszn9360
      @dracoszn9360 2 года назад +1

      Mine still runs hello word when I do it, Any solution?

    • @GBIruam
      @GBIruam Год назад

      @@dracoszn9360 Mine too >.

    • @mrmusclesjr
      @mrmusclesjr 7 месяцев назад

      @@GBIruam May be a bit late of a reply, but make sure you save the code before running it

  • @alexagimenez3801
    @alexagimenez3801 4 года назад

    I can use this for old school runescape?

  • @BunglayTV
    @BunglayTV 8 месяцев назад

    hey dude u are really cool!

  • @wikkidklown
    @wikkidklown 7 месяцев назад

    So i know botting is against runescape rules. But would tgis also work on normal rynescape

  • @DarkChaosMC
    @DarkChaosMC 2 года назад

    I get an “Invalid or unexpected token” error in VS when I do the “node index.js” and it brings up a load of stuff, any help?

  • @ggoog1845
    @ggoog1845 Год назад +3

    man's a beast, he has got 1 eye on his camera and 1 on rs while botting... efficient! respect.

    • @aa898246
      @aa898246 Год назад +1

      douchebag

    • @ggoog1845
      @ggoog1845 Год назад +1

      @@aa898246 you sure are buddy, ya sure are =]

  • @CIPHER_TSB
    @CIPHER_TSB 2 года назад

    how do I set up automatically set up necessary tools?

  • @RekkeEU
    @RekkeEU 3 года назад +1

    I checked the box for additional installs when setting up but I am still getting a bunch of errors.

  • @jesseduit6910
    @jesseduit6910 4 года назад

    Is this also the same methode for making osrs bots/scripts?

  • @littlered55555
    @littlered55555 4 года назад +2

    I like what I see here. What are more possibilities I wonder??

  • @Justin-lx6ku
    @Justin-lx6ku 2 года назад

    when i type in wood then hit tab it does nothing, when i type it out in full and hit enter it does nothing, any advice with this change directory quesiton?

  • @bailz6314
    @bailz6314 3 года назад

    how come when i go to vs code and try to add "bash" in the terminal shell it doesnt appear?? i have gitbash downloaded and followed everything in this video but it doesnt pop up for me. anyone have any ideas? i tried google and everything but nothing works.

  • @noobboy738
    @noobboy738 3 месяца назад

    what do i do even though i check the automatic install tools

  • @obeattzy
    @obeattzy 3 года назад

    Is it possible to make a bot that works with blue-stacks?

  • @likemichael8172
    @likemichael8172 2 года назад

    How far can you get anti ban wise with this framwork? (robotjs)?

  • @PoppyPancake
    @PoppyPancake 3 года назад +2

    I have an issue with the program. I can't use bash, it's stuck on wsl and everytime i tried to install robotjs I get either denied or when i run as admin it tells me "not found ram" "syntax error"
    "(expecting "in")

    • @LearnCodeByGaming
      @LearnCodeByGaming  3 года назад +1

      I don't think RobotJS will work running on the Windows Subsystem for Linux because it needs to be able to make calls to the Windows API to do the mouse and keyboard inputs.

  • @0307nis
    @0307nis 3 года назад

    My man

  • @hosannabarona
    @hosannabarona 2 года назад

    Hey, so I installed node js for my Mac Book Air. When I went through the Download Wizard I did not get the option to "Automatically install the necessary tools" that tab just does not come up for me and therefore I am getting the "error". I tried looking through the settings to see if I could change this but found now way. Was wondering if you could go through a step by step and show us how to fix this problem if the Installer Wizard did not give us the option to "Automatically install the necessary tools"
    Besides that, your video is great man!

  • @wikkidklown
    @wikkidklown 7 месяцев назад

    ive tried this to the T of how you typed everything but i get an error message that says something about unable to load from outside of module

  • @OLDSCHOOL-RS
    @OLDSCHOOL-RS 3 года назад

    when I do cd .\Desktop\woodcutter\ it says cannot find because it does not exist. Any ideas what could be wrong or what i could be doing wrong?
    I found the solution while scrolling comments had to type onedrive before desktop

  • @BiggTurkk
    @BiggTurkk 2 года назад

    i have the error and dont know how to fix it. where is this install nessecary packages button.

  • @albytherasistdragon1806
    @albytherasistdragon1806 2 года назад +1

    Can anyone help me? I've installed everything correctly but when I go to input the commands to start the moveMouse scipt it doesn't seem to work. Please help.

  • @skytea2
    @skytea2 Год назад

    respect bro gj

  • @vevevino2583
    @vevevino2583 3 года назад

    I appreciate this tutorial A+++++++++++++++++

  • @CalvinHeath
    @CalvinHeath 3 года назад

    Please do a tutorial on like a coin flip in html/css/js/etc or black Jack, jackpot, anything upon those lines PLEASEEEE

  • @canal_conectando
    @canal_conectando 2 года назад

    how do you use open cv in this game?