Author Topic: Building a Lumberjacking Script  (Read 10599 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
Building a Lumberjacking Script
« on: May 20, 2022, 11:36:30 AM »
Altiric's Amazing Arborist v0.1 (Works in Ter Mur)

A simple Lumberjack script that lets you harvest wood from your house. All you need is a secure container and an axe!

Load this one into your Scripts Tab, run Autostart, and you're up and running.

Finally been getting around to releasing my lumberjack script. Since there are a lot of people trying to learn more about scripting for Orion, I will be releasing this one in stages. Not to say my way is the best way, but it works lol. The first stage was just a matter of getting the bones together. Once i was able to find, walk to, and chop trees; I added support for the pack animal, then secure drop. I added a few messages to show where the script was in its operation, then sat back and let it run. Once i got the kinks worked out, i removed any extra bits i had and tossed a v0.1 on it!

Revisions:
 * v0.2
 *  -Added GUI
 *  -Moved action messages to gump
 *  -Updated chopping to make sure axe is held
 *  -Added counter for all items listed in harvestTypes(stored in registry)
 *  -Added gump display for harvestTypes
 * v0.1
 *  -Added ability to find trees, walk up to the closest one, and chop it
 *  -Added logs2boards
 *  -Added pack animal support
 *  -Added secure drop
 *  -Added action messages

v0.2 - I plan on adding a GUI and Counter system. ** in progress **
v0.3 - Will have rune book capability
v0.4 - Looking for suggestions :)

There are 2 attachment(s) in this post. You must register and post an acceptable introduction to download
AAALumberjack_01.oajs
AAALumberjack_02.oajs
« Last Edit: May 20, 2022, 07:51:39 PM by altiric »

Offline Bulldog

  • Jr. Member
  • **
  • Posts: 10
  • Activity:
    0%
  • Reputation Power: 1
  • Bulldog has no influence.
  • Referrals: 0
    • View Profile
Re: Building a Lumberjacking Script
« Reply #1 on: May 20, 2022, 12:37:51 PM »
Nice work again bud. I think in terms of suggestions you could easily adapt the same core principals to mining for example.

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: Building a Lumberjacking Script
« Reply #2 on: May 20, 2022, 12:51:44 PM »
MwInc have a simple lumber and Minijg script that was easy to set up.   Did the leg work :)    This can be a good base of compassion.
12X have a nice mining as well,  have not used it as much.

If not already include,  can you ensure that you cut log into board plx.:) this way you can carry more.    thx in advance

Orion:  I notice that you can scan an area and get 50 tree load up and just walk to all of them .

 


Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Re: Building a Lumberjacking Script
« Reply #3 on: May 20, 2022, 12:53:14 PM »
The mining script is a big part of why i did this. Ive been working on a full blown mining script, on and off... for about 4 months. Its still not done because i kept trying to throw in everything at once and it gets over complicated, then the bugs move in. This method gets you a working script right off the bat, then you can make it as pretty as you want bit by bit.

Post Merge: May 20, 2022, 12:58:32 PM
MwInc have a simple lumber and Minijg script that was easy to set up.   Did the leg work :)    This can be a good base of compassion.
12X have a nice mining as well,  have not used it as much.

If not already include,  can you ensure that you cut log into board plx.:) this way you can carry more.    thx in advance

Orion:  I notice that you can scan an area and get 50 tree load up and just walk to all of them .

12X has the best mining script out there as far as im concerned. Ive used his structure in several of my own scripts, its just got a nice flow to it and is well designed.

Logs2Boards is in there.

That's how this one works! after getting the array full of trees, it uses some lovely JavaScript array manipulation to compare with the choppedTrees array and move the trees around in the array so you always walk to the closest one too you.
« Last Edit: May 20, 2022, 12:58:32 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: Building a Lumberjacking Script
« Reply #4 on: May 20, 2022, 01:00:59 PM »
I try that one , include evething on my list and nothing was working.  so now I build the basic, run  some good test run and add sub as needed.    I do have a good collection of version, something up to 26  heheood look on the mining

Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Version 0.2 - Gumps and Counters!
« Reply #5 on: May 20, 2022, 03:16:03 PM »
Coming along quickly :)

Online Crisis

  • Global Moderator
  • *
  • *
  • Posts: 2998
  • Activity:
    3.2%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Referrals: 2
    • View Profile
Re: Building a Lumberjacking Script
« Reply #6 on: May 20, 2022, 05:05:21 PM »
I like it so far, can't wait for runebook usage. Currently I it has a difficult time removing boards. I get a lot of have to wait messages and if there is more than one kind of board in the pack, it won't remove the plain ones. I have checked to make sure the ids and stuff are the same. It also gets stuck on a tree when it says you cannot use an axe on that.

I added this in to try and change the can't use an axe but no avail
Code: [Select]
// Language, Adjust these to suit your clients language
    var msg1 = "There's not enough wood";
    var msg2 = "You cannot see";
    var msg3 = "That is too far";
    var msg4 = "You chop some";
    var msg5 = "you can't use an";
« Last Edit: May 20, 2022, 05:07:14 PM by Crisis »

Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Re: Building a Lumberjacking Script
« Reply #7 on: May 20, 2022, 05:47:18 PM »
I like it so far, can't wait for runebook usage. Currently I it has a difficult time removing boards. I get a lot of have to wait messages and if there is more than one kind of board in the pack, it won't remove the plain ones. I have checked to make sure the ids and stuff are the same. It also gets stuck on a tree when it says you cannot use an axe on that.

I added this in to try and change the can't use an axe but no avail
Code: [Select]
// Language, Adjust these to suit your clients language
    var msg1 = "There's not enough wood";
    var msg2 = "You cannot see";
    var msg3 = "That is too far";
    var msg4 = "You chop some";
    var msg5 = "you can't use an";

Woohoo! Feedback, thank you!
The script uses the delay settings from OrionAssitant->Main Tab->Options 1, Sounds like you need to increase your moveitemdelay/useitemdelay to fix those messages. No idea how it managed targeting something outside of a tree for the can't use that message but i'll pop that in there for v0.3! As for the not moving plain boards, that'll take some looking.

**I had to change my waitdelays from the default 600 to 1200 to smooth things out

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: Building a Lumberjacking Script
« Reply #8 on: May 20, 2022, 05:59:52 PM »
He  Crisis,  nice to see back.  How you been

here what I have mine setup in option1.   I still see the Msg you must wait, but I swing that axe fast.   sure look fast :)

Testing ver 0.2   
I set for bank,  I change my mind and want to do house,  I stop and restard build, now Im not getting the option to set bag or packhorse.   
Must be C18 code,  :) 

and I just crash trying to manually unload

update:
The crash since to have fix my issue.  I was able to reset my drop bag.
 

Post Merge: May 20, 2022, 06:09:55 PM
Same as Crisis 
 it wont unload my regular board and now I'm overweight.

on a good note:
It cool,  Start at my house, run out chop tree, go back in the house to unload and go back out. 

 Update 3:
 it will unload the regualr board.  it just take alot of time.  I keopt receiving msg : THAT IS TOO FAR.   After a while, like 27 time items get unload ( 90% of the time)
Use ites dealy @ 1200 and Move itemdelays delays @1200
 

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
Main_option1.JPG
« Last Edit: May 20, 2022, 06:19:09 PM by The Ghost »

Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Re: Building a Lumberjacking Script
« Reply #9 on: May 20, 2022, 06:16:24 PM »
Use item Delay adds a delay after using an object. If its trying to swing too fast, this needs to be increased.
Move Item Delay adds a delay after moving an item, before continuing to the next action. The way it's worked into the loops, If you get pickup message errors, this will need to be increased.

I can see how this is becoming an issue but i wanted to keep the delays consistent with the general setup of the OrionAssistant, which also cuts down on the editing required within the script itself. I'll see if i can work something in with the built in CheckLag function to compensate.

Using a bank as a secure would take a little fiddling with the Setup, I'll be adding that feature with with the runebooks in the next update.
I'll also be adding an options menu to the gump to reset secure/pack animal. Right now they are stored in your Lists->Objects Tab and can be edited/deleted from there. (Currently, If the script cannot find the set secure container, or pack animal upon start, it will ask for new targets to be selected).

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: Building a Lumberjacking Script
« Reply #10 on: May 20, 2022, 06:26:05 PM »
Can you post a pic of your option 1, so I have a base line.  plx,   the more I change number, the worse  it get.     Now my frame skipping :)   before you ask, ping at 29ms.   nice now can't move  heheheh   
stop script and now I can move.  I need a beer.


Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Re: Building a Lumberjacking Script
« Reply #11 on: May 20, 2022, 06:33:04 PM »
I'll work on a quick OrionUO Setup guide this evening, ive run into several people having issues getting it running like it can.
This is a copy of my Options 1 Tab setup, It sounds like you're having framerate issues though. Although the client can handle larger fps, they are completely wasted on UO and soak up extra resources it does not need to.

There are 2 attachment(s) in this post. You must register and post an acceptable introduction to download
framerate.png
options1.png

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: Building a Lumberjacking Script
« Reply #12 on: May 20, 2022, 06:45:34 PM »
Thx for the pic,  I'm close to your.  Now I know what nodebug do.  want to get that text out for day :)     after 15min of running script,  game slow down it like I'm frozen.  I stop  the script, now I can move.   Crisis  do you have the same issue. 

Offline altiricTopic starter

  • Jr. Member
  • **
  • Posts: 81
  • Activity:
    0%
  • Reputation Power: 2
  • altiric has no influence.
  • Referrals: 1
    • View Profile
Re: Building a Lumberjacking Script
« Reply #13 on: May 20, 2022, 06:51:59 PM »
Ive run into this issue with a few Gump's now. Just ran into the same issue of bogging down after about 45 minutes each time, v0.1 ran for over 3 hours without a hiccup. Figured it was too short of a delay in one of the while statements, but kept adding to the time and it did not resolve it. I did notice i had it Updating the gump twice on every axe stroke, once to get the updated counts, once to update the Action status. 20 minutes into a fresh run and have not seen any issues starting yet.

Online Crisis

  • Global Moderator
  • *
  • *
  • Posts: 2998
  • Activity:
    3.2%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Referrals: 2
    • View Profile
Re: Building a Lumberjacking Script
« Reply #14 on: May 20, 2022, 07:34:34 PM »
Increasing the use item delay helped but it still gets stuck trying to chop a tree saying "you can't chop that with an axe" and when it unloaded all of the lumber and stuff, it also unloaded my runebooks lol.

Don't get me wrong, this is awesome and I cannot wait till the bugs are worked out. I really need to read up on javascript so I can get better. Thank you for sharing and working on this!

@The Ghost I am doing ok. Still dealing with health issues which takes away from gaming but I am hanging in there!

Tags: