Jump to content

My first script - wine maker


Recommended Posts

Posted

This is my first attemt making a script in java.

the script is very basic it just makes wines until it runs out of jugs of water or grapes and then stops and logs out.

using the script: start the script near any bank,  you dont need to have an empty inventory cause the script will jsut bank everything if inventory contains any unnecessary items.

Download souce + jar:

https://github.com/Cloudyman420/wine-maker

would like to see any feedback about the code and the actual script and see where could I improve.

Posted (edited)
1 hour ago, CloudyMan said:

This is my first attemt making a script in java.

the script is very basic it just makes wines until it runs out of jugs of water or grapes and then stops and logs out.

using the script: start the script near any bank,  you dont need to have an empty inventory cause the script will jsut bank everything if inventory contains any unnecessary items.

Download souce + jar:

https://github.com/Cloudyman420/wine-maker

would like to see any feedback about the code and the actual script and see where could I improve.

Good to see some new scripters :)

Some tips:
- I would only initiliaze stuff in the onStart, never really executed any interaction code in it.
  Since it's only run once it can fail.

Another thing that will cause issues is that you do 15 tasks in a row. This will clog up sooner or later.
If 1 action missclicks it could get stuck.

What you should do instead is only execute 1-2 commands every loop.

if animating => Wait, we are making wines
else if inventory contains jug of water and grapes => use grapes on water
else if inventory does not contain water and grapes => Bank
else if bank is open? => if we have wine deposit
else if bank is open and we have no wine? check if we have water else withdraw water
else if bank is open and we have no wine? check if we have grapes else withdraw grapes

this is just an example but it will improve stability by a lot.

Kind regards 
Khaleesi

Edited by Khaleesi
  • Like 2
Posted

Welcome to the world of scripting!

You don't need permission to post in the unofficial scripts section, so you're good.

100% agree with what Khal said, work on doing only one action per loop, and the onStart stuff. Other than that, a winemaker is a great idea for a first script.
 

Hope to see more from you soon! Good luck!

  • Like 1
Posted
18 minutes ago, Lunar said:

Welcome to the world of scripting!

You don't need permission to post in the unofficial scripts section, so you're good.

100% agree with what Khal said, work on doing only one action per loop, and the onStart stuff. Other than that, a winemaker is a great idea for a first script.
 

Hope to see more from you soon! Good luck!

thank you, will try to work on it in the future.

27 minutes ago, Khaleesi said:

Good to see some new scripters :)

Some tips:
- I would only initiliaze stuff in the onStart, never really executed any interaction code in it.
  Since it's only run once it can fail.

Another thing that will cause issues is that you do 15 tasks in a row. This will clog up sooner or later.
If 1 action missclicks it could get stuck.

What you should do instead is only execute 1-2 commands every loop.

if animating => Wait, we are making wines
else if inventory contains jug of water and grapes => use grapes on water
else if inventory does not contain water and grapes => Bank
else if bank is open? => if we have wine deposit
else if bank is open and we have no wine? check if we have water else withdraw water
else if bank is open and we have no wine? check if we have grapes else withdraw grapes

this is just an example but it will improve stability by a lot.

Kind regards 
Khaleesi

thanks for the tips, and the little private lesson <3

  • Like 1
  • 1 year later...
Posted
On 5/8/2021 at 6:25 PM, CloudyMan said:

This is my first attemt making a script in java.

the script is very basic it just makes wines until it runs out of jugs of water or grapes and then stops and logs out.

using the script: start the script near any bank,  you dont need to have an empty inventory cause the script will jsut bank everything if inventory contains any unnecessary items.

Download souce + jar:

https://github.com/Cloudyman420/wine-maker

would like to see any feedback about the code and the actual script and see where could I improve.

I'll try it, thanks :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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