Jump to content

A Beginners Guide to Writing OSBot Scripts (where to get started!) by Apaec


Apaec

Recommended Posts

Great guide - as a noob I'm almost there I think... after exporting it as a JAR file within the OSBOT / script dir ... Nothing happens when I open the JAR file? 

 

See attached script looks ok to me, feel like I'm missing something simple.

Could this be the reason why? :

Description    Resource    Path    Location    Type
The compiler compliance specified is 1.5 but a JRE 17 is used    osbot        Compiler Compliance    JRE Compiler Compliance Problem

 

Thanks man appreciate any help.

Screenshot_20230402_212638.png

Link to comment
Share on other sites

20 hours ago, con m said:

Great guide - as a noob I'm almost there I think... after exporting it as a JAR file within the OSBOT / script dir ... Nothing happens when I open the JAR file? 

 

See attached script looks ok to me, feel like I'm missing something simple.

Could this be the reason why? :

Description    Resource    Path    Location    Type
The compiler compliance specified is 1.5 but a JRE 17 is used    osbot        Compiler Compliance    JRE Compiler Compliance Problem

 

Thanks man appreciate any help.

Screenshot_20230402_212638.png

Hey - you won't want to run the JAR directly. Rather, you should launch OSBot and the script should then show in your scripts list.

Let me know if you're still having issues!

-Apa

Link to comment
Share on other sites

  • 1 month later...

I just wanna say

I picked up this post yesterday and put together the teathiever

Moved on to create just a basic mining script and I'm happy to say with your help and the power of Google I was able to create an incredibly basic mining script with banking. Still figuring out how to make it progressive and other fun stuff like that but just wanted to say thank you for helping kick start that journey. Here's my code for proof :) (and also if you see anything in here that could be used to tidy it up or making it look better I'd always appreciate an ear :)).

 

abab562c27605115cc9c3a76a9e04f8b.png
https://gyazo.com/abab562c27605115cc9c3a76a9e04f8b

Link to comment
Share on other sites

19 hours ago, evenflyox said:

I just wanna say

I picked up this post yesterday and put together the teathiever

Moved on to create just a basic mining script and I'm happy to say with your help and the power of Google I was able to create an incredibly basic mining script with banking. Still figuring out how to make it progressive and other fun stuff like that but just wanted to say thank you for helping kick start that journey. Here's my code for proof :) (and also if you see anything in here that could be used to tidy it up or making it look better I'd always appreciate an ear :)).

 

abab562c27605115cc9c3a76a9e04f8b.png
https://gyazo.com/abab562c27605115cc9c3a76a9e04f8b

Nice work, and well done getting something of your own up and running!

My main piece of advice based on your code is to focus more on reliability. An important thing to remember is that the code interacts with a live game: a complex system with many points of failure beyond your control. As a result, any game interaction might fail. For this reason, it is important that at no point you implicitly depend on an interaction succeeding. For example, on line 28 you open the bank. However, this might fail! You then immediately proceed to deposit your items on line 32 assuming the bank is open. We can't deposit items if the bank failed to open, therefore line 32 might throw an error.

A good way to avoid this is to ensure that, given a game state, only one interaction follows. E.g., the following code would be an improvement:

onLoop() {
  if (getBank().isOpen()) {
    getBank().depositAll();
  } else {
    getBank().open();
  }
}

 

  • Like 1
  • Heart 1
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...