Author Topic: Fully functional Lumberjack script!  (Read 6139 times)

0 Members and 1 Guest are viewing this topic.

Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Fully functional Lumberjack script!
« on: July 25, 2023, 07:47:24 PM »
Setup:
-Make sure OrionAssistant->Main->Options 1->useitemdelay and moveitemdelay are adjusted properly
-Have a secure container available
-Run setup()

Usage:
-Simply run Autoharvest to collect resources from the trees around your house.

Function:
-Script will attempt to scan and harvest all trees with the set distance from your secure container
-As trees are harvested, a timer and the last wood type each tree produced is logged and saved to a file
-Once all trees have been harvested, the script will only harvest from trees that will produce resources and skip all others
-Trees harvested will become the color of the wood they last produced.
-As players weight goes up, logs will be cut to boards, if a beetle is available it will be used to store boards
-When player and beetle are nearly full, the script will return to secure, unload, and continue.
-If all trees in range have been harvested, script will wait for trees to respawn based on the RESPAWNTIME variable

v1.0 seems pretty solid and has gotten good reviews.
v1.1 contained small fixes
v1.2 has lots of updates but as the script gets more complex, so does testing all the features. Call this one a BETA version for now.

* v1.2
 *  -Code restructured, better layout, more debugging, more comments
 *  -Script now only walks when riding an overloaded beetle
 *  -Added setup gump for easy configuration
 *  -Updated all journal checks to Clilocs, should now work with any language!
 *  -A tree history will be built as the script scans for trees in range of secure
 *  -Once the list is built, trees that dont produce wood will be skipped
 *  -Trees are ignored for 30minutes once harvested, then reset
 *  -If all trees in range are depleted, script will wait tree timers reset then continue
 *  -Tree colors: white=active, lightgreen=chopList, color=lastWoodType, plain=not harvesting
 * v1.1 updates:
 *  -Now waits at secure for hp regen instead of pausing
 *  -Now waits at secure 5min, then rechecks area for hostiles instead of pausing
 *  -Now detects tinkering skill and will pull ingots from secure instead of axes, makes axes as needed
 *  -Better navigation, more intelligent tree finding
 *  -*Bugfix: Fixed issue with not having axes in secure causing an error


There are 2 attachment(s) in this post. You must register and post an acceptable introduction to download
Lumberjack.oajs
Lumberjack1.2.oajs
« Last Edit: August 10, 2023, 10:12:27 PM by altiric »

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Referrals: 0
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #1 on: July 26, 2023, 09:24:11 PM »
Thjx for the completed the build,  Will give that a try, shortly.

Offline crashtestdummy

  • Jr. Member
  • **
  • Posts: 11
  • Activity:
    0%
  • Reputation Power: 1
  • crashtestdummy has no influence.
  • Howdy! :D
  • Referrals: 1
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #2 on: July 30, 2023, 09:13:28 AM »
Looking forward to trying this out, thank you very much!! :)

Offline gruntman

  • Full Member
  • ***
  • Posts: 168
  • Activity:
    0%
  • Reputation Power: 2
  • gruntman has no influence.
  • Gender: Male
  • Referrals: 0
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #3 on: August 02, 2023, 06:32:58 PM »
Thank you for sharing this! Exactly what I was looking for.. I will provide feedback after I use it a bit :)

Ok, so after about 36 hours of running it from zero I have raised my skill to 99.2 and amassed a ton of wood.
Not one hiccup has occurred that was caused by the script. It did run me across a moonglow teleporter though lol.
Awesome Job and Thank you for sharing.

« Last Edit: August 04, 2023, 05:50:28 PM by gruntman »

Offline gruntman

  • Full Member
  • ***
  • Posts: 168
  • Activity:
    0%
  • Reputation Power: 2
  • gruntman has no influence.
  • Gender: Male
  • Referrals: 0
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #4 on: August 04, 2023, 06:42:07 PM »
woot! Hit GM status!!!
Nice job Altiric!

Post Merge: August 05, 2023, 08:31:47 AM
fix to put ambers collected away

harvest : '0x3191|0x2F5F|0x318F|0x3190|0x5738|0x3199' // fungi, switch, bark, plant, shards, Ambers

Post Merge: August 05, 2023, 08:41:35 AM
after every chop to a tree I get "you must wait" where do i add more time to try and streamline the axe usage?
cant seem to find it

also, I noticed once his health falls below a certain level he heads home and never moves again - is there a way to make it so once he regenerates full health (which happens over time) he would resume?

« Last Edit: August 05, 2023, 12:27:26 PM by gruntman »

Offline Gaderian

  • Elite
  • *
  • *
  • Posts: 489
  • Activity:
    0.6%
  • Reputation Power: 10
  • Gaderian barely matters.Gaderian barely matters.
  • Referrals: 3
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #5 on: August 05, 2023, 02:20:07 PM »
Here is the timer on chopping.
Each iteration of the loop looks like it waits for 100 milliseconds, or .1 second.
It is looking for messages to show up in the journal about chopping the tree or out of resources.
The loop ends when either of the messages show up or the timer exceeds 1.6 seconds - whichever happens first.
You can increase the 1600 slightly or you can add a deliberate wait after the while is finished.
If the message shows up in the journal and you still get the message that you are swinging your axe too quickly, then you will need to add the separate wait.
If your server is unhappy with the 1.6 seconds and expects more time until the journal message shows up, then you will need to increase the 1600.
Code: Javascript
  1.     do {
  2.         useAxe(tree.X(), tree.Y());
  3.         Orion.SetTimer('chop');
  4.         while(!Orion.InJournal("You chop|You hack") && Orion.Timer('chop') < 1600)
  5.             Orion.Wait(100);            Orion.ClearJournal("You chop|You hack");
  6.     } while(!Orion.InJournal(messages) && !Player.Dead() && !Player.WarMode());
  7.  
"Go ahead ask me: 'Should I use hard waits or timers?'"
You say:"Should I"
Gaderian:"Timers!"
You Say:"use hard waits or timers?"

The serious side of timer use is illustrated here: http://www.scriptuo.com/index.php?topic=12094.msg101926#msg101926

However, every time I go back and look at this [AutoLooter] script, I realize I had wrote it in my zen state of EUO scripting - so it makes my brain hurt.

Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #6 on: August 05, 2023, 04:58:43 PM »
gruntman: If your getting that with every swing it seems like your usitemdelay is too short. In your Orion Assistant, you can go to the Main page and click on the Options 1 tab. In there you will find useitemdelay and moveitemdelay. You can adjust the values there as needed and they will be updated in the script, don't even need to reload or pause the script. I did it this way so all the wait timers in the script can be adjusted by the user without having to edit anything. 1200ms works perfectly for me, but i have heard of people getting away with as little as 600ms, or needing as much as 1800ms. I did put v1.1 on my github which changes the pause scripts when health is low or enemy is spotted. It will now wait for full health and continue, or check for histiles again after 5min and continue rather than just stop. I have already finished a number of other little updates and will have 1.2 ready to post here before the end of the weekend.

Gderian: That timer is just in there encase the message gets missing or does not display for some reason, the script wont just hang. It really should be set to the useitemdelay like the rest for consistency, but was just in there as a precaution anyway. The script runs without that check in at all, but not having it would cause extra chops  when a tree is empty since the journal message would not show up before the next swing.

Thanks for the feedback, and glad its working for most people right out of the box! I am working on a couple little glitches that are causing issues, like opening the paperdoll before counting axes, etc. I'll add in that amber, just keep forgetting lol. Also trying to fix up the comments since people have already been ripping this apart for their own needs, which is awesome.
« Last Edit: August 05, 2023, 05:04:07 PM by altiric »

Offline gruntman

  • Full Member
  • ***
  • Posts: 168
  • Activity:
    0%
  • Reputation Power: 2
  • gruntman has no influence.
  • Gender: Male
  • Referrals: 0
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #7 on: August 05, 2023, 05:35:13 PM »
AWESOME!! That worked perfectly - I didnt know it was there - UGH!

Well thank you both for your help and I have been going strong most of today without a hitch after I made a few changes of my own :)

cant wait for the updates

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Referrals: 0
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #8 on: August 06, 2023, 11:10:42 AM »
Nice work Altric  on this build.   

Pro:
Easy setup.
Love the use of the color to identified tree, 
Siege tested:    Get new Axe for secure.

Con:
Required to have always run  turn off.
Tree don't rest

If a new update maybe have the tree to reset after 30 min,


Thx alot for sharing this build

Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #9 on: August 10, 2023, 09:34:59 PM »
The issue with always run on is the risk of the beetle getting stuck on objects, or an overloaded beetle having stamina drain. v1.2 has an option in the setup gump to toggle mounting a beetle or not. If mounted, the script will make sure the beetles weight is under stamina drain levels and run, or walk accordingly. The script will always run while not mounted, trying to make sure the beetle is following the whole time and trying to recover it if it does get stuck. I am adding an option now to the setup gump to relog at secure if beetle recovery fails. I did also adjust the way it finds and logs trees. Now, when you run the script it will scan and harvest all the trees is can find within the set distance from secure container. It will log the results and save them to a file. As trees get scanned, trees in the history are ignored while the list is built. Once the list of trees is complete and has been harvested, it will be used for subsequent runs. This means no more walking to and chopping trees that will not produce wood, which should result in a good production boost! Will also allow for some neat features in the future like being able to chop specific woods as long as the trees in history contained that wood last time, not sure if the resource type is random each time its depleted, etc. Will need some testing on that, but with the ability to log every tree it will be possible :)

Basically down to a little gump work and just watching it build new tree lists then run them a few times in different locations before releasing the newer version. Lots of other cool additions than i am quite happy with so far.

Offline gruntman

  • Full Member
  • ***
  • Posts: 168
  • Activity:
    0%
  • Reputation Power: 2
  • gruntman has no influence.
  • Gender: Male
  • Referrals: 0
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #10 on: August 11, 2023, 08:16:01 PM »
Awesome!! Thank you for your attention to this script.
Unfortunately it does not seem to function correctly. setup asks for secure - I target
beetle - I target

The "not set" never changes after i set it and clicking okay changes nothing

What am I not doing correctly?

Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #11 on: August 11, 2023, 10:19:28 PM »
Ill look into that in the morning. I did some swapping between Orion Assistant variables and RegRead/Writes. May have saved a value i stopped using and it didnt show up as an error on my end because it was still valid with the previous method.... guessing that the issue.

Offline gruntman

  • Full Member
  • ***
  • Posts: 168
  • Activity:
    0%
  • Reputation Power: 2
  • gruntman has no influence.
  • Gender: Male
  • Referrals: 0
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #12 on: August 13, 2023, 04:18:57 PM »
awesome - thanks


Offline gruntman

  • Full Member
  • ***
  • Posts: 168
  • Activity:
    0%
  • Reputation Power: 2
  • gruntman has no influence.
  • Gender: Male
  • Referrals: 0
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #13 on: August 19, 2023, 06:34:10 PM »
Ill look into that in the morning. I did some swapping between Orion Assistant variables and RegRead/Writes. May have saved a value i stopped using and it didnt show up as an error on my end because it was still valid with the previous method.... guessing that the issue.

Altiric,

Have you had a moment to look at the new version you uploaded that doesn't seem to work?
The first version you posted I have used a ton and not one issue at all. Thank you!

Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Re: Fully functional Lumberjack script!
« Reply #14 on: August 19, 2023, 07:46:41 PM »
Had the newer version on hold while i rolled out a more ambitious project, since version 1.0 works quite well. Got that out and rolling now so i'll be working on finishing this up soon. Then its back to my fisher... fun times :)

Tags: