Jump to content

Questions from a beginner scripter


damightyshmo

Recommended Posts

Hello! I've always been wanting to write a bot script and recently after getting a job as a Junior Software Dev i figued why the hell not start now!

 

So basically i'm still in the process of learning a few things. However, when writing a Sheep Shearer script. It will only continue the convo with Farmer Fred if i'm running OSBOT with remote debugging enabled. 

https://pastebin.com/FLmy0qqm

 

Thanks for any replies :) 

Link to comment
Share on other sites

A few things to note:

  1. As the bot is interacting with a live game, you cannot rely on API calls to execute successfully. For example, if you have the line 'entity.interact(....', and then hit some lag, the call might not affect game state and so your script will continue without actually having interacted. You have to build in resilience to this with your script. Ideally, your script should be entirely deterministic and only execute one game interaction per onLoop call.
  2. The onLoop function loops, so you will end up unnecessarily trying to walk to the area you have specified every iteration, which i'm guessing is not what you had in mind.
  3. Avoid static sleeps (e.g sleep(random(300,400));...). These don't really anything other than hinder the efficiency of your script.
  4. The interaction API handles camera movement etc, so no need to do that manually

Best of luck :)

Apa

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...