Jump to content

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


Apaec

Recommended Posts

2 hours ago, Apaec said:

Most likely you've got multiple jars in your scripts folder with the same script manifest name ?

You can test this by moving all your local scripts elsewhere (e.g your desktop), and only having your simple script in the directory. Then start OSBot and see if it shows up. If it still does not, let me know!

-Apa

This didnt change anything, but

when i gave it to my friend, he decompiled the jar i sent him then recompiled and gave it to me and it showed up. he didnt change anything in the script. 

and we both did exactly the same method thats shown in your tutorial for exporting.  

Link to comment
Share on other sites

14 minutes ago, FuryShark said:

This didnt change anything, but

 when i gave it to my friend, he decompiled the jar i sent him then recompiled and gave it to me and it showed up. he didnt change anything in the script. 

and we both did exactly the same method thats shown in your tutorial for exporting.  

You must've made a mistake somewhere then! Either in the manifest, or in attaching the OSBot jar. You can test where the error is by seeing if the skeleton code that I provided shows up when compiled. If it shows up, then your error is in your manifest (or elsewhere in the source). If it doesn't show up, then you've probably attached the jar incorrectly?

Does your script have any errors/red underlines when you compile it? This is important, as if there is even one error, the script will fail compilation.

Also, keep in mind that compilation is not a perfectly reversible process, i.e if you decompile then recompile a script, you are not guarenteed to get back to the perfect original source code.

-Apa

Link to comment
Share on other sites

20 minutes ago, Apaec said:

You must've made a mistake somewhere then! Either in the manifest, or in attaching the OSBot jar. You can test where the error is by seeing if the skeleton code that I provided shows up when compiled. If it shows up, then your error is in your manifest (or elsewhere in the source). If it doesn't show up, then you've probably attached the jar incorrectly?

Does your script have any errors/red underlines when you compile it? This is important, as if there is even one error, the script will fail compilation.

Also, keep in mind that compilation is not a perfectly reversible process, i.e if you decompile then recompile a script, you are not guarenteed to get back to the perfect original source code.

-Apa

0e790e9b93d50275a91a4ccc7d93d69d.png

no red lines

b788ac5d80c2f3c2e1bfbbb0d046f6f2.png

osbot jar attached.

:S

Link to comment
Share on other sites

8 minutes ago, FuryShark said:

0e790e9b93d50275a91a4ccc7d93d69d.png

no red lines

b788ac5d80c2f3c2e1bfbbb0d046f6f2.png

osbot jar attached.

:S

Ahhh!! I see what's up!

Looks like you've got the wrong JDK. OSBot is written for Java 8 and is incompatible with later revisions.  See where it says 'JRE System Library [JavaSE-10]' in your screenshot? Right click that, select properties, and change the execution environment to 'Java-SE-1.8'

Here's the d/l link: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Let me know if that works :)

-Apa

  • Heart 1
Link to comment
Share on other sites

1 hour ago, Apaec said:

Ahhh!! I see what's up!

Looks like you've got the wrong JDK. OSBot is written for Java 8 and is incompatible with later revisions.  See where it says 'JRE System Library [JavaSE-10]' in your screenshot? Right click that, select properties, and change the execution environment to 'Java-SE-1.8'

Here's the d/l link: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Let me know if that works :)

-Apa

It appears now <3 tyty :) 

  • Like 1
Link to comment
Share on other sites

26 minutes ago, Apaec said:

Update 17-05-2018:

Minor changes and a few fixed typos. Also embedded images instead of just posting links.

___

Apa

If i were an air bender id fly you. Thanks for this apa! :) Iv been using code academy and starting to understand the basics but what those online teachers like code academy and code combat dont teach you is how to write for a program and this helped my understanding a lot!

  • Heart 1
Link to comment
Share on other sites

15 minutes ago, thedevilhacker said:

If i were an air bender id fly you. Thanks for this apa! :) Iv been using code academy and starting to understand the basics but what those online teachers like code academy and code combat dont teach you is how to write for a program and this helped my understanding a lot!

Glad to hear it, best of luck learning! :) Let me know if you have any questions

--Apa

Link to comment
Share on other sites

  • 4 weeks later...
7 hours ago, spanishguy said:

@Apaec

 

Thanks for this! It all seems to make sense. So essentially, your onLoop part of the script will always expand into Defining, Null Check, and Interaction + Delays, Fail Checks? Where these are further defined using "if" and "else if" statements? This basic principle applies to all scripts?

So the onLoop is continuously called, i.e looping. From what you've said, you seem more or less right, although fail checks can often be implemented as their own state in the onLoop (remember, to maximise robustness, have only a single interaction per onLoop call) rather than 'sequentially'. 

I'm not entirely sure what you mean by your first question regarding if and else if statements. With regards to your second question, yes - if you go down deep enough, these basic principle apply. However with more complicated scripts this detail is often abstracted away using OO concepts which is a powerful way to encode more meaning/functionality/diversity into a comparatively smaller code size.

Apa

  • Like 1
Link to comment
Share on other sites

23 minutes ago, CPRulez said:

@ApaecQuestion for you on IDE's between IntelliJ and Eclipse, are the main differences preference, or do you prefer eclipse for a reason? I'm just starting to learn to code, and want to start on the right path.

eclipse is bit more geared towards newer people but intellijs features eclipse eclipse's features by far :doge:

  • Like 1
Link to comment
Share on other sites

15 hours ago, CPRulez said:

@ApaecQuestion for you on IDE's between IntelliJ and Eclipse, are the main differences preference, or do you prefer eclipse for a reason? I'm just starting to learn to code, and want to start on the right path.

As deceiver said, intelliJ is far more... intelligent. It has loads more features and is generally the tool of preference at the moment.

I use eclipse for OSBot scripts mostly because it is what I learned to use initially. The interface is comparatively simplistic and in my opinion more intuitive for people starting out. I do use other IDEs and sometimes plain text editors for other java projects. It's preference really - use whichever you are more comfortable with!

  • Like 1
Link to comment
Share on other sites

5 hours ago, Apaec said:

As deceiver said, intelliJ is far more... intelligent. It has loads more features and is generally the tool of preference at the moment.

I use eclipse for OSBot scripts mostly because it is what I learned to use initially. The interface is comparatively simplistic and in my opinion more intuitive for people starting out. I do use other IDEs and sometimes plain text editors for other java projects. It's preference really - use whichever you are more comfortable with!

Thanks :) just getting into scripting and obviously wanted to start the right way haha.

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