ScriptUO

Scripting Resources & Utilities => Orion UO Client => Orion UO Scripts => Topic started by: altiric on May 16, 2022, 08:55:04 PM

Title: Brute Force Egg Hunter
Post by: altiric on May 16, 2022, 08:55:04 PM
*** FINAL VERSION! ***

Had a lot of fun with this one and learned a lot about what I have been doing wrong in some of my other scripts. Its time to wrap this one up with version 2.2 and move on to my other projects.

To run this script simply save the file into your Orion scripts folder. Either re-start your Orion Assistant to get the script to show up under "Scripts from folder" or load it from "Script file path" (at least on linux). Select Autostart from the drop down menu and click play. A gump will be displayed showing you a list of options you can edit.

-Items that are red are not setup, click the button beside it and it will turn green or ask for what it needs to get setup.
-When Max Backpack Items is reached, any combination of the following active actions will be performed:
---Turn in Eggs: Will travel to "Rune in Travel Book" and exchange eggs for fey ingots
---Turn in Ingots: Will approach the fey dealer and turn in all ingots for points
---Insure Eggs: Will insure eggs as you pick them up
---Insure Ingots: Will insure any Fey Ingots found in your pack
---Pause When Full: Will cause you to travel to "Rune in Travel Book" then pause the script
---Clicking Recall/Sacred journey will toggle your travel method to the one displayed
---Travel Rune Book: Will ask you to target a new rune book used with "Rune in Travel Book"
---Max Load Screen Delay: Sets the maximum amount of seconds to wait for a lag check to pass
---Delay Before next Recall: Creates a delay after scanning/collecting eggs, and travelling to the next rune
---Rune in Travel Book: This rune will be travelled too any time you go somewhere besides an egg rune
---Use portal for Destard: This will cause you to travel to "Rune in Travel Book", search for and approch, corrupted portal, then say "Dungeon Destard"
---Clicking cancel will return you to the main gump
---Click apply and the settings will be updated
---Selecting default will set all values to false or default.

To get back to the Options penal and make changes later, simply click the pause button on the egg gump, and select 'options' to make any changes.

You can name your rune books "egg book", add they will be cycled through the script automatically. If you don't have any books with that name in your backpack, you will be asked to select a book that contains your egg locations. Simply hit Esc to stop adding books to the list, you can have as many as you want.

If your a more experienced user, or would like to try adding further customization to the script without the risk of breaking it, There are two functions you can safely edit at the top of the script. customCodeOne() will be executed each time you travel, and before you scan for an egg. This allows you to add your own custom additions to the script such as checking for other players, checking your health, for pk's, etc. If your still learning, and make a mistake, simply correct or remove the code in the edit area and you're back to normal. customCodeTwo() works the same way but will be run after completing an egg scan and collecting any eggs and before travelling to the next rune.

The script will recall to each spot in each book, it reads how many runes each book has so they don't need to be full. It will do a quick scan in the area for Eggs and grab any it find before continuing to the next. Once you're pack is full, it will head to rune set in travel book and perform any active actions. This allows you to automatically turn in eggs for ingots, then turn in ingots for points, and continue hunting. You can easily change it to put all the eggs in a bag while collecting, go to a safe spot when pack is full and pause the script. Have it go to a custom spot when you're pack is full and run a custom function you create with the provided functions, like sorting eggs and putting a collection together! Simply edit the options and the script will respond to the updates real time.

You can also assign a hot key to eggScan that will automatically move you to an egg it finds and pick it up if you want to just run around scanning for eggs. To do this, go into your Orion Assistant -> Hotkeys -> Scripts -> Double click here to add new script hotkey. Then, in the box to the right click in the Hotkey: entry and assign your hotkey. Active the "Run one script" box, under script name select the drop down and choose eggScan. You can now use it any time in game as long as the eggHunter.oajs script is active in your Orion Assistant's Scripts tab.

 * Version 2.2
 * -Created travel function to cleanup some code.
 * -General code cleanup
 * -Added Options button while script is paused
 * -Moved all script options to Options panel in game, now even easier to set up!
 * -Added ability to use corrupt portal to get to destard instead of relying on rune book

 * Version 2.1
 * -Added grab bag option, eggs picked up will be put in selected bag if true.
 * -Will now stop walking to egg if pause button is pressed.
 * -Added optional delay between recalls, to uhh slow it down(?).
 * -Can now name rune books to egg book and avoid being asked to target books.
 * -Will no longer be asked for destard book once set, Remove from
 *  OrionAssistant->Lists->Objects->destardBook to be asked for a new book.
 * -Added customCodeOne and customCodeTwo functions to add your own behaviours
 * -Updated gump to display egg count individually

 * Version 2.0
 * -Faster and more responsive than the original!
 * -Better Egg scanning, more range.
 * -Better interaction with NPCs.
 * -Ability to insure eggs/ingots.
 * -Can now toggle EggTurnin and IngotTurnin on/off.
 * -Added pause once pack is full (Will still recall to destard book location first, it does not have to be destard in this case).
 * -Added function to move Eggs from backpack to a container.
 * -Can now switch between recall/sacred journey.
 * -Added Pause/Resume button.
 * -Added ignore egg button (For those porch locked eggs)

 * Version 1.0
 * -Will recall to array of rune books scanning for and picking up eggs.
 * -Will recall to destard book when full and exchange eggs for ingots.
 * -Will turn in eggs for points and continue hunting.
Title: Re: Brute Force Egg Hunter
Post by: The Ghost on May 16, 2022, 09:40:56 PM
Wow  that a nice surprise.  Thx  for sharing this build. 
Title: Re: Brute Force Egg Hunter
Post by: altiric on May 16, 2022, 09:44:12 PM
Wow  that a nice surprise.  Thx  for sharing this build.

 Thanks for the first comment on any script ive ever written lol! They seem to be few and far between.
Title: Re: Brute Force Egg Hunter
Post by: The Ghost on May 16, 2022, 09:50:36 PM
Was trying to accomplish the same via EasyUO, but wasn't able.     The pathfind within Orion, is was superior.   This will kept me busy for a while trying to understand the flow and how to use function.     
Title: Re: Brute Force Egg Hunter
Post by: altiric on May 16, 2022, 09:52:21 PM
The pathfinding is quite impressive, but it was the speed of executing scripts that made me change. Also get access to a lot more information a lot easier :)
Title: Re: Brute Force Egg Hunter
Post by: The Ghost on May 16, 2022, 09:59:23 PM
Event on laggy shard,  client run smooth. 

Hope I read this right, look like you forget to add the VAR eggbook.,  I dont see the place to add my ID. 
Title: Re: Brute Force Egg Hunter
Post by: altiric on May 16, 2022, 10:00:53 PM
You shouldnt need to edit anything in the file, just click Autostart and it will ask you for the info in game :)
Title: Re: Brute Force Egg Hunter
Post by: Gaderian on May 17, 2022, 07:02:47 PM
Orion's built in pathfind routines probably look as good as one could get. I was playing with it for about an hour the other night and it was fun watching it navigate correctly around obstacles.

Did you remove this script intentionally? I wanted to see what you were doing with it, as Orion is new to me. The first post states nothing more descriptive than "Updated", it has the little icon to mean it has an attachment in the thread, but no attachments.

Gaderian
Title: Re: Brute Force Egg Hunter
Post by: altiric on May 17, 2022, 07:40:02 PM
Ran into a glitch... I only tested it on one shard and did not realize every shard used different NPCs. Had to rework a couple things to get it running on all shards. Seems to be working quite smooth now.

Yes, the pathfinding is exceptional. You do run into glitches when you get into really long runs, but there are creative ways around them that still let you pull them off! Something i found really handy was using:
Code: [Select]
if(Orion.WalkTo(x, y, z, dist)){
    //something;
}

will return false if it cannot make it to that location (within dist), that was a game changer!
Title: Re: Brute Force Egg Hunter
Post by: Bulldog on May 17, 2022, 11:49:44 PM
There is an inbuilt function Orion.CanWalk you can use that to see if character can reach the x,y,z before you even start the move
Title: Re: Brute Force Egg Hunter
Post by: altiric on May 18, 2022, 12:23:18 AM
There is an inbuilt function Orion.CanWalk you can use that to see if character can reach the x,y,z before you even start the move

using if(WalkTo) does the same thing but includes the distance check, it will return false if it can not make the walk, will walk if it returns true. :)
Title: Re: Brute Force Egg Hunter
Post by: Bulldog on May 18, 2022, 12:46:06 AM
Ah did not know that! I am trying to get some archer movement going at the moment
Title: Re: Brute Force Egg Hunter
Post by: The Ghost on May 19, 2022, 04:44:55 PM
Simple enough 
I have  a question . what does the 1,255,1 mean
 while(!Orion.WalkTo(egg.X(), egg.Y(), egg.Z(), 1, 255, 1)

Im curious
Title: Re: Brute Force Egg Hunter
Post by: altiric on May 19, 2022, 04:48:35 PM
Simple enough 
I have  a question . what does the 1,255,1 mean
 while(!Orion.WalkTo(egg.X(), egg.Y(), egg.Z(), 1, 255, 1)

Im curious

distanceToObject, Zoffset, walkRun
walkRun / 0 walks, 1 runs, 2 uses client default
Title: Re: Brute Force Egg Hunter
Post by: gruntman on May 19, 2022, 04:49:49 PM
Altiric thanks for your contribution to the community!!

script works well :)
Title: Re: Brute Force Egg Hunter
Post by: The Ghost on May 19, 2022, 04:56:23 PM
Simple enough 
I have  a question . what does the 1,255,1 mean
 while(!Orion.WalkTo(egg.X(), egg.Y(), egg.Z(), 1, 255, 1)

Im curious

distanceToObject, Zoffset, walkRun
walkRun / 0 walks, 1 runs, 2 uses client default

Ok  1 is to run so now what the 255 for?
Title: Re: Brute Force Egg Hunter
Post by: altiric on May 19, 2022, 05:11:05 PM

distanceZ - integer, maximum distance along the Z axis to the end point;
Title: Re: Brute Force Egg Hunter
Post by: The Ghost on May 22, 2022, 04:21:22 PM
Now we have more Red that are waiting for us now.  Time to use that guard macro again.  hehe if I remember to hit it 
Title: Re: Brute Force Egg Hunter
Post by: altiric on May 22, 2022, 04:24:09 PM
lol yeah.. that seems to happen! Did find a simple way to make it even snappier though! If you replace the
Orion.Wait(loadScreenDelay);
with
Orion.CheckLag(loadScreenDelay);
it works even faster, and better in some cases :)
Title: Re: Brute Force Egg Hunter
Post by: Hoby on May 29, 2022, 03:02:44 PM
awesome script.  Works great!  Have collected like 1500 eggs without a hiccup!
Title: Re: Brute Force Egg Hunter
Post by: altiric on May 30, 2022, 02:00:15 AM
Packed some serious upgrades into version 2.0!

Version 2
-Faster and more responsive than the original!
-Better Egg scanning, more range
-Better interaction with NPCs
-Ability to insure eggs/ingots
-Can now toggle EggTurnin and IngotTurnin on/off
-Added pause once pack is full (Will still recall to destard book location first, it does not have to be destard in this case)
-Added function to move Eggs from backpack to a container
-Can now switch between recall/sacred journey
-Added Pause/Resume button
-Added ignore egg button (For those porch locked eggs)
Title: Re: Brute Force Egg Hunter
Post by: gruntman on May 30, 2022, 05:55:14 AM
Altiric,

This version runs very well. It does exactly what it is supposed to do. Love the added features as well. Thank you for your contribution.
Title: Re: Brute Force Egg Hunter
Post by: The Ghost on May 30, 2022, 05:58:39 AM
Thx for the update, will test this tonight. 
Nice option you have added. 

Title: Re: Brute Force Egg Hunter
Post by: TrailMyx on May 30, 2022, 01:02:48 PM
Thanks for the first comment on any script ive ever written lol! They seem to be few and far between.

Good script Brah!  ;)
Title: Re: Brute Force Egg Hunter
Post by: gruntman on June 01, 2022, 03:14:52 PM
WHOA AN UPDATE! Cannot wait to try this one!!

Thanks loads Altiric! Ill let you know
Title: Re: Brute Force Egg Hunter
Post by: BoomerGrow on June 01, 2022, 03:36:36 PM
Wow what a great script! I have ran the first version for a couple of days and I've gotten so many fey ingots.  You are the man! I can't wait to try out the newest version
Title: Re: Brute Force Egg Hunter
Post by: The Ghost on June 01, 2022, 05:47:42 PM
Run the new build,  For the portal, make sure you mark a few title away.   Did 4 run without any issue.   

++ Love the fact that the turn in egg is a bit slower.
+ Move egg to container have alot of must wait for action and need to be restart.  I added a Orion.Wait(400) at the end . need to test more. Work find.

I love it,    Great  build and thx again  for all the hard work you  put into this. 
Title: Re: Brute Force Egg Hunter
Post by: Kandie on June 01, 2022, 09:30:44 PM
Does this only work with Orion program?
Title: Re: Brute Force Egg Hunter
Post by: altiric on June 01, 2022, 09:46:27 PM
Does this only work with Orion program?

Correct, it only works with Orion.
Title: Re: Brute Force Egg Hunter
Post by: mio on June 03, 2022, 08:22:58 PM
哇,真是個驚喜。感謝分享這個版本。
Title: Re: Brute Force Egg Hunter
Post by: Kandie on June 04, 2022, 10:20:56 PM
Title: Re: Brute Force Egg Hunter
Post by: silver111 on June 04, 2022, 11:13:19 PM
does it work with runic atlas too or just rune books? script doesnt start for me after i select everything, but im new to orion as well, so maybe my fault.
Title: Re: Brute Force Egg Hunter
Post by: altiric on June 05, 2022, 05:43:24 AM
does it work with runic atlas too or just rune books? script doesnt start for me after i select everything, but im new to orion as well, so maybe my fault.

It was only setup to use rune books. Atlas' requires a very different setup to use. If you're making it through the settings, the script will start in pause mode by default. There is a button on the bottom right (a circle). Clicking that should have you up and running, clicking it again will re-pause.
Title: Re: Brute Force Egg Hunter
Post by: mio on June 05, 2022, 11:57:51 AM
需要將遊戲切換成英文模式
能在官方伺服器工作嘛?
我以自動啟動方式啟動後他不會工作
Title: Re: Brute Force Egg Hunter
Post by: altiric on June 05, 2022, 12:03:18 PM
需要將遊戲切換成英文模式
能在官方伺服器工作嘛?
我以自動啟動方式啟動後他不會工作

從未嘗試過用另一種語言運行。它只使用遊戲 ID 而不是文本,所以我不知道如何修復它。我現在正在編寫可以使用任何語言的伐木工人腳本
Title: Re: Brute Force Egg Hunter
Post by: mio on June 05, 2022, 12:25:24 PM
Does Orion need a special main program?
Or just use orion's launcher to start the official main program.
I can't find the option to switch to English interface in the game
Forgive my bad English, I can only use google translate
Title: Re: Brute Force Egg Hunter
Post by: altiric on June 05, 2022, 12:28:02 PM
Does Orion need a special main program?
Or just use orion's launcher to start the official main program.
I can't find the option to switch to English interface in the game
Forgive my bad English, I can only use google translate

I am not 100% sure on the language settings for Orion but i do know the Original client uses the operating systems default language, I would assume Orion works the same way.
Title: Re: Brute Force Egg Hunter
Post by: mio on June 05, 2022, 12:36:18 PM
I have changed the original client to English
Direct start is sure to be in English
But after using Orion to start, it magically changes back to Chinese
Title: Re: Brute Force Egg Hunter
Post by: altiric on June 05, 2022, 12:42:10 PM
I have changed the original client to English
Direct start is sure to be in English
But after using Orion to start, it magically changes back to Chinese

Change the language from the main screen of the Orion Launcher. Near the top, right under UO Files path and Orion path. Looks like it only has english and russian to choose from though.
Title: Re: Brute Force Egg Hunter
Post by: mio on June 05, 2022, 05:43:46 PM
Does Orion need a special main program?
Or just use orion's launcher to start the official main program.
I can't find the option to switch to English interface in the game
Forgive my bad English, I can only use google translate

I am not 100% sure on the language settings for Orion but i do know the Original client uses the operating systems default language, I would assume Orion works the same way.
Version 2.2 seems to be unable to find the book I have named egg book
After I manually set the book with version 2.0, the script can work, but after picking up the egg, the insurance egg that is caught in the loop is cancelled.
2.0 How to cancel insurance
Title: Re: Brute Force Egg Hunter
Post by: altiric on June 05, 2022, 05:46:38 PM
line 20: const insureEggs = true;        // Insure eggs on pickup

change true to false

line 20: const insureEggs = false;        // Insure eggs on pickup
Title: Re: Brute Force Egg Hunter
Post by: mio on June 05, 2022, 06:13:20 PM
line 20: const insureEggs = true;        // Insure eggs on pickup

change true to false

line 20: const insureEggs = false;        // Insure eggs on pickup
I figured out why backpacks to When Max Backpack Items won't swap
It's really a language problem. I switch the system to English and it will be exchanged.
But there is another problem, if the egg is exactly 10 at the end of the exchange
Will execute the swap but won't switch it to any item, it will get stuck and repeat the swap

Post Merge: June 07, 2022, 04:46:52 AM
What can I do so that he doesn't Turn in Ingots after executing the egg swap
Then execute the script I set and execute it again
Title: Re: Brute Force Egg Hunter
Post by: altiric on June 07, 2022, 03:30:53 PM
Glad you seem to have gotten most of itbworjed out.
Simple setting ingotTurnin to false will skip that step and continue collecting eggs.
line 20: const insureEggs = true;        // Insure eggs on pickup

change true to false

line 20: const insureEggs = false;        // Insure eggs on pickup
I figured out why backpacks to When Max Backpack Items won't swap
It's really a language problem. I switch the system to English and it will be exchanged.
But there is another problem, if the egg is exactly 10 at the end of the exchange
Will execute the swap but won't switch it to any item, it will get stuck and repeat the swap

Post Merge: June 07, 2022, 04:46:52 AM
What can I do so that he doesn't Turn in Ingots after executing the egg swap
Then execute the script I set and execute it again
Title: Re: Brute Force Egg Hunter
Post by: mio on June 08, 2022, 09:24:23 PM
What can I do to execute a script of my own after the egg swap and continue the original work
Glad you seem to have gotten most of itbworjed out.
Simple setting ingotTurnin to false will skip that step and continue collecting eggs.
line 20: const insureEggs = true;        // Insure eggs on pickup

change true to false

line 20: const insureEggs = false;        // Insure eggs on pickup
I figured out why backpacks to When Max Backpack Items won't swap
It's really a language problem. I switch the system to English and it will be exchanged.
But there is another problem, if the egg is exactly 10 at the end of the exchange
Will execute the swap but won't switch it to any item, it will get stuck and repeat the swap

Post Merge: June 07, 2022, 04:46:52 AM
What can I do so that he doesn't Turn in Ingots after executing the egg swap
Then execute the script I set and execute it again
Title: Re: Brute Force Egg Hunter
Post by: BoomerGrow on June 09, 2022, 10:38:56 PM
I just reached 100,000 eggs.  Thanks to you and keep up the good work
Title: Re: Brute Force Egg Hunter
Post by: 12TimesOver on June 16, 2022, 08:33:48 AM
Thanks for this Altiric! My first forage into the world of Orion :) Had a couple of setup issues but Ghost helped me get them worked out pretty quickly.

One problem I'm noticing with 2.2 is that it doesn't always seem to pay attention to the backpack count limit I've configured in setup (120 for me) and then gets hung up trying to turn-in the first quest because there is no room in the backpack. Not a big deal for me to hit Pause and move an egg but just thought it was worth reporting.

Also, I'm usually left with a quest "Accept" window at the end of each turn-in round which never goes away until I hit "Accept" manually. Doesn't make for an issue, just odd. Wondering if anyone else has noticed it.

But neither of these things are stopping egg-collection mania! I was doing things mostly manually with a couple of helper EUO scripts and this is blowing that process out of the water!

<edit> Now having a new issue. Every time it does the egg turn-in run when there are enough eggs in the backpack for one more turn-in the script never accepts the quest. It seems that it tries to Accept but it gets a "you must wait to perform another action" message over and over.

XII
Title: Re: Brute Force Egg Hunter
Post by: bendel on June 16, 2022, 10:58:50 AM
very nice script!

if I can recommend something.
add at after line 221

        if (Orion.Contains(egg.Properties(), 'Locked Down')){
           Orion.Ignore(egg.Serial());
        }

because some players lock the eggs in theirs house, so the script try to grab it
Title: Re: Brute Force Egg Hunter
Post by: 12TimesOver on June 16, 2022, 05:26:00 PM
One problem I'm noticing with 2.2 is that it doesn't always seem to pay attention to the backpack count limit I've configured in setup (120 for me) and then gets hung up trying to turn-in the first quest because there is no room in the backpack. Not a big deal for me to hit Pause and move an egg but just thought it was worth reporting.
So far only seems to be happening when I have the max pack items set to 124. Backed off and it doesn't have the issue.

Quote
<edit> Now having a new issue. Every time it does the egg turn-in run when there are enough eggs in the backpack for one more turn-in the script never accepts the quest. It seems that it tries to Accept but it gets a "you must wait to perform another action" message over and over.
More info. Only happened when I had exactly 10 eggs left in my pack which was every round since I had 10 items in my pack to start and set my max pack items to 120.

I'm just barely seeing Orion Java for the first time so I'm a little lost but I think it's here, from the eggTurnin function, and this keeps getting called because of the while loop at line 162:

Code: [Select]
162:     while(Orion.Count(eggTypes, any, backpack) >= 10)

385:     if(eggLeft > 0 && nEggs.length > eggLeft){

The "while" loop resolves to #TRUE since >= 10 is met but then the "if" statement is only using > eggLeft instead of >= so never marks the rest of the eggs as Quest Item but tries to turn them in?

Anywho, it's working perfectly fine now that I switched it to 121 instead of 120 but I haven't tried again with the above change yet.


X



Title: Re: Brute Force Egg Hunter
Post by: crashtestdummy on June 17, 2022, 02:24:43 PM
Absolutely one of my favorites!!  Thank you so much for the hard work!  Really enjoy just watching this script go!   :)
Title: Re: Brute Force Egg Hunter
Post by: Diforza on January 04, 2023, 06:20:53 AM
Thank you. Very good script
Title: Re: Brute Force Egg Hunter
Post by: Crisis on January 04, 2023, 02:12:40 PM
I bet you will like it even more when you are able to actually download it. I suggest going to the new members section, look at the stickied posts and make a good introduction.
Title: Re: Brute Force Egg Hunter
Post by: kang on November 09, 2023, 05:46:07 PM
Ty Sir.