Jump to content
CloudyMan

My first script - wine maker

Recommended Posts

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.

Link to post
Share on other sites
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 1
Link to post
Share on other sites

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
Link to post
Share on other sites
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
Link to post
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.

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