ScriptUO

Official ScriptUO EasyUO Scripts => Script Library => Questing => Topic started by: gen2000 on October 17, 2009, 01:50:58 PM

Title: Gen's Library Donations
Post by: gen2000 on October 17, 2009, 01:50:58 PM
Code: [Select]
;===========================================================================
; Script Name: Gen's Library Donations
; Author: Gen2000
; Version: 1.5
; Client Tested with: 7.0.1.1
; EUO version tested with: 1.5 155
; Shard OSI/FS: OSI
; Public Release: 11/1/09
; Revision Date:
; Global Variables Used: CEO*FILESYSTEM
; Purpose: Recalls to smith/mage shops, buys axes/spell books,
;          Recalls to library & donates for glasses
;
; Glasses: Mace & Sheild, Wizard's Crystal , Fold & Steel
;===========================================================================
; http://www.scriptuo.com
;===========================================================================
; Special Thanks:
;---------------------------------------------------------------------------
; Author:  snicker7
; Script Name:  sub s7UseRunebook
;---------------------------------------------------------------------------
; Author:  Quintok / Raziel
; Script Name: sub waitForSysVars
;---------------------------------------------------------------------------
; Author  CEO
; Script Name: Sub CEO*FILESYSTEM
;===========================================================================
; Items Needed:
; Backpack:     2 Rune Books, 1 bank/library runes, and 1 with vendor shops.
;===========================================================================
; Instructions:  Bank/Library runebook should have rune to bank and library.
;                    Library rune should be marked within 4 tiles of NPC.
;                    Vendor runebook should have runes marked to vendor shops.
;                    Start off at any bank, click play and follow menu.
;===========================================================================
; Tips:  *Do not start with more than 3k gold in pack. (my be ok with new weight of gold)
;         *Remove all battle axes you may want to keep from your pack.
;         *Remove all spellbooks from your pack if donating to mage and..
            Put the spellbook your using in your hand!
;         *Mark Library runes within 4 tiles of the NPC.
;===========================================================================


This script donates to the library.
It has a menu for easy setup, and keeps track of all your settings and points globally.
One time setup per char, per glasses.

Title: Re: Gen's Library Donations
Post by: Abyss on October 18, 2009, 12:16:47 PM
I'll try to test this when I have a few hours to watch it. Probably will be Tuesday.
Title: Re: Gen's Library Donations
Post by: googlemybrains on October 28, 2009, 07:31:15 AM
It works for the most part.


Great script for about 1 hour or so then locks up.


The script (Im doing Mace and Shields) Will at times miss the Elias (The Library assistant) when your standing right next to him.

Also at times the script will just seem to get off track. it will take the gold open rune book recall and just stop. Its usually good for about 120k in points before I have to restart the script.

overall good though. just wish i didnt have the issues. Ill post more as I go along. Next time in pauses Ill go ahead and post the script were it locks up.

Post Merge: October 28, 2009, 10:14:05 PM
Just to add:


The script keeps on Locking up

Msg:  Not close Enough to Elias-FIX IT- Script Paused. (Mace and Shields)




Im standing right next to him.

Anyway to fix this?
Title: Re: Gen's Library Donations
Post by: gen2000 on October 29, 2009, 11:25:28 AM
I'll check it and see
Title: Re: Gen's Library Donations
Post by: googlemybrains on October 29, 2009, 07:52:53 PM
Its a FANTASTIC script, but it will go for about 1 hour or so, mostly stops at right around 100k in points.

I play EA Shard, And I will recall right next to Elias, and i have changed spots, and it will say Msg:  Not close Enough to Elias-FIX IT- Script Paused. (Mace and Shields).

So again, thanks Gen anyway I can help LMK.

Post Merge: October 30, 2009, 03:18:21 PM
This is were it is stopping at. Buys axes, then goes to library and just stops.


    }
  }
namespace pop
return #true

sub s7ScanJournalFor
  set !SJFje #jindex + 1
  for !SJFji %1 !SJFje
  {
    scanjournal !SJFji
    for !SJFpi 2 %0
    {
      if % . !SJFpi in #journal
        return #true
    }
  }
return #false

Post Merge: October 30, 2009, 09:29:17 PM
Im thinking it might have something to do with my sleep setting on my computer. I have switched it and everything seems to be running well. I am at 220k of points and its been hit and miss in the start but now over 150k of points without a hitch.
Title: Re: Gen's Library Donations
Post by: gen2000 on October 31, 2009, 08:02:55 PM
So it's working fine now?
Title: Re: Gen's Library Donations
Post by: googlemybrains on November 01, 2009, 06:56:22 AM
I still have some locking issues, about not finding Elias, but it seems to be less frequent.
Title: Re: Gen's Library Donations
Post by: gen2000 on November 01, 2009, 10:31:04 AM
The script uses event property to find the correct npc caues their IDs are different per shard.

I added a check that I hope will fix your random issue.
Title: Re: Gen's Library Donations
Post by: googlemybrains on November 04, 2009, 08:21:22 AM
I think for the most part its on my part now.


I have issues with lag at times and thats when it seems to really get jammed up sometimes.
Title: Re: Gen's Library Donations
Post by: googlemybrains on November 07, 2009, 07:00:45 AM
Okay Ive watched it now for 6 hours and I see the issue.

Recall to Library

Due to lag it takes 4-5 sec's (sometimes) to the char to arrive.

Stands at Library looking for Library assistant.




Is there a way I can delay the "looking for" The assistant?
Title: Re: Gen's Library Donations
Post by: gen2000 on November 07, 2009, 07:24:16 AM
Okay Ive watched it now for 6 hours and I see the issue.

Recall to Library

Due to lag it takes 4-5 sec's (sometimes) to the char to arrive.

Stands at Library looking for Library assistant.




Is there a way I can delay the "looking for" The assistant?

find the donate sub..

Code: [Select]
sub donate
;===============================
wait 5s ;<-------------- Add a wait here.
;===============================
set %status Donating...
gosub menu_refresh
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
donate:
Title: Re: Gen's Library Donations
Post by: googlemybrains on November 09, 2009, 07:32:18 AM
Seems to be unstopable now   ;D
Title: Re: Gen's Library Donations
Post by: googlemybrains on November 09, 2009, 07:52:23 AM
And again thank you!
Title: Re: Gen's Library Donations
Post by: gen2000 on November 09, 2009, 08:28:08 AM
And again thank you!

Your welcome  ;)
Title: Re: Gen's Library Donations
Post by: Dontrunmeover on November 16, 2009, 06:20:04 PM
Script is working great for me. I've had no problems with it at all.

Maybe I'm doing something wrong in the setup/config, but is there
a way to have it keep going to vendors until it had bought the max #
of items specified?
Right now, it will go to a vendor, grab the 20 he has, then go directly to the library
to donate those. I know as axes respawn the vendors will have 40,60 etc.
but it takes a bit of time before those respawnings happen, and I've noticed that some vendors
(at least on my shard) don't respawn with a greater number, they are sometimes respawning with the same 20.
Title: Re: Gen's Library Donations
Post by: diff on December 25, 2009, 06:23:34 AM
Since my character is able to blacksmith, he is pressing the wrong button on the vendor menu, and instead trying to get a Bulk Order Deed.

I resolved this by dropping the 0.1 point of blacksmithy.

Now that he's buying axes, I'm still not able to Sacred Journey to the library, as it's always giving me "Something is blocking that location."

Where are people marking their runes to be able to donate?
Title: Re: Gen's Library Donations
Post by: gen2000 on December 25, 2009, 06:47:43 AM
You'll just have to play around with your runes..
Title: Re: Gen's Library Donations
Post by: 12TimesOver on December 25, 2009, 07:02:42 AM
Hey Gen, on the BS thing, in my library donator I set a check for BS skill > 0 then adjust an offset for the vendor menu by 20 if BS = #TRUE. Works like a champ with very few lines of code ;) and let's us BOD-obsessed UO'rs continue with our .1 BS on every char for an hourly BOD hehe.



X
Title: Re: Gen's Library Donations
Post by: gen2000 on December 25, 2009, 07:15:49 AM
Hey Gen, on the BS thing, in my library donator I set a check for BS skill > 0 then adjust an offset for the vendor menu by 20 if BS = #TRUE. Works like a champ with very few lines of code ;) and let's us BOD-obsessed UO'rs continue with our .1 BS on every char for an hourly BOD hehe.

X

Good idea, I think I have a check like that in my auto item buyer so you don't try to get a bod instead of buying. I'll add that when all this Christmas stuff is over!!
Title: Re: Gen's Library Donations
Post by: diff on December 25, 2009, 06:02:14 PM
You'll just have to play around with your runes..

Are you suggesting that after some trial and error I will find a working spot?

Just to clarify myself a bit more, I am unable to mark a location near Vincent the Warrior that I am able to recall to. I've tried several spots in his vicinity and it's always telling me "Something is blocking the location." It seems to me that the entire library and surrounding few tiles are non-recall-able.

Have you experienced this?  Do you happen to have the coordinates of a working location?
Title: Re: Gen's Library Donations
Post by: gen2000 on December 25, 2009, 06:46:16 PM
I hadn't used it in a LONG time so maybe they changed something. I'll try to do some testing some time this weekend and see what's up. I've never had any problems recalling into the library.
Title: Re: Gen's Library Donations
Post by: kenshin87 on January 18, 2010, 09:35:53 PM
hey gen so i was just testing out your script and it seems to run flawlessly up until the point of donating. it grabs the battles axes and then as soon as it recalls into the lirbary it says that it is not close enough to sven. i am having a bit of trouble to find a sven to begin with lol. i was wondering if thats another battle axe guy or maybe i am doing something wrong. thanks a lot
Title: Re: Gen's Library Donations
Post by: kenshin87 on January 18, 2010, 09:39:46 PM
answered my own question haha. i just changed the name. sorry for the wasted post silly me
Title: Re: Gen's Library Donations
Post by: Cerveza on January 24, 2010, 08:22:34 PM
I had to make a change to get this to work, just starting testing.

exevent popup %vendorid
wait 20
click 20 40

had to be changed to

exevent popup %vendorid
wait 20
click 20 55

Or it would just try to give me bods.
Title: Re: Gen's Library Donations
Post by: Cerveza on January 25, 2010, 05:12:51 AM
I'd also suggest that you do the library runes the same way you do the vendor runes. Have the user set the first X runes in the runebook to different positions around the Library, then cycle through them the same way you cycle through the vendors.

You could actually set it up to use a single runebook. Have 1 - X be the Library, X - Y be the Vendors, and Z be the bank (or Z - A)

That way if one place is blocked it would cycle to the next.
Title: Re: Gen's Library Donations
Post by: EekAMacro on March 26, 2010, 02:56:09 AM
How can I get euo to tell me what's the ID of a determinate NPC?
Title: Re: Gen's Library Donations
Post by: Cerveza on March 26, 2010, 03:26:00 AM
Use a find info tool.
Title: Re: Gen's Library Donations
Post by: TrailMyx on March 26, 2010, 08:48:04 AM
How can I get euo to tell me what's the ID of a determinate NPC?

Mine is nice because you can cut/paste the information from the text edit boxes.

http://www.scriptuo.com/index.php?topic=188.0;highlight=find+info
Title: Re: Gen's Library Donations
Post by: EekAMacro on March 26, 2010, 10:16:25 AM
Great tool, thx
Title: Re: Gen's Library Donations
Post by: EekAMacro on April 18, 2010, 01:36:29 PM
what can I say, script is wonderful. I managed to get wizard's crystal in 4 days playing this beauty. Now I moved to mace&shield but it seems there's a problem with the buying axes moment: often when char is at vendor and scrolls down the item list, when it gets to the battle axes instead of buying them it signs the contract but without selecting them in the buying window. This doesn't happens everytime but often, thus slowing the script. I tried to stop the script at that moment to see if I could figure out how to fix this; it had stopped at:
if #SHOPITEMPRICE > %MAX_PRICE
{
   click %x_next %y_next
   goto skip
}

So I thought to go find what's this value of MAX_PRICE, thinking that the script could halt because battle axes in fel vendors have often different prices. The value was 23, and I remembered that I saw battle axes at around 26 or something so I tried to change the value to 40, but then the script bought me bardiches instead of axes. So I left the value at 23.
Anyway is anyone experiencing this same problem?
Title: Re: Gen's Library Donations
Post by: anewbe4u on April 25, 2010, 09:24:24 AM
How many axes do you have to buy to get the glasses? Is it a lot cheaper than just giving the guy the gold?
Title: Re: Gen's Library Donations
Post by: enclava on April 26, 2010, 02:04:07 AM
The script uses event property to find the correct npc caues their IDs are different per shard.

I added a check that I hope will fix your random issue.

hey i have similar problem with finding npc for mace and shield i have different name of them and here is my question? How i can obtain this ID from NPC?
Title: Re: Gen's Library Donations
Post by: kenshin87 on April 26, 2010, 06:59:57 PM
you can obtain the ID by using different tools located within the site. such as http://www.scriptuo.com/index.php?topic=188.0 (http://www.scriptuo.com/index.php?topic=188.0) hope that helps
Title: Re: Gen's Library Donations
Post by: EekAMacro on April 27, 2010, 03:17:09 AM
It's sufficent to change the set %NPC_axe (or spellbook or nodachi) name to fix that problem. I had william instead of willem for the wizard's crystal, just changed that value and fixed it
Title: Re: Gen's Library Donations
Post by: shinwarrior on April 29, 2010, 03:46:48 PM
It seems I cannot mark a rune near mace and shield npc. Anyone using the script are recalling in front of the library and run repeatedly.
Does anyone know or have this type of script? or have any solution with this one?
Title: Re: Gen's Library Donations
Post by: iain on May 24, 2010, 12:00:33 PM
works perfectly for me, just had to change vendors name. outstanding thnx
Title: Re: Gen's Library Donations
Post by: vwheeler78 on May 29, 2010, 05:00:34 PM
This was working great up until the menu change for turning in entire bags. Now it stops on the menu gump. When I select the mage book it will find it in my pack and turn in and bring up the gump again and do nothing until I select the mage book again. Im not sure what values I need to change. Help!
Title: Re: Gen's Library Donations
Post by: bt0060 on May 29, 2010, 10:42:23 PM
thanks,.... good script for me
Title: Re: Gen's Library Donations
Post by: googlemybrains on August 11, 2010, 04:24:02 PM
Its acting like it cant find the donate button. Everything works flawless, untill I arrive then it appears to try but its not clicking the correct area in the gump. any ideaS?
Title: Re: Gen's Library Donations
Post by: Cerveza on August 12, 2010, 05:10:56 AM
Maybe the gump size or the position of the selection within the gump has changed.

It would be pretty easy for you to figure it out.

Do this:

1 - open the gump you are concerned with
2 - run this script in EUO

Code: [Select]
contpos 0 0
halt

Look at the container size now, does it match what is in the script for the container (gump) size?

Now hover your cursor over the button you want to press and look at EUO to determine where the x and y coordinates are. Are they in the same area as called by the script?
Title: Re: Gen's Library Donations
Post by: googlemybrains on August 12, 2010, 07:00:27 PM
you are a freaking genius, I owe you paypal. email me, I mean damn I might aswell be straight retarded.


Thanks again my friend.
Title: Re: Gen's Library Donations
Post by: googlemybrains on August 12, 2010, 07:01:41 PM
This is the part that has changed for mace and shields



   set #ltargetid #findid
   set #ltargetkind 1
   if %donationtype = Warrior || %donationtype = mage
   {
      set %x #CONTPOSX + 39
      set %y #CONTPOSY + 300

      click %x %y
      target 2s
      event macro 22 0




Title: Re: Gen's Library Donations
Post by: Cuemif on October 26, 2010, 10:45:43 PM
On my shard I when the axe button is pressed it will ask you to say how much you wish to donate, is this true to everyone else? ( first time doing this quest ) If so ,here is my problem . I recall into donate it opens the donation gump. the counter in script states I am donation BUT I am not script says I have 3000 points when I really have 0 . I am not sure what to do here .. Sorry again for my noobness
Title: Re: Gen's Library Donations
Post by: Khameleon on November 03, 2010, 06:02:07 PM
thanks for what? must have acquired this script in some other manor.. to bad you don't have any support....
Title: Re: Gen's Library Donations
Post by: TrailMyx on November 03, 2010, 06:03:25 PM
thanks for what? must have acquired this script in some other manor.. to bad you don't have any support....

heh, I already deleted the post before you got to it.  It's amazing how many of those "thanks" posts I kill. 
Title: Re: Gen's Library Donations
Post by: wx1x on December 29, 2010, 12:11:40 AM
nice stuff!!!!!!!!!!!!!!
Title: Re: Gen's Library Donations
Post by: telboy on March 09, 2011, 12:59:12 AM
I try to donation NO-DACHI .BUT its cant find the no dachi in donation-npc,how can i solve this program?

ya i found the program
change to this
if %donationtype = Warrior2
   {
      set %x #CONTPOSX + 306
      set %y #CONTPOSY + 343
      click %x %y
      click %x %y
      set %x #CONTPOSX + 39
      set %y #CONTPOSY + 266
Title: Re: Gen's Library Donations
Post by: jdsmith624 on April 08, 2011, 05:18:06 PM
Nice Script, thanks!
Title: Re: Gen's Library Donations
Post by: cutter on June 05, 2011, 05:58:06 AM
Great script I wish it could make axes for donation with blacksmithing instead of buying them.  any suggestions? 

I have really good smith and lots of ingots. a little low on gold. LOL
Title: Re: Gen's Library Donations
Post by: Goliath on September 01, 2011, 06:30:56 AM
This script is an absolute beaut!! 

For those of you looking to obtain the Mace and Shield Glasses there was 2 adjustments that I had to make that are found in the forum here.  Since a lot of people will forward to the end of the reader comments I am going to post those here and hopefully save some players a little time.

1)  If you are getting a message when you recall into the library that you "cannot find _____" then you need to change the name of the donation vendor within the script to match the vendor you are donating to.  Simply open the script press "cntrl + F" and type in the name of the person it CANNOT find in error message.  Replace that name with the appropriate vendor name you are donating to and you are good to go.

2)  The x,y coords was a little off and need to be adjusted. 

 set #ltargetid #findid
   set #ltargetkind 1
   if %donationtype = Warrior || %donationtype = mage           <---- Make sure you are looking at this line!!
   {
      set %x #CONTPOSX + 39
      set %y #CONTPOSY + 300
      click %x %y
      target 2s
      event macro 22 0

This script has a great menu!!  Loving it
Title: Re: Gen's Library Donations
Post by: Homario on September 10, 2011, 06:19:52 AM
Anyone having an issue with this script after the last round of patches?  Mine can not seem to find the vendor.  I have checked the vendor type and it seems ok.  Any thoughts?
Title: Re: Gen's Library Donations
Post by: Khameleon on September 10, 2011, 08:45:28 AM
Anyone having an issue with this script after the last round of patches?  Mine can not seem to find the vendor.  I have checked the vendor type and it seems ok.  Any thoughts?

check out this Post (http://www.scriptuo.com/index.php?topic=3028.msg72165#msg72165)
Title: Re: Gen's Library Donations
Post by: Homario on September 10, 2011, 09:09:17 AM
Anyone having an issue with this script after the last round of patches?  Mine can not seem to find the vendor.  I have checked the vendor type and it seems ok.  Any thoughts?

check out this Post (http://www.scriptuo.com/index.php?topic=3028.msg72165#msg72165)

I guess I should have been clearer...The script was working great before the patches, now I can no longer find/locate the vendors who sell the axes, nor can I locate the turn in vendor.  My character will recall to the correct location but is unable to find the vendors.  I have the vendor type set at IS_HS but am unable to find them. 

I have always been unable to find/locate gargoyle vendors, now I can not locate any vendor.

I do have the turn in vendor's name correct.
Title: Re: Gen's Library Donations
Post by: Ultima on September 10, 2011, 09:16:40 AM
Khameleon I think that was the wrong link to the other post if your referring to C2's where I was having similiar issues. I still need to test...

Homario from what I'm being told they changed the findrep from 7 to 255. You nee to go through the script and find all instances of findrep 7 and replace it with 255.

Try that and see if it works!

If not come back here and maybe one of our Jedi Master's can narrow it down. :)
Title: Re: Gen's Library Donations
Post by: Homario on September 10, 2011, 09:27:18 AM
Khameleon I think that was the wrong link to the other post if your referring to C2's where I was having similiar issues. I still need to test...

Homario from what I'm being told they changed the findrep from 7 to 255. You nee to go through the script and find all instances of findrep 7 and replace it with 255.

Try that and see if it works!

If not come back here and maybe one of our Jedi Master's can narrow it down. :)

Thanks I will give it a shot.
Title: Re: Gen's Library Donations
Post by: Khameleon on September 10, 2011, 09:37:23 AM
oh ok.. I take my post back then :)
Title: Re: Gen's Library Donations
Post by: Homario on September 10, 2011, 09:45:29 AM
Ok there were 2 instances where it needed to be changed,
1st

if #FINDREP <> 255
{
   ignoreitem #findid 3
   goto findvendor
}
set %vendorid #findid
event Property #findID
if %vendorname notin #property || quest in #property || banker in #property || minter in #property
{
   ignoreitem #findid 3
   goto findvendor
}

and 2nd

if #findrep <> 255
{
   ignoreitem #findid player
   goto donate
}
event property #findid
if #property = $
   goto donate
if %donate notin #property

Working great now...thanks for the information!
Title: Re: Gen's Library Donations
Post by: Ultima on September 10, 2011, 09:50:59 AM
We're here to help!

Thank MeWonUO and Gimlet they were the ones who informed me about the change. Me...I know very little.  ???

Thanks for providing feedback and posting the code and confirming that it does indeed correct the problem!
Title: Re: Gen's Library Donations
Post by: HardY- on October 24, 2011, 10:11:47 AM
i'm doing some tests, how much vendors are necessary on 999 to when i buy all from the last, the first was free to buy again? anyone can tell to me how much mins is the respawn of item to i make some calcs.
Title: Re: Gen's Library Donations
Post by: krisn on November 04, 2011, 05:10:35 PM
great job. TY
Title: Re: Gen's Library Donations
Post by: bariss77 on November 09, 2011, 03:59:08 PM
good work ;D
Title: Re: Gen's Library Donations
Post by: HardY- on December 12, 2011, 08:43:50 PM
don't working on last patch, the find vendor is with problem, "ps i have allready fix the findrep thing."

=D i found the error is juts change to


if #findrep <> 7

Again =[
Title: Re: Gen's Library Donations
Post by: teruteru17 on December 22, 2011, 08:43:03 PM
me too. dont work now.
it seems cant find vendors...
Title: Re: Gen's Library Donations
Post by: HardY- on December 22, 2011, 10:53:58 PM
me too. dont work now.
it seems cant find vendors...

If you READ my post, you will find the fix.
Title: Re: Gen's Library Donations
Post by: Gaderian on February 10, 2012, 08:56:05 AM
Script works very smoothly. Thanks!

There were 2 things that needed adjustment. First one was the offset for the donation gump. The fix is posted by another on the previous page in the replies, so I won't repeat it here.

My character had blacksmithing skill, so the vendor interface inserts getting Bulk Order Deeds, and now, Bribes. I fixed this by removing the blacksmith skill from my character. After I am done I will restore it. I suppose the script could be adjusted to detect and compensate for the different menu, but my fix worked for me. I do not have a legendary blacksmith with whom I make the donations (my skill is merely .1 to acquire BODS), but another may run into the same issue and this hint may work for them.
Title: Re: Gen's Library Donations
Post by: nikki on June 04, 2012, 02:30:00 PM
hey thanks for the script, once i debugged the common issues it has ran flawlessly. Only question i have is that my character will only buy axes from one vender usually 20 axes then recalls to library and donates. Rinse and repeat. Is there a way to make it buy from more than one vendor or is this working as intended?
Thanks in advance.
Title: Re: Gen's Library Donations
Post by: madatu on August 12, 2012, 07:09:48 PM
I had to make a change to get this to work, just starting testing.

exevent popup %vendorid
wait 20
click 20 40

had to be changed to

exevent popup %vendorid
wait 20
click 20 75

Or it would just try to give me bods.

C2 i just copied what you had on page 2 adding a little more. I also had to change the npc name. but other than that it is working !
Title: Re: Gen's Library Donations
Post by: v1duk4 on November 18, 2012, 02:24:29 PM
Hi!!, how can i download the script? i dont see the link =((
Title: Re: Gen's Library Donations
Post by: Cerveza on November 18, 2012, 07:58:43 PM
You won't until you follow the rules.

Strike one.
Title: Re: Gen's Library Donations
Post by: NObama on November 18, 2012, 09:21:37 PM
You won't until you follow the rules.

Strike one.

*munches popcorn*  I love watching how these turn out.
Title: Re: Gen's Library Donations
Post by: v1duk4 on November 21, 2012, 02:06:15 PM
Title: Re: Gen's Library Donations
Post by: Magier on December 21, 2012, 07:07:16 PM
Has anyone messed with moding this to donate Bokutos instead of NO Dachi's or donating both? 

Bokutos are 8 pts for 15 gp
No dachi's are 27 pts for 73gp

Bokutos are cheaper overall for the folded steels.

Title: Re: Gen's Library Donations
Post by: kinghen on January 26, 2013, 06:44:38 PM
Outstanding script.

In addition to the changes already listed, one more was needed for me to use this successfully.  Kept trying to get me to train skills :P

Changed it to this and it works perfectly.

exevent popup %vendorid
wait 20
click 20 45 (was 75)
Title: Re: Gen's Library Donations
Post by: Magier on April 15, 2013, 05:14:21 PM
With the changes to EUO to 238 I'm no longer able to get this to run at all, it sets the status, bag and paperdoll then just sits, it doesn't ask if i want to redo setup or anything.  I've tried re-downloading it and same problem, also tried on a 2nd computer with same results.

If anyone has the same problem or a fix it'd be appreciated.
Title: Re: Gen's Library Donations
Post by: gimlet on April 15, 2013, 05:49:48 PM
I have got very few scripts to run with new EUO
Title: Re: Gen's Library Donations
Post by: TrailMyx on April 15, 2013, 06:31:38 PM
Any clue on what part of the scripting process isn't working, Gim? 
Title: Re: Gen's Library Donations
Post by: gimlet on April 15, 2013, 06:58:41 PM
I think first any that used the status gump might be acting weird.
The faf was not looting the serps.
there is more  - but now it doesn't matter since we have another patch
Title: Re: Gen's Library Donations
Post by: Ganesh89 on May 13, 2013, 10:21:38 PM
Gimlet any heads-up on this one.....? could it be something changed in the waitForSysVars sub? The script seems to stop there....
Title: Re: Gen's Library Donations
Post by: gimlet on May 14, 2013, 04:42:28 AM
I have not had any problems lately, are you still having problems with this script?
Title: Re: Gen's Library Donations
Post by: Ganesh89 on May 14, 2013, 04:01:06 PM
yep i do.....it just sits there after adjusting statusbar and backback.....setup won't come up....
Title: Re: Gen's Library Donations
Post by: roadrunner on May 17, 2013, 01:50:27 PM
well, i just ran across this script as well, and yepp, decided to give it a whirl. i loaded it, went to bank, clicked play, and it moved my backpack, opened my status bar (life bar) and then it ceased to do anything at all. i re-checked the instructions, started it again, same result.
Title: Re: Gen's Library Donations
Post by: Magier on July 17, 2013, 08:08:35 PM
the status gump has increased in size so you need to adjust the size of the status gump window for it to recognize your chars right properties
Title: Re: Gen's Library Donations
Post by: chocobutter on July 18, 2013, 01:18:49 AM
THANK YOU! been looking for one of these for a while now... this will make it very convenient to make my sampire suits... is there anyway to modify it to do the necrobooks instead though? i want about four paids of the nocternal glasses for a nakid mage :D thank you for the release i love it works perfectly 10/10
Title: Re: Gen's Library Donations
Post by: cosmbot on July 23, 2013, 08:17:02 AM
I couldnt able to work this script. i start play moves status and backpack and sits like forever menu isnt come up.
EuO 241 EA.I did the fixes at previous messages any one can help?
Title: Re: Gen's Library Donations
Post by: cherrios on August 21, 2013, 02:42:14 PM
How do we change the size of the status gump
Title: Re: Gen's Library Donations
Post by: TrailMyx on August 21, 2013, 06:16:47 PM
Locate the "openstatusbar" sub and change this line:

Code: [Select]
gosub WaitForSysVars CONTSIZE = 432_184 CONTNAME = status_gump

to the proper value.  I don't know what the size of the existing gump is, but it's easy to find out.  Just have EUO running and single click your status gump.  From there, just look at the value of #CONTSIZE.
Title: Re: Gen's Library Donations
Post by: vanzelus on September 13, 2013, 07:56:54 AM
Hi, I guess the owner of this script no longer support this?  I was wondering how to add in a subscript that will allow for the tinkering of the axes and donate, instead of buying them....I'm still new at scripting so don't really know where to start...thanks.
Title: Re: Gen's Library Donations
Post by: 12TimesOver on September 13, 2013, 10:26:37 AM
Hi, I guess the owner of this script no longer support this?  I was wondering how to add in a subscript that will allow for the tinkering of the axes and donate, instead of buying them....I'm still new at scripting so don't really know where to start...thanks.
Correct, the author has not been around for quite some time.

What you are asking to do is not a simple feature add anyhow, it is a pretty major change.

I don't understand why you'd want to do this anyhow to be honest (and you're not the first person to ask). I did a cost analysis on this once *digs out spreadsheet* based crafting at 10 gold per iron ingot (what I'm seeing as the current "general" rate).

For M&S -

Buckler Purchased
Points: 9
Cost: 47
Total needed: 88,889
Total Cost: $4,177,778
Total Trips at 300 Stones per Trip (just a baseline number for reference): 1,482
Total Time: The time it takes to recall, buy, recall, and turn in 1,482 times +/-

Buckler Crafted
Points: 9
Cost: 100 (10 ingots x 10 gold)
Total needed: 88,889
Total Cost: $8,888,900
Total Ingots: 888,890
Total Trips at 300 Stones per Trip (just a baseline number for reference): 1,482
Total Time: The time it takes to craft, recall, and turn in 1,482 times +/-.

Consider 300 stones at 5 stones per buckler is 60 bucklers. If you could bang out a buckler every second and never had to restock or make new smith tools (yep, impossible but..hey, what if) you would be looking at a minute of crafting for every trip. This means you would be CRAFTING ALONE for 24.7 hours plus down times, ingot restocking, tool crafting, etc. Then you would still have delivery time (but that exists in either scenario so we can call that a wash).

Obviously Battle Axes's are the better choice so here is a breakdown:

Battle Axe Purchased
Points: 9
Cost: 22
Total needed: 88,889
Total Cost: $1,955,556
Total Trips at 300 Stones per Trip (just a baseline number for reference): 1,185
Total Time: See above discussion

Battle Axe Crafted
Points: 9
Cost: 140 (14 ingots x 10 gold)
Total needed: 88,889
Total Cost: $12,444,460
Total ingots: 1,244,446
Total Trips at 300 Stones per Trip (just a baseline number for reference): 1,185
Total Time: See above

As you can see, clearly it is MUCH more cost and time (and time = more cost) effective to sell your ingots and BUY the turn-in items. In fact, considering the going rate is roughly 8-10mil for the glasses, I would argue that crafting them causes you to lose money.

And this doesn't even take into account the time gone in to mining. There is no way you can mine 1,000,000 +/- ingots per day without several accounts script mining at once. Oh, and don't forget the cost of crafting enough tools to make that many items, I didn't include that!

I know that sometimes playing the game is more about self sufficiency. Learn to mine, learn to craft, use all this stuff to get some glasses. It's not for making money, etc, etc, etc it's just to do it all myself! The issue is that with sufficiency comes inefficiency and scripting is ALL ABOUT efficinecies IMO.

Of course this is only one nerd's rant lol.

X
Title: Re: Gen's Library Donations
Post by: vanzelus on September 13, 2013, 11:02:24 AM
Hi, I guess the owner of this script no longer support this?  I was wondering how to add in a subscript that will allow for the tinkering of the axes and donate, instead of buying them....I'm still new at scripting so don't really know where to start...thanks.
Correct, the author has not been around for quite some time.

What you are asking to do is not a simple feature add anyhow, it is a pretty major change.

I don't understand why you'd want to do this anyhow to be honest (and you're not the first person to ask). I did a cost analysis on this once *digs out spreadsheet* based crafting at 10 gold per iron ingot (what I'm seeing as the current "general" rate).

For M&S -

Buckler Purchased
Points: 9
Cost: 47
Total needed: 88,889
Total Cost: $4,177,778
Total Trips at 300 Stones per Trip (just a baseline number for reference): 1,482
Total Time: The time it takes to recall, buy, recall, and turn in 1,482 times +/-

Buckler Crafted
Points: 9
Cost: 100 (10 ingots x 10 gold)
Total needed: 88,889
Total Cost: $8,888,900
Total Ingots: 888,890
Total Trips at 300 Stones per Trip (just a baseline number for reference): 1,482
Total Time: The time it takes to craft, recall, and turn in 1,482 times +/-.

Consider 300 stones at 5 stones per buckler is 60 bucklers. If you could bang out a buckler every second and never had to restock or make new smith tools (yep, impossible but..hey, what if) you would be looking at a minute of crafting for every trip. This means you would be CRAFTING ALONE for 24.7 hours plus down times, ingot restocking, tool crafting, etc. Then you would still have delivery time (but that exists in either scenario so we can call that a wash).

Obviously Battle Axes's are the better choice so here is a breakdown:

Battle Axe Purchased
Points: 9
Cost: 22
Total needed: 88,889
Total Cost: $1,955,556
Total Trips at 300 Stones per Trip (just a baseline number for reference): 1,185
Total Time: See above discussion

Battle Axe Crafted
Points: 9
Cost: 140 (14 ingots x 10 gold)
Total needed: 88,889
Total Cost: $12,444,460
Total ingots: 1,244,446
Total Trips at 300 Stones per Trip (just a baseline number for reference): 1,185
Total Time: See above

As you can see, clearly it is MUCH more cost and time (and time = more cost) effective to sell your ingots and BUY the turn-in items. In fact, considering the going rate is roughly 8-10mil for the glasses, I would argue that crafting them causes you to lose money.

And this doesn't even take into account the time gone in to mining. There is no way you can mine 1,000,000 +/- ingots per day without several accounts script mining at once. Oh, and don't forget the cost of crafting enough tools to make that many items, I didn't include that!

I know that sometimes playing the game is more about self sufficiency. Learn to mine, learn to craft, use all this stuff to get some glasses. It's not for making money, etc, etc, etc it's just to do it all myself! The issue is that with sufficiency comes inefficiency and scripting is ALL ABOUT efficinecies IMO.

Of course this is only one nerd's rant lol.

X

Definitely understand your point but the reason I asked is because I have loads of iron ingots sitting around and taking up space....there are no other uses for them that I consider worth doing; donating them to clean up is a no no as the conversion rate is horrible, 60k ingots for 6k points YIKES!  I can donate directly to the library but again, the rewards from doing so are worthless.  Thus is why I wanted to see if a smith/tool tinker subscript can be added to this as I think that would be an excellent use of ingots :)
Title: Re: Gen's Library Donations
Post by: 12TimesOver on September 13, 2013, 04:48:56 PM
Sell them at half the going rate and you will have enough $ for 2 Mace and Shields using the same amount of ingots you would burn on only one.
Title: Re: Gen's Library Donations
Post by: vanzelus on September 13, 2013, 05:27:04 PM
Sell them at half the going rate and you will have enough $ for 2 Mace and Shields using the same amount of ingots you would burn on only one.

True, hopefully they will sell as my shard is like a ghost town at the moment lol...btw, love the clip under your name, did that guy broke his entire face?  I feel bad but can't help laughing.
Title: Re: Gen's Library Donations
Post by: 12TimesOver on September 14, 2013, 11:05:20 AM
Hehe, I have no idea what became of him - I still get mesmerized watching it over and over lol.

What shard are you on?
Title: Re: Gen's Library Donations
Post by: vanzelus on September 16, 2013, 07:34:15 PM
Hehe, I have no idea what became of him - I still get mesmerized watching it over and over lol.

What shard are you on?

Catskills...except for some veteran core players, seem like most people on here want to transfer off to ATL....I have been here quite a long time myself so couldn't bring myself to transfer  :'(
Title: Re: Gen's Library Donations
Post by: Crisis on July 16, 2014, 05:30:59 AM
Awesome script! I made the gump changes and it worked flawlessly. After about 6 hours, I am already 125k into the 800k points needed for the mace and shield glasses. I am so glad that this still works. :)
Title: Re: Gen's Library Donations
Post by: Pearls on July 16, 2014, 08:38:58 AM
Been running this puppy myself a lot. I started with a full vendor runebook only to find it being inefficient. Think i now use around 6 runes which probably total about 16-20 NPC's which is probably still too much.

I noticed that building up the stock to 999 can take a long time :) Seems some NPC vendors restock faster then others, or at least that has been my impression.

I have gotten 3 glasses so far :)
Title: Re: Gen's Library Donations
Post by: onlyindreams on July 16, 2014, 01:45:55 PM
I completely forgot about this script! I guess I need to find some time to run it so I can get that last pair of M&S that I need!
Title: Re: Gen's Library Donations
Post by: Crisis on July 22, 2014, 06:50:12 AM
After running this off and on, I got my M & S glasses. I should have kept track of the exact amount, but it cost me approx 2.1 million to buy the axes to donate. Excellent script, kudos to Gen, wherever he is at!
Title: Re: Gen's Library Donations
Post by: Fishyface on September 24, 2014, 01:16:32 PM
Just thought id say wonderful script ive been using it up to pub 86.3 when something i think with a gump has changed now it just spams "you must wait to preform another action".  Currently if you dont patch you can run easy uo so it might be that part of easy uo is broken for the moment not sure.

Other scripts seem to work though
Title: Re: Gen's Library Donations
Post by: marcelohpborges on May 20, 2015, 08:36:54 PM
Good!
Perfect macro! :D
Title: Re: Gen's Library Donations
Post by: Yahya on June 15, 2015, 05:15:07 AM
Hi,

that's my first time here in SUO. I'd like to try this script but i don't know how to download it...what have to do  ? :)

Thanks
Title: Re: Gen's Library Donations
Post by: gimlet on June 15, 2015, 05:29:12 AM
Hi,

that's my first time here in SUO. I'd like to try this script but i don't know how to download it...what have to do  ? :)

Thanks


Please read this and then you will know!

http://www.scriptuo.com/index.php?topic=1750.0 (http://www.scriptuo.com/index.php?topic=1750.0)
Title: Re: Gen's Library Donations
Post by: Ultimafreak77 on June 15, 2015, 01:28:09 PM
Hi,

that's my first time here in SUO. I'd like to try this script but i don't know how to download it...what have to do  ? :)

Thanks


Please read this and then you will know!

http://www.scriptuo.com/index.php?topic=1750.0 (http://www.scriptuo.com/index.php?topic=1750.0)

What he said ^^^^
Title: Re: Gen's Library Donations
Post by: Yahya on June 15, 2015, 01:30:27 PM
Ok less is done :D

I've downloaded script and...not used  :'(  Just a little movement of the backpack and stop.

Why ? I play in a free shard and as launcher i use UOS ( maybe a incompatible situation ).

Thx 4 help
Title: Re: Gen's Library Donations
Post by: Crisis on June 15, 2015, 02:33:41 PM
This was only tested with OSI, when you go to download scripts here, there is a code section at the top of the post. It will tell what easyuo client was used to test and whether it was freeshard, OSI or both. This one shows only OSI so you may have to make quite a few modifications to make it work on a freeshard.
Title: Re: Gen's Library Donations
Post by: cybercasper on August 26, 2015, 04:33:28 PM
Ok I'm stumped. I have read every post in on the topic and made all the changes. at first it would really to the vendor and pathfind to it. once there it would bring up the buy sell menu but would keep trying to sell instead of buy. can someone please tell me what I'm doing wrong because now with all the changes I did it will recall to vendor and then just sit there counting while it says finding vendor instead of pathfinding and opening the buy sell menu.
Title: Re: Gen's Library Donations
Post by: The Ghost on August 26, 2015, 05:27:03 PM
Look at the gump  and container size.   those two thing can mess u build.
Title: Re: Gen's Library Donations
Post by: KaliOfLS on September 17, 2015, 06:45:19 PM
Ok I'm stumped. I have read every post in on the topic and made all the changes. at first it would really to the vendor and pathfind to it. once there it would bring up the buy sell menu but would keep trying to sell instead of buy. can someone please tell me what I'm doing wrong because now with all the changes I did it will recall to vendor and then just sit there counting while it says finding vendor instead of pathfinding and opening the buy sell menu.

I had to modify the donate sub to walk into the library house to get to the guy for mace and sheild RG.  Then I to change the vendors name.  I think I had to modify the click location in the vendor buy loop to click buy and not bulk order or something like that.  Then I had to modify the click location on the donation guy's gump to hit the right spot, it was trying to click the item above.  So check all of those things.
Title: Re: Gen's Library Donations
Post by: gruntman on December 16, 2015, 10:06:28 PM
Yeah I just fired this up and after many alterations I cannot get it to put in the amount it wants to donate after clicking the donation button....it just keeps hitting the button without ever inputting the donation amount...anyone with a thought please share...

Edit: Got that all worked out and now I have a different issue maybe someone can shed some light on:

in the menu it gives you the option to set how many vendor locations you have in your book...when i set this to the correct amount it cycles through the book trying all 16 spots no matter what...any help on where i might look to correct this please?

Thanks!!


Gruntman
Title: Re: Gen's Library Donations
Post by: Gemviper on December 17, 2015, 01:25:58 PM
Just tried this as well for ideas on another script I need and it's not working as is anymore, needs some updating.
Title: Re: Gen's Library Donations
Post by: Crisis on December 17, 2015, 05:25:20 PM
I play on OSI and I first used this a little over a year ago, the only thing that I changed was the gump sizes. I am running this as we speak just fine. I had to change the rune for the mace and shield donation guy because they have all been moved to one central location but after making the new rune it is running like a champ. I know Gemviper is on OSI, what about you gruntman?

EDIT: I was watching the script run when it occurred to me I can make it faster. On OSI, you no longer need to make bank runs since it takes the gold right from your account at the vendors. it will also let me carry a few extra axes!
Title: Re: Gen's Library Donations
Post by: Insideout on December 18, 2015, 05:12:38 AM
I play osi i'll  give it a whirl after I get my plants done
Title: Re: Gen's Library Donations
Post by: Crisis on December 18, 2015, 12:34:19 PM
Editing out the non-needed bank run made it soo much faster!
Title: Re: Gen's Library Donations
Post by: gruntman on December 20, 2015, 02:55:14 PM
Yeah guess I forgot to mention I am on a freeserver :(
Title: Re: Gen's Library Donations
Post by: The Ghost on December 21, 2015, 03:44:39 PM
Which Free shard you on
Title: Re: Gen's Library Donations
Post by: gruntman on December 21, 2015, 09:25:40 PM
Which Free shard you on
Same as you :) Rebirth
Title: Re: Gen's Library Donations
Post by: hrs024 on January 13, 2016, 05:52:35 PM
going to test this out tonight 0.0
Title: Re: Gen's Library Donations
Post by: Dan123The123Man on January 14, 2016, 06:01:49 PM
Any Updates on this? Mine sets the status bar up and everything and it starts recalling to the vendor locations.. When it recalls to the first location it says "Recalling to Vendor Spot" then "Finding Vendor" and then recalls to the next vendor spot... It does this all the way through all 16 vendor spots. It doesn't even attempt to click the vendor or open a buy menu before it does this.

EDIT: If anyone has a working version of this could they post it please? I can't for the life of me figure out why it is doing what its doing.
Title: Re: Gen's Library Donations
Post by: Crisis on January 15, 2016, 01:59:59 PM
I play on OSI and it works just fine. If you are on a freeshard it may take quite a bit of editing. If you are on OSI, you need to read the thread. This script was posted in 2009 and requires some changes. Once you make those changes, it should work for you. It sounds like the script is not recognizing the vendors so those are the changes I would look at first.
Title: Re: Gen's Library Donations
Post by: Dan123The123Man on January 16, 2016, 01:45:10 AM
I play on OSI and it works just fine. If you are on a freeshard it may take quite a bit of editing. If you are on OSI, you need to read the thread. This script was posted in 2009 and requires some changes. Once you make those changes, it should work for you. It sounds like the script is not recognizing the vendors so those are the changes I would look at first.

Hey, thank you for the reply. I actually have read all the posts on every page in this thread and I play OSI as well on the Atlantic shard. The previous post I made was the result I get every time I try to run the script. I already tweaked the script some as far as the donating part is concerned, but so far I can't even get the script to get that far. If you have a working version would you mind posting it? I'm not very scripter savvy so for me trying to determine why the script won't attempt to buy from the vendors is like looking at hieroglyphics. I'm sure it's not a hard fix, but I really don't know what I'm doing. The problem I'm having is the same, he recalls to the locations in order and the little menu says finding vendor and then just recalls to the next location... I have all my runes marked to recall to blacksmith shops so the vendors would be the blacksmiths. But if you do have a working version of this for OSI it would help me a ton if you could release it on here. Thank you again for taking the time to read my wall of text lol

The script version that I am using is below, and as you can see I have changed the #FINDREPs to 255. A screenshot below is a picture of what its doing right before it recalls away. I have also already got the "Status Bar" corrected so I know thats not the problem because it didnt do anything until after I got that fixed. Also my client.exe version is 7.0.47.0 (patch 66) and the EasyUO version that ive always been using that works is EasyUO 1.5.1.294

(http://i.imgur.com/tZRZptI.png?1)

Code: [Select]
;===========================================================================
; Script Name: Gen's Library Donations
; Author: Gen2000
; Version: 1.5
; Client Tested with: 7.0.1.1
; EUO version tested with: 1.5 155
; Shard OSI/FS: OSI
; Public Release: 11/1/09
; Revision Date:
; Global Variables Used: CEO*FILESYSTEM
; Purpose: Recalls to smith/mage shops, buys axes/spell books,
;          Recalls to library & donates for glasses
;
; Glasses: Mace & Sheild, Wizard's Crystal , Fold & Steel
;===========================================================================
; http://www.scriptuo.com
;===========================================================================
; Special Thanks:
;---------------------------------------------------------------------------
; Author:  snicker7
; Script Name:  sub s7UseRunebook
;---------------------------------------------------------------------------
; Author:  Quintok / Raziel
; Script Name: sub waitForSysVars
;---------------------------------------------------------------------------
; Author  CEO
; Script Name: Sub CEO*FILESYSTEM
;===========================================================================
; Items Needed:
; Backpack:     2 Rune Books, 1 bank/library runes, and 1 with vendor shops.
;===========================================================================
; Instructions:  Bank/Library runebook should have rune to bank and library.
;                Vendor runebook should have runes marked to vendor shops.
;                Start off at any bank, click play and follow menu.
;===========================================================================
; Tips:  *DO NOT START WITH MORE THAN 3K GOLD IN PACK.
;        *REMOVE ALL BATTLE AXES YOU MAY WANT TO KEEP FROM PACK.
;        *REMOVE ALL SPELLBOOKS (SLAYERS ECT.) FROM PACK IF DONATING TO MAGE.
;         AND THE SPELLBOOK YOUR USING IN HAND!
;===========================================================================
set %lpc 1000               ;Adjust lpc if buying menu is going too fast.
set %axe_amount 95          ;Amount of axes to buy at a time.
set %spellbook_amount 100   ;Amount of spellbooks to buy at a time.
set %No_Dachi_amount 40     ;Amount of No-Dashis to buy at a time.
set %NPC_axe Clyde           ;Name of NPC to Donate Axes.
set %NPC_spellbook Abram  ;Name of NPC to Donate Spellbooks
set %NPC_No_Dachi Madeline  ;Name of NPC to Donate No Dachis
;===========================================================================
;Option below is used to setup points you already have or reset points.
;Set %reset to #true, set %donated to points you have divided by 9/10 axe/spellbook.
;===========================================================================
set %reset #false ;set true to reset count
if %reset
{
   set %donated 2046 ;Number of points divided by points per item(s).
   gosub putGlobalVar Gen LD #CHARID DONATED
   display set reset back to false and restart script
   halt
}
;===========================================================================
;----------------------------------Setup------------------------------------
;===========================================================================
set %start #true
set %vendortype IS_HS
set #menubutton closed
set %vendor 1
set %pause pause
set %pause_resume Pause
set %d_lpc #lpc
set %status Please , #spc , Wait...
gosub openpack
gosub openstatusbar
gosub getGlobalVar GEN LD #CHARID first
if ! #result
{
   set %first 1
   gosub putGlobalVar GEN LD #CHARID first
   set %donated 0
   set %points 0
   gosub showeuomenu1
   set %status Ready...
   gosub menu_refresh2
   goto setup
}
gosub first_setup
if %SETUP = NO
{
   gosub GetGlobalVars
   goto setup3
}
menu hideeuo
gosub showeuomenu1
set %status Ready...
gosub menu_refresh2
setup:
if #menubutton = runebook
   goto runebook
if #menubutton = runebook2
   goto runebook2
if #menubutton = start
   goto setup2
goto setup
setup2:
menu get travel
if #MENURES = 1
   set %travel r
if #MENURES = 2
   set %travel c
menu get Donation
if #MENURES = 1
   set %donationtype warrior
if #MENURES = 2
   set %donationtype mage
if #MENURES = 3
   set %donationtype warrior2
menu get library
set %library #MENURES
menu get bank
set %bank #MENURES
menu get vendors
set %vendors #MENURES
setup3:
gosub donationtype
gosub showeuomenu2
menu hide
menu hideeuo
set #menubutton closed
gosub SetGlobalVars
goto mainloop
;======================================
;---------------Main Loop--------------
;======================================
mainloop:
finditem %items c_ , #BACKPACKID
if #FINDCNT > 0
{
   set %start #false
   goto mainloop3
}
gosub recall2bank
mainloop2:
gosub recall2vendor
goto findvendor
mainloop3:
gosub recall2library
gosub donate
goto mainloop
;=======================================
;--------------Buy----------------------
;=======================================
findvendor:
set %status Finding , #spc , vendor..
gosub menu_refresh
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
finditem %vendortype G_25
if #findkind = -1
{
   if %donationtype = warrior || %donationtype = mage
   {
      set %vendor %vendor + 1
      if %vendor > %vendors
      {
         set %vendor 1
         ignoreitem reset 2
      }
      if #gold = %did_I_buy
         goto mainloop2
      goto mainloop3
   }
   if %donationtype = Warrior2
   {
      set %wait_count 0
      repeat
      set %wait_count %wait_count + 1
      wait 20
      set %status Waiting , #spc , %wait_count , #spc , Secs
      gosub menu_refresh
      until %wait_count > 60
      ignoreitem reset 2
      goto findvendor
   }
}
if #FINDREP <> 255
{
   ignoreitem #findid 3
   goto findvendor
}
set %vendorid #findid
event Property #findID
if %vendorname notin #property || quest in #property || banker in #property || minter in

#property
{
   ignoreitem #findid 3
   goto findvendor
}
;-------------------------------------
if #finddist > 7
{
   set %jindex #jIndex
   set %wait #SCNT + 2
   event pathfind #FINDX #FINDY #FINDZ
   repeat
   scanjournal %jindex
   if get_there in #journal
   {
      ignoreitem #findid 3
      goto findvendor
   }
   set %jindex %jindex + 1
   if N/A in #journal
      set %jindex %jindex - 1
   until pathfinding in #journal || %wait < #SCNT
   wait 2s
}
;-----------------------------------------
exevent popup %vendorid
wait 20
click 20 55
gosub WaitForSysVars CONTNAME = bill_gump CONTSIZE = 283_248 5
if ! #result
{
   if #CONTSIZE = 507_436 ;Quest menu
   {
      set %x2 #CONTPOSX + 350
      set %y2 #CONTPOSY + 400
      click %x2 %y2
      wait 30
      click %x2 %y2
      wait 10
      ignoreitem #findid 3
      set %trys 0
   }
   if #CONTSIZE = 463_414 ;Quest menu 2
   {
      set %x1 #CONTPOSX + 245
      set %y1 #CONTPOSY + 344
      click %x1 %y1
      wait 10
      ignoreitem #findid 3
      set %trys 0
   }
   set %trys %trys + 1
   if %trys > 2
   {
      ignoreitem #findid 3
      set %trys 0
   }
      goto findvendor
}
set %x_buy #CONTPOSX - 118
set %y_buy #CONTPOSY - 135
set %x_next #CONTPOSX + 73
set %y_next #CONTPOSY - 11
set %x_sign #CONTPOSX + 43
set %y_sign #CONTPOSY + 205
itemtobuy:
set #lpc %lpc
set %status Shopping..
gosub menu_refresh
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
getshopinfo
if #SHOPITEMTYPE in %ITEMS
{
goto buy
}
click %x_next %y_next ;next
if #SHOPCURPOS = #SHOPCNT
{
  set #lpc %d_lpc
  click %x_sign %y_sign ;sign
  gosub WaitForSysVars CONTNAME <> bill_gump CONTSIZE <> 283_248 5
ignoreitem %vendorid 2
  goto findvendor
}
goto itemtobuy


buy:
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
if #SHOPITEMPRICE > %MAX_PRICE
{
   click %x_next %y_next
   goto skip
}
click %x_buy %y_buy d ;buy
click %x_buy %y_buy d ;buy
getShopInfo
set %amount %number
if #SHOPITEMMAX < %number
   set %amount #SHOPITEMMAX
setShopItem #shopItemID %amount
set #lpc %d_lpc
click %x_sign %y_sign ;sign
gosub WaitForSysVars CONTNAME <> bill_gump CONTSIZE <> 283_248 5
;ignoreitem reset 2
goto mainloop3
skip:
if #SHOPCURPOS = #SHOPCNT
{
  set #lpc %d_lpc
  click %x_sign %y_sign ;sign
  gosub WaitForSysVars CONTNAME <> bill_gump CONTSIZE <> 283_248 5
  ignoreitem %vendorid 2
  if #gold = %did_I_buy
     goto findvendor
  goto mainloop3
}
goto itemtobuy
;=======================================
;--------------Subs---------------------
;=======================================
sub donationtype
if %donationtype = warrior
{
   set %MAX_PRICE 23
   set %number %axe_amount
   set %donate %NPC_axe
   set %items BSF_HSF
   set %points_per 9
   set %vendorname smith
   return
}
if %donationtype = mage
{
   set %MAX_PRICE 18
   set %number %spellbook_amount
   set %donate %NPC_spellbook
   set %items MPF
   set %points_per 10
   set %vendorname mage
   return
}
if %donationtype = warrior2
{
   set %MAX_PRICE 73
   set %number %No_Dachi_amount
   set %donate %NPC_No_Dachi
   set %items EDP
   set %points_per 27
   set %vendorname smith
   return
}
display Error in setup!
halt

sub first_setup
gosub showeuomenu3
first_setup:
if #MENUBUTTON = yes
{
   set #MENUBUTTON closed
   set %SETUP yes
   return
}
if #MENUBUTTON = no
{
   set #MENUBUTTON closed
   set %SETUP no
   return
}
goto first_setup

sub recall2bank
if %start
{
set %start #false
set %gold %number * %MAX_PRICE
set %gold %gold - #GOLD
if %gold < 1
   return
event macro 3 0 withdraw %gold
return
}
bank:
if *stop
{
      set #menubutton pause
      set *stop #false
}
if #menubutton = pause
   gosub pause
set %status Recalling , #spc , to , #spc , bank
gosub menu_refresh
set %start #CHARPOSX
gosub s7UseRunebook %runebook %bank %travel
set %recall_timer #SCNT + 10
wait_bank:
if %recall_timer < #SCNT
{
   goto bank
}
if %start = #CHARPOSX
   goto wait_bank
set %start #false
;set %number ( #MAXWEIGHT - #WEIGHT ) / 4
set %gold %number * %MAX_PRICE
set %gold %gold - #GOLD
if %gold < 1
   return
event macro 3 0 withdraw %gold
return


sub recall2vendor
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
set %status Recalling , #spc , to , #spc , vendor , #spc , %vendor
gosub menu_refresh
set %start #CHARPOSX
gosub s7UseRunebook %runebook2 %vendor %travel
set %recall_timer #SCNT + 10
wait_vendor:
if %recall_timer < #SCNT
{
   if err in #result
      set %vendor %vendor + 1
   goto mainloop2
}
if %start = #CHARPOSX
   goto wait_vendor
set %did_I_buy #gold
wait 20
return

sub recall2library
library:
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
set %status Recalling , #spc , to , #spc , library
gosub menu_refresh
set %start #CHARPOSX
gosub s7UseRunebook %runebook %library %travel
set %recall_timer #SCNT + 10
wait_library:
if %recall_timer < #SCNT
{
   goto library
}
if %start = #CHARPOSX
   goto wait_library
return


sub donate
set %status Donating...
gosub menu_refresh
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
donate:
finditem IS_HS g_4
if #findkind = -1
{
   display Not close enough to %Donate - Fix it - Script Paused
   gosub pause
   goto donate
}
if #findrep <> 255
{
   ignoreitem #findid player
   goto donate
}
event property #findid
if #property = $
   goto donate
if %donate notin #property
{
   ignoreitem #findid npc
   goto donate
}
set #lobjectid #findid
finditem %items c_ , #BACKPACKID
if #findkind = -1
{
   click %x %y r
   return
}
set #ltargetid #findid
set #ltargetkind 1
event macro 17 0
set #ltargetid #findid
set #ltargetkind 1
donate2:
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
gosub waitforsysvars CONTNAME = generic_gump CONTSIZE = 345_359 2
if ! #result
   goto donate
if #result
{
   finditem %items c_ , #BACKPACKID
   if #findkind = -1
   {
      click %x %y r
      return
   }
   set #ltargetid #findid
   set #ltargetkind 1
   if %donationtype = Warrior || %donationtype = mage
   {
      set %x #CONTPOSX + 39
      set %y #CONTPOSY + 268
      click %x %y
      target 2s
      event macro 22 0
   }
   if %donationtype = Warrior2
   {
      set %x #CONTPOSX + 306
      set %y #CONTPOSY + 343
      click %x %y
      click %x %y
      set %x #CONTPOSX + 40
      set %y #CONTPOSY + 177
      click %x %y
      target 2s
      event macro 22 0
   }
   set %donated %donated + 1
   set %points ( %donated * %points_per )
   gosub putGlobalVar Gen LD #CHARID DONATED
   gosub menu_refresh
   goto donate2
}
goto donate


runebook:
set %status Target , #spc , your , #spc , #spc , Bank/Library , #spc , Runebook
gosub menu_refresh2
set #targcurs 1
repeat
until #targcurs = 0
set %runebook #ltargetid
set %status Ready...
gosub menu_refresh2
set #menubutton closed
goto setup

runebook2:
set %status Target , #spc , your , #spc , #spc , Vendor(s) , #spc , Runebook
gosub menu_refresh2
set #targcurs 1
repeat
until #targcurs = 0
set %runebook2 #ltargetid
set %status Ready...
gosub menu_refresh2
set #menubutton closed
goto setup


sub openstatusbar
openstatusbar:
event macro 8 2
gosub WaitForSysVars CONTSIZE = 584_216 CONTNAME = status_gump
if ! #result
{
   goto openstatusbar
}
movestatus:
set #CONTPOSX 800
set #CONTPOSY 420
gosub WaitForSysVars CONTPOSX = 800 CONTPOSY = 420 5
if ! #result
{
   goto movestatus
}
wait 20
return

sub openpack
openpack:
event macro 8 7
gosub WaitForSysVars CONTSIZE = 230_204 CONTNAME = container_gump
if ! #result
{
   goto openpack
}
movepack:
set #CONTPOSX 815
set #CONTPOSY 255
gosub WaitForSysVars CONTPOSX = 815 CONTPOSY = 255 5
if ! #result
{
   goto movepack
}
wait 20
return


sub pause
set %pause resume
set %pause_resume Resume
set %status Paused..
menu Font Color Aqua
menu Button %pause 160 20 75 25 %pause_resume
menu set %pause %pause_resume
gosub menu_refresh
pause:
if #menubutton = resume
{
   set %pause pause
   set %pause_resume pause
   menu Font Color Aqua
   menu Button %pause 160 20 75 25 %pause_resume
   menu set %pause %pause_resume
   gosub menu_refresh
   return
}
goto pause
;===================================================
; Script Name:  sub s7UseRunebook
; Author:  snicker7
; Version:  2.0
; Client Tested with:  4.0.11c
; EUO version tested with:  1.42/1.5
; Shard OSI / FS:  OSI/FS
; Revision Date:  24Aug05
; Public Release:  24Aug05
; Global Variables Used: N/A
; Purpose:  Failsafe sub to recall, gate, sacred journey flawlessly. Options to use scrolls,

default locations, recharge books with scrolls in pack if book runs out of charges, and

perfect gate travel. Not for the feint of heart!
;===================================================
;======= This file includes the main sub and =======
;===== several support subs that are required. =====
;===================================================
;===== Much love for T-Mo and BM, but I needed =====
;====== to write something I could only blame ======
;======= myself for if it fails. even though =======
;=================== it doesn't. ===================
;===================================================

; ===================================================================== ;
; ///////////////////////////////////////////////////////////////////// ;
; // EXCERPTS FROM S7SUBS.EUO ///////////////////////////////////////// ;
; ///////////////////////////////////////////////////////////////////// ;
; // Any reproduction of the subroutines below is strictly pro- /////// ;
; // hibited without express written permission of the author ///////// ;
; // (snicker7). Violation of the above will result in malicious ////// ;
; // actions by the aforementioned author performed upon your person // ;
; // including but not limited to: bodily harm, slander, maternal ///// ;
; // insults, possible legal action, and callin' the five-oh. Thank /// ;
; // you. ///////////////////////////////////////////////////////////// ;
; ///////////////////////////////////////////////////////////////////// ;
; ===================================================================== ;

;=/ 1NCLUD3D SUBS: /================================
; s7UseRunebook: Duh, you know why it's there.
; s7ScanJournalFor: SuperMultiParameterJournalScanning Power!
; s7MoveToPos: Legendary snicker7 brand name drag and drop sub. updated!
; s7MoveToCont: Wrapper for the above sub, updated for 1.5 exevents!
; s7WaitForAction: Mildly obsolete, begging for a rewrite object-delay sub!
; s7WaitForVars: Classic sysvar wait sub. One line shorter than Quintok's!
;===================================================

;----
;* @name s7UseRunebook
;* @author snicker7
;* @ver 2.0a 24Aug05
;* @purpose   do anything and everything travel related with a runebook
;* @params    %1   Rune or Runebook item ID to use
;*      %2   number of rune to travel to, use "default" for runes or default in runebook
;*      %3   travel method:
;*         r: recall
;*         g: gate
;*         c: sacred journey
;*         s: scrolls
;* @dependencies
;*      s7WaitForVars
;*      s7WaitForAction
;*      s7ScanJournalFor
;*      s7MoveToCont for recharging runebooks
;* @returns    #true   on success
;*      ERR_*   various errors.
;* @notes    none
;* @example:    gosub s7UseRunebook %bookID 14 r
;* @status done
sub s7UseRunebook
  if %0 < 3 || _ , %2 , _ notin _1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_default_
    return ERR_IncorrectParams
  namespace push
  namespace local _s7URB
  set !runebook %1
  set !index %2
  set !method %3
  set !fails 0
  if #contsize = 452_236
  {
    set !_cx #contposx + 20
    set !_cy #contposy + 20
    click !_cx !_cy r f dmc
    wait 5
  }
  for !_ 1 1
  {
    finditem OTF_JEF_KEF G_0
    if #findkind <> -1
      set !_ 0
  }
  for !orb 1 1
  {
    if !fails > 0 2
      namespace pop
      return ERR_ , #journal
    set !jStart #jindex + 1
    if !index <> default
    {
      gosub s7WaitForAction 12
      set #lobjectid !runebook
      event macro 17 0
      gosub s7WaitForVars contname = generic_gump contsize = 452_236 3
      if ! #result 2
        set !fails !fails + 1
        set !orb 0
      if #result
      {
        set !_cy #contposy + 196
        set !_cx #contposx + 105 + ( ( ( !index / 2 ) + ( !index % 2 ) ) * 35 )
        if !index > 8
          set !_cx !_cx + 30
        click !_cx !_cy f dmc
        wait 5
        set !_cx #contposx + 135
        set !_cy #contposy + 144
        if !method = G
          set !_cy !_cy + 20
        if !method = C
          set !_cy !_cy + 36
        if !method = S
          set !_cy !_cy - 76
        if ( !index % 2 ) = 0
          set !_cx !_cx + 160
        set !charpos #charposx , _ , #charposy
        set !timeout #scnt2
        click !_cx !_cy f dmc
      }
    }
    if !index = default
    {
      set #ltargetid !runebook
      set #ltargetkind 1
      if !method = c
        event macro 15 210
      if !method = r
        event macro 15 31
      if !method = g
        event macro 15 51
      if !method = s
      {
        finditem WTL C_ , #backpackid
        if #findkind = -1 2
          namespace pop
          return ERR_NoRecallScrolls
        if #findkind <> -1 3
          set #lobjectid #findid
          gosub s7WaitForAction 12
          event macro 17 0
      }
      for !_ 1 1
      {
        if #targcurs <> 1
          set !_ 0
        gosub s7ScanJournalFor !jStart fizzles more_reagents tithing_points insufficient_mana
        if #result 3
          set !_ 1
          set !orb 0
          wait 20
      }
      set !charpos #charposx , _ , #charposy
      set !timeout #scnt2
      event macro 22 0
    }
    if !orb = 1
    {
      for !success 1 1
      {
        if #charposx , _ , #charposy = !charpos && !method in _r_c_s_
          set !success 0
        if !method = g
        {
          finditem OTF_JEF_KEF G_0
          if #findkind = -1
            set !success 0
          if #findkind <> -1
          {
            set #lobjectid #findid
            gosub s7WaitForAction 12
            event macro 17 0
            for !_ 1 1
            {
              if #charposx , _ , #charposy = !charpos
                set !_ 0
              if #contname = generic_gump && #contsize = 420_280
              {
                set !_cx #contposx + 20
                set !_cy #contposy + 260
                click !_cx !_cy f dmc
              }
            }
          }
        }
        gosub s7ScanJournalFor !jStart fizzles location_is_blocked not_yet_recovered

no_charges_left more_reagents tithing_points insufficient_mana not_marked
        if #result || !timeout + 60 < #scnt2
        {
          if no_charges in #journal
          {
            finditem WTL C_ , #backpackid
            if #findkind = -1
              set !fails 2
            if #findkind <> -1
            {
              set !scrolls #findid
              finditem !runebook
              set #findmod 0
              gosub s7WaitForAction 12
              event drag !runebook
              for !_ 1 1
              {
                if #lliftedkind <> 1 2
                  wait 1
                  set !_ 0
              }
              str pos #contsize _
              set #strres #strres - 1
              str left #contsize #strres
              set !_cx #findx + #strres / 2
              str pos #contsize _
              str del #contsize 1 #strres
              set !_cy #findy + #strres / 2
              click !_cx !_cy p f dmc
              gosub s7MoveToCont !scrolls !runebook #backpackid 20_10
            }
          }
          set !fails !fails + 1
          set !success 1
          set !orb 0
        }
      }
      wait 20
    }
  }
namespace pop
return #true

sub s7ScanJournalFor
  set !SJFje #jindex + 1
  for !SJFji %1 !SJFje
  {
    scanjournal !SJFji
    for !SJFpi 2 %0
    {
      if % . !SJFpi in #journal
        return #true
    }
  }
return #false

;----
;* @name s7MoveToPos
;* @author snicker7
;* @ver 1.2 24Aug05
;* @purpose Just Another Item Dragger.
;* @params    %1 is the item to be dragged
;*      %2 is the x-coord to drop to
;*       %3 is the y-coord to drop to
;*      %4 is the timeout in seconds
;*       %5 is the amount to be dragged (blank for all)
;* @returns    #true if drop was successful
;*      #false on error (drop to backpack, insufficient params, failed to drag)
;*      halt on critical error
;* @notes moves any item to a position on the screen. Will
;*   attempt to drop on character if drop fails. If character
;*   drop fails, halts and error message to avoid crash.
;* @dependencies
;*      s7WaitForAction
;* @example: call s7Subs.euo s7MoveToPos #findid 7 9 4 77
;* @status unknown
sub s7MoveToPos
  if %0 < 4
    return #false
  namespace Push
  namespace Local _s7MvToPos
  set !_ID %1
  set !_x %2
  set !_y %3
  set !_tO %4
  set !_Amt #spc
  if %0 > 4
    set !_Amt %5
  set !_retry 0
  _s7MvToPos_SD:
  finditem !_ID
  if #findkind = -1 2
    namespace pop
    return #false
  gosub s7WaitForAction 13
  event drag #findid
  if #findstack > 1
  {
    set !_timeOut #scnt
    for !_ 1 1
    {
      if #contname <> stack_gump && #contname <> drag_gump
      {
        wait 1
        if !_timeOut + !_tO < #scnt
        {
          set !_retry !_retry + 1
          if !_retry > 2 2
            namespace pop
            return #false
          goto _s7MvToPos_SD
        }
        set !_ 0
      }
    }
    if !_Amt > #findstack
      set !_Amt #findstack
    msg !_Amt , $
  }
  set !_retry 0
  set !_timeOut #scnt
  for !_ 1 1
  {
    if #lliftedkind <> 1
    {
      wait 1
      if !_timeOut + !_tO < #scnt
      {
        set !_retry !_retry + 1
        if !_retry > 2 2
          namespace pop
          return #false
        goto _s7MvToPos_SD
      }
      set !_ 0
    }
  }
  set !_retry 0
  click !_x !_y p
  set !_timeout #scnt
  for !_ 1 1
  {
    if #lliftedkind = 1
    {
      wait 1
      if !_timeout + !_t0 < #scnt
      {
        set !_retry !_retry + 1
        if !_retry = 1
        {
          set !_x #clixres / 2
          set !_y ( #cliyres / 2 ) - 30
          click !_x !_y p
          set #result #false
          set !_timeout #scnt
        }
        if !_retry = 2 2
          display ok You have failed to drop an item to the correct position.$$The script is

now halting to prevent a crash.
          halt
      }
      set !_ 0
    }
  }
  set #result #true
  namespace pop
return #result

;----
;* @name s7MoveToCont
;* @author snicker7
;* @ver 1.2 24Aug05
;* @purpose A wrapper for the sub s7MoveToPos for moving to containers.
;* @params    %1 is the item to be dragged
;*      %2 is the container to drag to
;*      %3 is the mother container in which %2 is contained
;*       %4 is the #findmod value for the container
;*       %5 is the amount to be dragged (blank for all)
;* @returns none
;* @notes this is mad basic. no error checking. That is up to you.
;* @dependencies   s7MoveToPos
;* @example: call s7Subs.euo s7MoveToCont #findid #backpackid #charid 140_220
;* @status tested good
sub s7MoveToCont
  namespace Push
  namespace Local _s7MoveToCont
  set !_ID %1
  set !_DCont %2
  set !_MCont %3
  set !_FMod %4
  if 1_5 in #euover
  {
    set !_Amt 65535
    if %0 > 4
      set !_Amt abs %5
    finditem !_ID
    if #findkind = -1 2
      namespace pop
      return #false
    gosub s7WaitForAction 13
    exevent drag #findid !_Amt
    exevent dropc !_DCont
    namespace pop
    return #true
  }
  set !_Amt #spc
  if %0 > 4
    set !_Amt %5
  set #result #true
  set !_retry 0
  for !_ 1 1
  {
    finditem !_DCont C_ , !_MCont
    if #findkind = -1
    {
      set #lobjectid !_MCont
      gosub s7WaitForAction 13
      event macro 17 0
      gosub s7WaitForVars contid = !_MCont 3
      if ! #result
      {
        set !_retry !_retry + 1
        if !_retry > 2 2
          namespace pop
          return #false
      }
      set !_ 0
    }
  }
  set !_retry 0
  set #findmod !_Fmod
  for !_ 1 1
  {
    gosub s7MoveToPos !_ID #findx #findy 4 !_Amt
    if ! #result
    {
      set !_retry !_retry + 1
      if !_retry > 2 2
        namespace pop
        return #false
      set !_ 0
    }
  }
namespace Pop
return #true

;----
;* @name s7WaitForAction
;* @author snicker7
;* @ver 1.1 31Jan05
;* @purpose waits 1.3 seconds before continuing, useful for waiting to perform
;*    another action
;* @params    none
;* @returns none
;* @notes probably not an original idea, but I need to use it frequently and it
;*    was easier to write it myself than to try to look for it as written by
;*    someone else

;* @example: call s7Subs.euo s7WaitForAction 13
;* @status tested good
sub s7WaitForAction
  _s7WaitForAction:
  if %_s7ActionTimer + %1 > #scnt2 2
    wait 1
    goto _s7WaitForAction
  set %_s7ActionTimer #scnt2
return

;----
;* @name s7WaitForVars
;* @author snicker7, inspired by Quintok, and of course, Smertrios
;* @ver 1.2 24Aug05
;* @purpose Multiple input sysvar waiter.
;* @params    %1*n is the gump sysvar being checked
;*      %2*n is the comparative operator (>, <, <>, =, etc)
;*      %3*n is the desired value of the sysvar
;*      %nfinal is the timeout in seconds
;* @returns #false if it times out
;*          #true if success
;* @notes    %1 does not require the preceding number sign
;*      one line shorter than Q's, no disrespect son
;*      originally written by Smertrios, included in Lexia
;*      Multiple inputs by Quintok, Obfuscation and name-
;*      spacing by snicker7!
;* @example: call s7Subs.euo s7WaitForVars contID = #backpackID contSize = 7_9 3
;* @status tested good
sub s7WaitForVars
  namespace Push
  namespace Local _s7WFVs
  set !C %0 / 3
  set !T #scnt + 5
  if ( %0 % 3 ) = 1
    set !T #scnt + % . %0
  for !i 1 !C
  {
    set !o 3 * !i - 2
    set !p !o + 1
    set !q !o + 2
    if ! ( # . % . !o % . !p % . !q )
      set !i 0
    if #scnt > !T 2
      namespace pop
      return #false
  }
  namespace Pop
return #true
;======================================
;----------End of S7urb----------------
;======================================


;======================================
; Script Name: sub waitForSysVars
; Author: Quintok / Raziel
; Version: 1.05
; Client Tested with: 4.0.2b
; EUO version tested with: 0078
; Shard OSI / FS: OSI / FS
; Revision Date: 22th August 2005
; Public Release: 20th March 2004
; Global Variables Used: none
; Purpose: same as waitForSysVar but for multiple inputs.
;%1 system variable without '#'
;%2 = <> > < ... etc
;%3 comparing value
;%4 system variable without '#'
;%5 = <> > < ... etc
;%6 comparing value
;%n = timeout (not required)
;======================================
sub waitForSysVars
  set !cnt %0 / 3
  set !timeOut #scnt + 5
  if ( %0 % 3 = 1 )
    set !timeOut #scnt + % . %0
  for !i 1 !cnt
  {
    set !offset 3 * !i - 2
    set !evaluation !offset + 1
    set !value !offset + 2
    if ! ( # . % . !offset % . !evaluation % . !value )
      set !i 0
    if #scnt > !timeout
      return #false
  }
return #true
;=======================================
sub SetGlobalVars
gosub putGlobalVar GEN LD #CHARID BANK
gosub putGlobalVar Gen LD #CHARID LIBRARY
gosub putGlobalVar Gen LD #CHARID RUNEBOOK
gosub putGlobalVar Gen LD #CHARID RUNEBOOK2
gosub putGlobalVar Gen LD #CHARID TRAVEL
gosub putGlobalVar Gen LD #CHARID VENDORS
gosub putGlobalVar Gen LD #CHARID DONATIONTYPE
return

sub GetGlobalVars
gosub getGlobalVar Gen LD #CHARID BANK
gosub getGlobalVar Gen LD #CHARID DONATED
gosub getGlobalVar Gen LD #CHARID LIBRARY
gosub getGlobalVar Gen LD #CHARID RUNEBOOK
gosub getGlobalVar Gen LD #CHARID RUNEBOOK2
gosub getGlobalVar Gen LD #CHARID TRAVEL
gosub getGlobalVar Gen LD #CHARID VENDORS
gosub getGlobalVar Gen LD #CHARID DONATIONTYPE
return

;==================================
; Script Name:  CEO*FileSystem (pseudo filesystem)
; Author: CEO
; Version: 1.1
; Client Tested with: 4.0.1b
; EUO version tested with: 1_41_103
; Shard OSI / FS: OSI
; Revision Date: 040219
; Public Release: 040219
; Globals Used: User specified (2 total)
; Purpose: Allows you to use a * variable as a pseudo-filesystem
;=======================================
; CEO's global variable management subs:
;      getGlobalVar  . putGlobalVar  . delGlobalVar
;=======================================
;
;ver 1.1
;changed the lock file to use *variablename_lock so it'll work with any named *variable
;
Sub getGlobalVar

;ver 1.0 posted 19Feb04 by CEO
;purpose: Allows you to store multiple variables in one global variable unique to
;             each player and script. getGlobaVar retrieves a value from a global variable.
;@returns: #result = #false if variable not found, #true if found
;            % . %3 contains variable value
;%1 is the global/persistant variable to use ( %1 + 1 is used for locking)
;%2 is the script identifer or pseudo filename
;%3 is #charid or pseudo filename
;%4 is the variable to search for and return in %. %3
;%5 is for lock control. By default getGlobalVar uses a lock to return a value. In some cases

you may want to
;       retrieve a variable (mostly for speed) without needing a lock as long as you are aware

of
;      any potentional conflicts, that very rarely may occur. Set this param to NOLOCK to

access
;      global storage without a lock.
;sample usage:
;               gosub getGlobalVar 50 MyScript #charid backpackid
; Using global var *50 finds the variable labeled MyScript#charidbackpackid and returns it in

%backpackid
;
;               gosub getGlobalVar 50 MyScript #charid clothstat NOLOCK
; Using global var *50 find the variable labeled MyScript#charidclothstat and returns it in

%clothstat without using a lock
; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
nameSpace push
nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , GET
set !lpc #lpc
set #lpc 1000
set !lock %1 , _lock
if ( %0 = 5 ) && ( %5 = NOLOCK )
   goto getGlobalVar_skiplock
set !lockcount 0
getGlobalVar_waitforlock:
if * . !lock <> N/A && * . !lock <> #nsname
{
   wait 1 4
   set !lockcount !lockcount + 1
   if !lockcount < 10
      goto getGlobalVar_waitforlock
   if * . !lock <> N/A
   {
      set !currentlock * . !lock
      if !currentlock = N/A
         goto getGlobalVar_waitforlock
      str pos !currentlock _
      set !strres #strres - 1
      str left !currentlock !strres
      set !systime #systime - #strres
      if !systime < 10000 ; if over 10 seconds assume a broken lock and take it
      {
         set !lockcount 0
         goto getGlobalVar_waitforlock
      }
   }
}
set * . !lock #nsname
wait 3 2
if  * . !lock <> #nsname
{
   set !lockcount 0
   goto getGlobalVar_waitforlock
}
getGlobalVar_skiplock:
set !global * . %1
set !varName %2 , ^ , %3 , ^ , %4 , |
str pos !global !varName
set #result #strres <> 0
if #result
{
   set !varNamePos #strres
   str len !varName
   set !delString !varNamePos + #strres - 1
   str del !global 1 !delString
   set !global #strres
   str pos !global |
   set !varNamePos #strres - 1
   str left !global !varNamePos
   set % . %4 #strres
}
if ( %0 < 5 || %5 <> NOLOCK ) && * . !lock = #nsname
   set * . !lock N/A
set #lpc !lpc
nameSpace Clear
nameSpace Pop
return #result

Sub putGlobalVar
;ver 1.0 posted 19Feb04 by CEO
;purpose: Allows you to store multiple variables in one global variable unique to
;             each player and script. putGlobaVar stores a value into a global variable.

;@returns: #result = #false if variable not found, #true if found
;            % . %3 contains variable
;%1 is the global/persistant variable to use
;%2 is the script identifer or pseudo filename
;%3 #charid or other identifier
;%4 is the variable name of the variable to save into the* variable identified in %1
;sample usage:
;               gosub putGlovalVar 50 MyScript #chardid backpackid
; Using global var *50 stores/updates the variable labeled MyScript#charidbackpackid  with

%backpackid
; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
nameSpace push
nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , PUT
set !lpc #lpc
set #lpc 1000
set !lock %1 , _lock
set !lockcount 0
putGlobalVar_waitforlock:
if * . !lock <> N/A && * . !lock <> #nsname
{
   wait 1 4
   set !lockcount !lockcount + 1
   if !lockcount < 10
      goto putGlobalVar_waitforlock
   if * . !lock <> N/A
   {
      set !currentlock * . !lock
      if !currentlock = N/A
         goto putGlobalVar_waitforlock
      str pos !currentlock _
      set !strres #strres - 1
      str left !currentlock !strres
      set !systime #systime - #strres
      if !systime < 10000 ; if over 10 seconds assume a hung lock and take it
      {
         set !lockcount 0
         goto putGlobalVar_waitforlock
      }
   }
}
set * . !lock #nsname
wait 4
set !global * . %1
set !varName %2 , ^ , %3 , ^ , %4 , |
str pos !global !varName
if #strres = 0
{
   if  * . !lock <> #nsname
   {
      set !lockcount 0
      goto putGlobalVar_waitforlock
   }
   if  |CEO*FILESYSTEM| notin !global
      set !global |CEO*FILESYSTEM|
   set * . %1 !global , !varName , % . %4 , |
   set * . !lock N/A
   set #lpc !lpc
   nameSpace clear
   nameSpace pop
   return #true
}
set !varNamePos #strres
str len !varName
set !splitString !varNamePos + #strres - 1
str left !global !splitstring
set !globalPart1 #strres
str del !global 1 !splitString
set !global #strres
str len !global
set !globalLen #strres
str pos !global |
set !splitString !globalLen - #strres + 1
str right !global !splitstring
set !global #strres
if  * . !lock <> #nsname
{
   set !lockcount 0
   goto putGlobalVar_waitforlock
}
set * . %1 !globalPart1 , % . %4 , !global
set * . !lock N/A
set #lpc !lpc
nameSpace clear
nameSpace pop
return #true


Sub delGlobalVar
;ver 1.0 posted 19Feb04 by CEO
;purpose: Allows you to delete a variable out of the globalvar pool unique to
;             each player and script. delGlobaVar deletes a global variable in a * variable.

;@returns: #result = #false if variable not found, #true if  deleted
;
;%1 is the global/persistant variable to use
;%2 is the script identifer or pseudo filename
;%3 is #charid or other identifier
;%4 is the variable name of the variable to save into the* variable identified in %1
;sample usage:
;               gosub delGlovalVar 50 MyScript #charid backpackid
; Using global var *50 deletes  the variable label MyScript#charidbackpackid  and it's

associated value.
; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
nameSpace push
nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , DEL
set !lpc #lpc
set #lpc 1000
set !lock %1 , _lock
set !lockcount 0
delGlobalVar_waitforlock:
if * . !lock <> N/A && * . !lock <> #nsname
{
   wait 1 4
   set !lockcount !lockcount + 1
   if !lockcount <  10
      goto delGlobalVar_waitforlock

   if * . !lock <> N/A
   {
      set !currentlock * . !lock
      if !currentlock = N/A
         goto delGlobalVar_waitforlock
      str pos !currentlock _
      set !strres #strres - 1
      str left !currentlock !strres
      set !systime #systime - #strres
      if !systime < 10000 ; if over 10 seconds assume a broken lock and take it
      {
         set !lockcount 0
         goto delGlobalVar_waitforlock
      }
   }

}
set * . !lock #nsname
wait 4
set !global * . %1
set !varName %2 , ^ , %3 , ^ , %4 , |
str pos !global !varName
set #result #strres <> 0
if #result
{
   set !varNamePos #strres
   str len !varName
   set !splitString !varNamePos + #strres - 1
   set !delString !varNamePos - 1
   str left !global !delString
   set !globalPart1 #strres
   str del !global 1 !splitString
   set !global #strres
   str pos !global |
   set !delString #strres
   str del !global 1 !delString
   if  * . !lock <> #nsname
   {
      set !lockcount 0
      goto delGlobalVar_waitforlock
   }
   set * . %1 !globalPart1 , #strres
}
if  * . !lock = #nsname
   set * . !lock N/A
set #lpc !lpc
nameSpace clear
nameSpace pop
return #result

;=======================================
;----------------Menu-------------------
;=======================================
sub showEUOMenu1
menu Clear
menu Window Title Gen's Library Donations
menu Window Color BtnShadow
menu Window Size 361 442
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color Aqua
menu Font Transparent #false
menu Font Align Left
menu Font BGColor BtnShadow
menu Text EUOLabel1 52 44 Library rune number
menu Text EUOLabel2 52 72 Bank rune number
menu Text EUOLabel3 92 128 Travel Method
menu Text EUOLabel4 8 212 Status:
menu Font Color Lime
menu Text EUOLabel5 44 212 %status
menu Font Color Aqua
menu Text EUOLabel6 52 100 Number of vendors in runebook
menu Text EUOLabel7 8 236 Instructions:
menu Text EUOLabel8 8 252 1. Start at any bank
menu Text EUOLabel9 8 268 2. setup runebooks.
menu Text EUOLabel10 8 284 3. Set Library/Bank rune numbers, # of vendor runes, and

travel mothod.
menu Text EUOLabel11 8 316 5. Click start.
menu Text EUOLabel12 8 336 Tips:
menu Text EUOLabel13 8 352 * Don't start with more than 3k gold in pack.
menu Text EUOLabel14 8 368 * You can start with items already in pack.
menu Text EUOLabel15 8 300 4. Choose Donations Type
menu Text EUOLabel16 132 156 Donation Type
menu Text EUOLabel17 8 384 * Mark library runes within 3 tiles of npc.
menu Text EUOLabel18 8 400 * Make sure and remove all items you don't wish to donate!
menu Text EUOLabel19 16 416 Spellbooks, weapons, ect.
menu Button runebook 4 8 131 25 Bank/Library Runebook
menu Combo Create library 4 40 41
menu Combo Add library 1
menu Combo Add library 2
menu Combo Add library 3
menu Combo Add library 4
menu Combo Add library 5
menu Combo Add library 6
menu Combo Add library 7
menu Combo Add library 8
menu Combo Add library 9
menu Combo Add library 10
menu Combo Add library 11
menu Combo Add library 12
menu Combo Add library 13
menu Combo Add library 14
menu Combo Add library 15
menu Combo Add library 16
menu Combo Create bank 4 68 41
menu Combo Add bank 1
menu Combo Add bank 2
menu Combo Add bank 3
menu Combo Add bank 4
menu Combo Add bank 5
menu Combo Add bank 6
menu Combo Add bank 7
menu Combo Add bank 8
menu Combo Add bank 9
menu Combo Add bank 10
menu Combo Add bank 11
menu Combo Add bank 12
menu Combo Add bank 13
menu Combo Add bank 14
menu Combo Add bank 15
menu Combo Add bank 16
menu Button start 4 180 75 25 Start
menu Combo Create travel 4 124 81
menu Combo Add travel Magery
menu Combo Add travel Chiv
menu Combo Create vendors 4 96 41
menu Combo Add vendors 1
menu Combo Add vendors 2
menu Combo Add vendors 3
menu Combo Add vendors 4
menu Combo Add vendors 5
menu Combo Add vendors 6
menu Combo Add vendors 7
menu Combo Add vendors 8
menu Combo Add vendors 9
menu Combo Add vendors 10
menu Combo Add vendors 11
menu Combo Add vendors 12
menu Combo Add vendors 13
menu Combo Add vendors 14
menu Combo Add vendors 15
menu Combo Add vendors 16
menu Button runebook2 148 8 115 25 Vendor(s) Runebook
menu Combo Create Donation 4 152 121
menu Combo Add Donation Mace and Sheild
menu Combo Add Donation Wizard's Crystal
menu Combo Add Donation Fold & Steel
menu Show 10 50
return


sub showEUOMenu2
menu Clear
menu Window Title Gen's Library Donations
menu Window Color BtnShadow
menu Window Size 256 72
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color Aqua
menu Font Transparent #false
menu Font Align Left
menu Font BGColor BtnShadow
menu Text EUOLabel1 14 4 Status:
menu Text EUOLabel3 4 24 Donated:
menu Text EUOLabel5 16 44 Points:
menu Button %pause 160 20 75 25 %pause_resume
menu Show 250 495
return

sub showEUOMenu3
menu Clear
menu Window Transparent 80
menu Window Title Gen's Library Donations
menu Window Color BtnShadow
menu Window Size 190 75
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 10
menu Font Style
menu Font Color Aqua
menu Font Transparent #false
menu Font Align Left
menu Font BGColor BtnShadow
menu Text EUOLabel1 16 8 Do you wish to run setup?
menu Font Size 8
menu Button yes 8 44 75 25 YES
menu Button no 96 44 75 25 NO
menu Show 350 300
return

sub menu_refresh
menu delete status
menu delete donated
menu delete points
menu Font Color lime
menu Text status 52 4 %status
menu Text donated 52 24 %donated
menu Text points 52 44 %points
return

sub menu_refresh2
menu delete euolabel5
menu Font Color lime
menu Text EUOLabel5 44 212 %status
return

Also not sure if it matters or not but when I try to change the line below to "TRUE" the script just stops and i have to change it back to "FALSE"... But still I dont think thats the reason why i cant get it to work correctly.

set %reset #false ;set true to reset count
Title: Re: Gen's Library Donations
Post by: cybercasper on January 18, 2016, 05:52:59 AM
dan I have actually got it to work I had to change a few things let me remember what I changed and I will post. here is a key thing too remember that the names are not the same at the library anymore and that they have moved. I had that problem but once I figured out that it was good to go so let me know what you are trying to get and I will get u a working one
Title: Re: Gen's Library Donations
Post by: Dan123The123Man on January 18, 2016, 06:00:51 AM
oh damn thank you man for replying... Yeah I cant even get mine to like even attempt to buy from the vendors though let alone try to donate (haven't gotten that far yet). Is there any way you could post your working version or PM it to me or something?
Title: Re: Gen's Library Donations
Post by: cybercasper on January 18, 2016, 06:23:53 AM
sure this is the script I have changed it is not my script and I don't say it is my script it is just what I have updated to get it to work. I was doing it for mace and shields so if it doesn't work for you let me know

Code: [Select]
;===========================================================================
; Script Name: Gen's Library Donations
; Author: Gen2000
; Version: 1.5
; Client Tested with: 7.0.1.1
; EUO version tested with: 1.5 155
; Shard OSI/FS: OSI
; Public Release: 11/1/09
; Revision Date:
; Global Variables Used: CEO*FILESYSTEM
; Purpose: Recalls to smith/mage shops, buys axes/spell books,
;          Recalls to library & donates for glasses
;
; Glasses: Mace & Sheild, Wizard's Crystal , Fold & Steel
;===========================================================================
; http://www.scriptuo.com
;===========================================================================
; Special Thanks:
;---------------------------------------------------------------------------
; Author:  snicker7
; Script Name:  sub s7UseRunebook
;---------------------------------------------------------------------------
; Author:  Quintok / Raziel
; Script Name: sub waitForSysVars
;---------------------------------------------------------------------------
; Author  CEO
; Script Name: Sub CEO*FILESYSTEM
;===========================================================================
; Items Needed:
; Backpack:     2 Rune Books, 1 bank/library runes, and 1 with vendor shops.
;===========================================================================
; Instructions:  Bank/Library runebook should have rune to bank and library.
;                Vendor runebook should have runes marked to vendor shops.
;                Start off at any bank, click play and follow menu.
;===========================================================================
; Tips:  *DO NOT START WITH MORE THAN 3K GOLD IN PACK.
;        *REMOVE ALL BATTLE AXES YOU MAY WANT TO KEEP FROM PACK.
;        *REMOVE ALL SPELLBOOKS (SLAYERS ECT.) FROM PACK IF DONATING TO MAGE.
;         AND THE SPELLBOOK YOUR USING IN HAND!
;===========================================================================
set %lpc 1000               ;Adjust lpc if buying menu is going too fast.
set %axe_amount 95          ;Amount of axes to buy at a time.
set %spellbook_amount 100   ;Amount of spellbooks to buy at a time.
set %No_Dachi_amount 40     ;Amount of No-Dashis to buy at a time.
set %NPC_axe Garner           ;Name of NPC to Donate Axes.
set %NPC_spellbook William  ;Name of NPC to Donate Spellbooks
set %NPC_No_Dachi Pamela  ;Name of NPC to Donate No Dachis
;===========================================================================
;Option below is used to setup points you already have or reset points.
;Set %reset to #true, set %donated to points you have divided by 9/10 axe/spellbook.
;===========================================================================
set %reset #false ;set true to reset count
if %reset
{
   set %donated 2046 ;Number of points divided by points per item(s).
   gosub putGlobalVar Gen LD #CHARID DONATED
   display set reset back to false and restart script
   halt
}
;===========================================================================
;----------------------------------Setup------------------------------------
;===========================================================================
set %start #true
set %vendortype IS_HS
set #menubutton closed
set %vendor 1
set %pause pause
set %pause_resume Pause
set %d_lpc #lpc
set %status Please , #spc , Wait...
gosub openpack
gosub openstatusbar
gosub getGlobalVar GEN LD #CHARID first
if ! #result
{
   set %first 1
   gosub putGlobalVar GEN LD #CHARID first
   set %donated 0
   set %points 0
   gosub showeuomenu1
   set %status Ready...
   gosub menu_refresh2
   goto setup
}
gosub first_setup
if %SETUP = NO
{
   gosub GetGlobalVars
   goto setup3
}
menu hideeuo
gosub showeuomenu1
set %status Ready...
gosub menu_refresh2
setup:
if #menubutton = runebook
   goto runebook
if #menubutton = runebook2
   goto runebook2
if #menubutton = start
   goto setup2
goto setup
setup2:
menu get travel
if #MENURES = 1
   set %travel r
if #MENURES = 2
   set %travel c
menu get Donation
if #MENURES = 1
   set %donationtype warrior
if #MENURES = 2
   set %donationtype mage
if #MENURES = 3
   set %donationtype warrior2
menu get library
set %library #MENURES
menu get bank
set %bank #MENURES
menu get vendors
set %vendors #MENURES
setup3:
gosub donationtype
gosub showeuomenu2
menu hide
menu hideeuo
set #menubutton closed
gosub SetGlobalVars
goto mainloop
;======================================
;---------------Main Loop--------------
;======================================
mainloop:
finditem %items c_ , #BACKPACKID
if #FINDCNT > 0
{
   set %start #false
   goto mainloop3
}
gosub recall2bank
mainloop2:
gosub recall2vendor
goto findvendor
mainloop3:
gosub recall2library
gosub donate
goto mainloop
;=======================================
;--------------Buy----------------------
;=======================================
findvendor:
set %status Finding , #spc , vendor..
gosub menu_refresh
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
finditem %vendortype G_25
if #findkind = -1
{
   if %donationtype = warrior || %donationtype = mage
   {
      set %vendor %vendor + 1
      if %vendor > %vendors
      {
         set %vendor 1
         ignoreitem reset 2
      }
      if #gold = %did_I_buy
         goto mainloop2
      goto mainloop3
   }
   if %donationtype = Warrior2
   {
      set %wait_count 0
      repeat
      set %wait_count %wait_count + 1
      wait 20
      set %status Waiting , #spc , %wait_count , #spc , Secs
      gosub menu_refresh
      until %wait_count > 60
      ignoreitem reset 2
      goto findvendor
   }
}
if #FINDREP <> 7
{
   ignoreitem #findid 3
   goto findvendor
}
set %vendorid #findid
event Property #findID
if %vendorname notin #property || quest in #property || banker in #property || minter in #property
{
   ignoreitem #findid 3
   goto findvendor
}
;-------------------------------------
if #finddist > 7
{
   set %jindex #jIndex
   set %wait #SCNT + 2
   event pathfind #FINDX #FINDY #FINDZ
   repeat
   scanjournal %jindex
   if get_there in #journal
   {
      ignoreitem #findid 3
      goto findvendor
   }
   set %jindex %jindex + 1
   if N/A in #journal
      set %jindex %jindex - 1
   until pathfinding in #journal || %wait < #SCNT
   wait 2s
}
;-----------------------------------------
exevent popup %vendorid
wait 20
click 20 40
gosub WaitForSysVars CONTNAME = bill_gump CONTSIZE = 283_248 5
if ! #result
{
   if #CONTSIZE = 507_436 ;Quest menu
   {
      set %x2 #CONTPOSX + 350
      set %y2 #CONTPOSY + 400
      click %x2 %y2
      wait 30
      click %x2 %y2
      wait 10
      ignoreitem #findid 3
      set %trys 0
   }
   if #CONTSIZE = 463_414 ;Quest menu 2
   {
      set %x1 #CONTPOSX + 245
      set %y1 #CONTPOSY + 344
      click %x1 %y1
      wait 10
      ignoreitem #findid 3
      set %trys 0
   }
   set %trys %trys + 1
   if %trys > 2
   {
      ignoreitem #findid 3
      set %trys 0
   }
      goto findvendor
}
set %x_buy #CONTPOSX - 118
set %y_buy #CONTPOSY - 135
set %x_next #CONTPOSX + 73
set %y_next #CONTPOSY - 11
set %x_sign #CONTPOSX + 43
set %y_sign #CONTPOSY + 205
itemtobuy:
set #lpc %lpc
set %status Shopping..
gosub menu_refresh
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
getshopinfo
if #SHOPITEMTYPE in %ITEMS
{
goto buy
}
click %x_next %y_next ;next
if #SHOPCURPOS = #SHOPCNT
{
  set #lpc %d_lpc
  click %x_sign %y_sign ;sign
   CONTNAME <> bill_gump CONTSIZE <> 283_248 5
ignoreitem %vendorid 2
  goto findvendor
}
goto itemtobuy


buy:
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
if #SHOPITEMPRICE > %MAX_PRICE
{
   click %x_next %y_next
   goto skip
}
click %x_buy %y_buy d ;buy
click %x_buy %y_buy d ;buy
getShopInfo
set %amount %number
if #SHOPITEMMAX < %number
   set %amount #SHOPITEMMAX
setShopItem #shopItemID %amount
set #lpc %d_lpc
click %x_sign %y_sign ;sign
gosub WaitForSysVars CONTNAME <> bill_gump CONTSIZE <> 283_248 5
;ignoreitem reset 2
goto mainloop3
skip:
if #SHOPCURPOS = #SHOPCNT
{
  set #lpc %d_lpc
  click %x_sign %y_sign ;sign
  gosub WaitForSysVars CONTNAME <> bill_gump CONTSIZE <> 283_248 5
  ignoreitem %vendorid 2
  if #gold = %did_I_buy
     goto findvendor
  goto mainloop3
}
goto itemtobuy
;=======================================
;--------------Subs---------------------
;=======================================
sub donationtype
if %donationtype = warrior
{
   set %MAX_PRICE 23
   set %number %axe_amount
   set %donate %NPC_axe
   set %items BSF_HSF
   set %points_per 9
   set %vendorname smith
   return
}
if %donationtype = mage
{
   set %MAX_PRICE 18
   set %number %spellbook_amount
   set %donate %NPC_spellbook
   set %items MPF
   set %points_per 10
   set %vendorname mage
   return
}
if %donationtype = warrior2
{
   set %MAX_PRICE 73
   set %number %No_Dachi_amount
   set %donate %NPC_No_Dachi
   set %items EDP
   set %points_per 27
   set %vendorname smith
   return
}
display Error in setup!
halt

sub first_setup
gosub showeuomenu3
first_setup:
if #MENUBUTTON = yes
{
   set #MENUBUTTON closed
   set %SETUP yes
   return
}
if #MENUBUTTON = no
{
   set #MENUBUTTON closed
   set %SETUP no
   return
}
goto first_setup

sub recall2bank
if %start
{
set %start #false
set %gold %number * %MAX_PRICE
set %gold %gold - #GOLD
if %gold < 1
   return
event macro 3 0 withdraw %gold
return
}
bank:
if *stop
{
      set #menubutton pause
      set *stop #false
}
if #menubutton = pause
   gosub pause
set %status Recalling , #spc , to , #spc , bank
gosub menu_refresh
set %start #CHARPOSX
gosub s7UseRunebook %runebook %bank %travel
set %recall_timer #SCNT + 10
wait_bank:
if %recall_timer < #SCNT
{
   goto bank
}
if %start = #CHARPOSX
   goto wait_bank
set %start #false
;set %number ( #MAXWEIGHT - #WEIGHT ) / 4
set %gold %number * %MAX_PRICE
set %gold %gold - #GOLD
if %gold < 1
   return
event macro 3 0 withdraw %gold
return


sub recall2vendor
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
set %status Recalling , #spc , to , #spc , vendor , #spc , %vendor
gosub menu_refresh
set %start #CHARPOSX
gosub s7UseRunebook %runebook2 %vendor %travel
set %recall_timer #SCNT + 10
wait_vendor:
if %recall_timer < #SCNT
{
   if err in #result
      set %vendor %vendor + 1
   goto mainloop2
}
if %start = #CHARPOSX
   goto wait_vendor
set %did_I_buy #gold
wait 20
return

sub recall2library
library:
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
set %status Recalling , #spc , to , #spc , library
gosub menu_refresh
set %start #CHARPOSX
gosub s7UseRunebook %runebook %library %travel
set %recall_timer #SCNT + 10
wait_library:
if %recall_timer < #SCNT
{
   goto library
}
if %start = #CHARPOSX
   goto wait_library
return


sub donate
set %status Donating...
gosub menu_refresh
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
donate:
finditem IS_HS g_4
if #findkind = -1
{
   display Not close enough to %Donate - Fix it - Script Paused
   gosub pause
   goto donate
}
if #findrep <> 7
{
   ignoreitem #findid player
   goto donate
}
event property #findid
if #property = $
   goto donate
if %donate notin #property
{
   ignoreitem #findid npc
   goto donate
}
set #lobjectid #findid
finditem %items c_ , #BACKPACKID
if #findkind = -1
{
   click %x %y r
   return
}
set #ltargetid #findid
set #ltargetkind 1
event macro 17 0
set #ltargetid #findid
set #ltargetkind 1
donate2:
if *stop
{
   set #menubutton pause
   set *stop #false
}
if #menubutton = pause
   gosub pause
gosub waitforsysvars CONTNAME = generic_gump CONTSIZE = 345_359 2
if ! #result
   goto donate
if #result
{
   finditem %items c_ , #BACKPACKID
   if #findkind = -1
   {
      click %x %y r
      return
   }
   set #ltargetid #findid
   set #ltargetkind 1
   if %donationtype = Warrior || %donationtype = mage
   {
      set %x #CONTPOSX + 39
      set %y #CONTPOSY + 300
      click %x %y
      target 2s
      event macro 22 0
   }
   if %donationtype = Warrior2
   {
      set %x #CONTPOSX + 306
      set %y #CONTPOSY + 343
      click %x %y
      click %x %y
      set %x #CONTPOSX + 39
      set %y #CONTPOSY + 266
      click %x %y
      target 2s
      event macro 22 0
   }
   set %donated %donated + 1
   set %points ( %donated * %points_per )
   gosub putGlobalVar Gen LD #CHARID DONATED
   gosub menu_refresh
   goto donate2
}
goto donate


runebook:
set %status Target , #spc , your , #spc , #spc , Bank/Library , #spc , Runebook
gosub menu_refresh2
set #targcurs 1
repeat
until #targcurs = 0
set %runebook #ltargetid
set %status Ready...
gosub menu_refresh2
set #menubutton closed
goto setup

runebook2:
set %status Target , #spc , your , #spc , #spc , Vendor(s) , #spc , Runebook
gosub menu_refresh2
set #targcurs 1
repeat
until #targcurs = 0
set %runebook2 #ltargetid
set %status Ready...
gosub menu_refresh2
set #menubutton closed
goto setup


sub openstatusbar
openstatusbar:
event macro 8 2
gosub WaitForSysVars CONTSIZE = 584_216 CONTNAME = status_gump
if ! #result
{
   goto openstatusbar
}
movestatus:
set #CONTPOSX 800
set #CONTPOSY 420
gosub WaitForSysVars CONTPOSX = 800 CONTPOSY = 420 5
if ! #result
{
   goto movestatus
}
wait 20
return

sub openpack
openpack:
event macro 8 7
gosub WaitForSysVars CONTSIZE = 230_204 CONTNAME = container_gump
if ! #result
{
   goto openpack
}
movepack:
set #CONTPOSX 815
set #CONTPOSY 255
gosub WaitForSysVars CONTPOSX = 815 CONTPOSY = 255 5
if ! #result
{
   goto movepack
}
wait 20
return


sub pause
set %pause resume
set %pause_resume Resume
set %status Paused..
menu Font Color Aqua
menu Button %pause 160 20 75 25 %pause_resume
menu set %pause %pause_resume
gosub menu_refresh
pause:
if #menubutton = resume
{
   set %pause pause
   set %pause_resume pause
   menu Font Color Aqua
   menu Button %pause 160 20 75 25 %pause_resume
   menu set %pause %pause_resume
   gosub menu_refresh
   return
}
goto pause
;===================================================
; Script Name:  sub s7UseRunebook
; Author:  snicker7
; Version:  2.0
; Client Tested with:  4.0.11c
; EUO version tested with:  1.42/1.5
; Shard OSI / FS:  OSI/FS
; Revision Date:  24Aug05
; Public Release:  24Aug05
; Global Variables Used: N/A
; Purpose:  Failsafe sub to recall, gate, sacred journey flawlessly. Options to use scrolls, default locations, recharge books with scrolls in pack if book runs out of charges, and perfect gate travel. Not for the feint of heart!
;===================================================
;======= This file includes the main sub and =======
;===== several support subs that are required. =====
;===================================================
;===== Much love for T-Mo and BM, but I needed =====
;====== to write something I could only blame ======
;======= myself for if it fails. even though =======
;=================== it doesn't. ===================
;===================================================

; ===================================================================== ;
; ///////////////////////////////////////////////////////////////////// ;
; // EXCERPTS FROM S7SUBS.EUO ///////////////////////////////////////// ;
; ///////////////////////////////////////////////////////////////////// ;
; // Any reproduction of the subroutines below is strictly pro- /////// ;
; // hibited without express written permission of the author ///////// ;
; // (snicker7). Violation of the above will result in malicious ////// ;
; // actions by the aforementioned author performed upon your person // ;
; // including but not limited to: bodily harm, slander, maternal ///// ;
; // insults, possible legal action, and callin' the five-oh. Thank /// ;
; // you. ///////////////////////////////////////////////////////////// ;
; ///////////////////////////////////////////////////////////////////// ;
; ===================================================================== ;

;=/ 1NCLUD3D SUBS: /================================
; s7UseRunebook: Duh, you know why it's there.
; s7ScanJournalFor: SuperMultiParameterJournalScanning Power!
; s7MoveToPos: Legendary snicker7 brand name drag and drop sub. updated!
; s7MoveToCont: Wrapper for the above sub, updated for 1.5 exevents!
; s7WaitForAction: Mildly obsolete, begging for a rewrite object-delay sub!
; s7WaitForVars: Classic sysvar wait sub. One line shorter than Quintok's!
;===================================================

;----
;* @name s7UseRunebook
;* @author snicker7
;* @ver 2.0a 24Aug05
;* @purpose   do anything and everything travel related with a runebook
;* @params    %1   Rune or Runebook item ID to use
;*      %2   number of rune to travel to, use "default" for runes or default in runebook
;*      %3   travel method:
;*         r: recall
;*         g: gate
;*         c: sacred journey
;*         s: scrolls
;* @dependencies
;*      s7WaitForVars
;*      s7WaitForAction
;*      s7ScanJournalFor
;*      s7MoveToCont for recharging runebooks
;* @returns    #true   on success
;*      ERR_*   various errors.
;* @notes    none
;* @example:    gosub s7UseRunebook %bookID 14 r
;* @status done
sub s7UseRunebook
  if %0 < 3 || _ , %2 , _ notin _1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_default_
    return ERR_IncorrectParams
  namespace push
  namespace local _s7URB
  set !runebook %1
  set !index %2
  set !method %3
  set !fails 0
  if #contsize = 452_236
  {
    set !_cx #contposx + 20
    set !_cy #contposy + 20
    click !_cx !_cy r f dmc
    wait 5
  }
  for !_ 1 1
  {
    finditem OTF_JEF_KEF G_0
    if #findkind <> -1
      set !_ 0
  }
  for !orb 1 1
  {
    if !fails > 0 2
      namespace pop
      return ERR_ , #journal
    set !jStart #jindex + 1
    if !index <> default
    {
      gosub s7WaitForAction 12
      set #lobjectid !runebook
      event macro 17 0
      gosub s7WaitForVars contname = generic_gump contsize = 452_236 3
      if ! #result 2
        set !fails !fails + 1
        set !orb 0
      if #result
      {
        set !_cy #contposy + 196
        set !_cx #contposx + 105 + ( ( ( !index / 2 ) + ( !index % 2 ) ) * 35 )
        if !index > 8
          set !_cx !_cx + 30
        click !_cx !_cy f dmc
        wait 5
        set !_cx #contposx + 135
        set !_cy #contposy + 144
        if !method = G
          set !_cy !_cy + 20
        if !method = C
          set !_cy !_cy + 36
        if !method = S
          set !_cy !_cy - 76
        if ( !index % 2 ) = 0
          set !_cx !_cx + 160
        set !charpos #charposx , _ , #charposy
        set !timeout #scnt2
        click !_cx !_cy f dmc
      }
    }
    if !index = default
    {
      set #ltargetid !runebook
      set #ltargetkind 1
      if !method = c
        event macro 15 210
      if !method = r
        event macro 15 31
      if !method = g
        event macro 15 51
      if !method = s
      {
        finditem WTL C_ , #backpackid
        if #findkind = -1 2
          namespace pop
          return ERR_NoRecallScrolls
        if #findkind <> -1 3
          set #lobjectid #findid
          gosub s7WaitForAction 12
          event macro 17 0
      }
      for !_ 1 1
      {
        if #targcurs <> 1
          set !_ 0
        gosub s7ScanJournalFor !jStart fizzles more_reagents tithing_points insufficient_mana
        if #result 3
          set !_ 1
          set !orb 0
          wait 20
      }
      set !charpos #charposx , _ , #charposy
      set !timeout #scnt2
      event macro 22 0
    }
    if !orb = 1
    {
      for !success 1 1
      {
        if #charposx , _ , #charposy = !charpos && !method in _r_c_s_
          set !success 0
        if !method = g
        {
          finditem OTF_JEF_KEF G_0
          if #findkind = -1
            set !success 0
          if #findkind <> -1
          {
            set #lobjectid #findid
            gosub s7WaitForAction 12
            event macro 17 0
            for !_ 1 1
            {
              if #charposx , _ , #charposy = !charpos
                set !_ 0
              if #contname = generic_gump && #contsize = 420_280
              {
                set !_cx #contposx + 20
                set !_cy #contposy + 260
                click !_cx !_cy f dmc
              }
            }
          }
        }
        gosub s7ScanJournalFor !jStart fizzles location_is_blocked not_yet_recovered no_charges_left more_reagents tithing_points insufficient_mana not_marked
        if #result || !timeout + 60 < #scnt2
        {
          if no_charges in #journal
          {
            finditem WTL C_ , #backpackid
            if #findkind = -1
              set !fails 2
            if #findkind <> -1
            {
              set !scrolls #findid
              finditem !runebook
              set #findmod 0
              gosub s7WaitForAction 12
              event drag !runebook
              for !_ 1 1
              {
                if #lliftedkind <> 1 2
                  wait 1
                  set !_ 0
              }
              str pos #contsize _
              set #strres #strres - 1
              str left #contsize #strres
              set !_cx #findx + #strres / 2
              str pos #contsize _
              str del #contsize 1 #strres
              set !_cy #findy + #strres / 2
              click !_cx !_cy p f dmc
              gosub s7MoveToCont !scrolls !runebook #backpackid 20_10
            }
          }
          set !fails !fails + 1
          set !success 1
          set !orb 0
        }
      }
      wait 20
    }
  }
namespace pop
return #true

sub s7ScanJournalFor
  set !SJFje #jindex + 1
  for !SJFji %1 !SJFje
  {
    scanjournal !SJFji
    for !SJFpi 2 %0
    {
      if % . !SJFpi in #journal
        return #true
    }
  }
return #false

;----
;* @name s7MoveToPos
;* @author snicker7
;* @ver 1.2 24Aug05
;* @purpose Just Another Item Dragger.
;* @params    %1 is the item to be dragged
;*      %2 is the x-coord to drop to
;*       %3 is the y-coord to drop to
;*      %4 is the timeout in seconds
;*       %5 is the amount to be dragged (blank for all)
;* @returns    #true if drop was successful
;*      #false on error (drop to backpack, insufficient params, failed to drag)
;*      halt on critical error
;* @notes moves any item to a position on the screen. Will
;*   attempt to drop on character if drop fails. If character
;*   drop fails, halts and error message to avoid crash.
;* @dependencies
;*      s7WaitForAction
;* @example: call s7Subs.euo s7MoveToPos #findid 7 9 4 77
;* @status unknown
sub s7MoveToPos
  if %0 < 4
    return #false
  namespace Push
  namespace Local _s7MvToPos
  set !_ID %1
  set !_x %2
  set !_y %3
  set !_tO %4
  set !_Amt #spc
  if %0 > 4
    set !_Amt %5
  set !_retry 0
  _s7MvToPos_SD:
  finditem !_ID
  if #findkind = -1 2
    namespace pop
    return #false
  gosub s7WaitForAction 13
  event drag #findid
  if #findstack > 1
  {
    set !_timeOut #scnt
    for !_ 1 1
    {
      if #contname <> stack_gump && #contname <> drag_gump
      {
        wait 1
        if !_timeOut + !_tO < #scnt
        {
          set !_retry !_retry + 1
          if !_retry > 2 2
            namespace pop
            return #false
          goto _s7MvToPos_SD
        }
        set !_ 0
      }
    }
    if !_Amt > #findstack
      set !_Amt #findstack
    msg !_Amt , $
  }
  set !_retry 0
  set !_timeOut #scnt
  for !_ 1 1
  {
    if #lliftedkind <> 1
    {
      wait 1
      if !_timeOut + !_tO < #scnt
      {
        set !_retry !_retry + 1
        if !_retry > 2 2
          namespace pop
          return #false
        goto _s7MvToPos_SD
      }
      set !_ 0
    }
  }
  set !_retry 0
  click !_x !_y p
  set !_timeout #scnt
  for !_ 1 1
  {
    if #lliftedkind = 1
    {
      wait 1
      if !_timeout + !_t0 < #scnt
      {
        set !_retry !_retry + 1
        if !_retry = 1
        {
          set !_x #clixres / 2
          set !_y ( #cliyres / 2 ) - 30
          click !_x !_y p
          set #result #false
          set !_timeout #scnt
        }
        if !_retry = 2 2
          display ok You have failed to drop an item to the correct position.$$The script is now halting to prevent a crash.
          halt
      }
      set !_ 0
    }
  }
  set #result #true
  namespace pop
return #result

;----
;* @name s7MoveToCont
;* @author snicker7
;* @ver 1.2 24Aug05
;* @purpose A wrapper for the sub s7MoveToPos for moving to containers.
;* @params    %1 is the item to be dragged
;*      %2 is the container to drag to
;*      %3 is the mother container in which %2 is contained
;*       %4 is the #findmod value for the container
;*       %5 is the amount to be dragged (blank for all)
;* @returns none
;* @notes this is mad basic. no error checking. That is up to you.
;* @dependencies   s7MoveToPos
;* @example: call s7Subs.euo s7MoveToCont #findid #backpackid #charid 140_220
;* @status tested good
sub s7MoveToCont
  namespace Push
  namespace Local _s7MoveToCont
  set !_ID %1
  set !_DCont %2
  set !_MCont %3
  set !_FMod %4
  if 1_5 in #euover
  {
    set !_Amt 65535
    if %0 > 4
      set !_Amt abs %5
    finditem !_ID
    if #findkind = -1 2
      namespace pop
      return #false
    gosub s7WaitForAction 13
    exevent drag #findid !_Amt
    exevent dropc !_DCont
    namespace pop
    return #true
  }
  set !_Amt #spc
  if %0 > 4
    set !_Amt %5
  set #result #true
  set !_retry 0
  for !_ 1 1
  {
    finditem !_DCont C_ , !_MCont
    if #findkind = -1
    {
      set #lobjectid !_MCont
      gosub s7WaitForAction 13
      event macro 17 0
      gosub s7WaitForVars contid = !_MCont 3
      if ! #result
      {
        set !_retry !_retry + 1
        if !_retry > 2 2
          namespace pop
          return #false
      }
      set !_ 0
    }
  }
  set !_retry 0
  set #findmod !_Fmod
  for !_ 1 1
  {
    gosub s7MoveToPos !_ID #findx #findy 4 !_Amt
    if ! #result
    {
      set !_retry !_retry + 1
      if !_retry > 2 2
        namespace pop
        return #false
      set !_ 0
    }
  }
namespace Pop
return #true

;----
;* @name s7WaitForAction
;* @author snicker7
;* @ver 1.1 31Jan05
;* @purpose waits 1.3 seconds before continuing, useful for waiting to perform
;*    another action
;* @params    none
;* @returns none
;* @notes probably not an original idea, but I need to use it frequently and it
;*    was easier to write it myself than to try to look for it as written by
;*    someone else

;* @example: call s7Subs.euo s7WaitForAction 13
;* @status tested good
sub s7WaitForAction
  _s7WaitForAction:
  if %_s7ActionTimer + %1 > #scnt2 2
    wait 1
    goto _s7WaitForAction
  set %_s7ActionTimer #scnt2
return

;----
;* @name s7WaitForVars
;* @author snicker7, inspired by Quintok, and of course, Smertrios
;* @ver 1.2 24Aug05
;* @purpose Multiple input sysvar waiter.
;* @params    %1*n is the gump sysvar being checked
;*      %2*n is the comparative operator (>, <, <>, =, etc)
;*      %3*n is the desired value of the sysvar
;*      %nfinal is the timeout in seconds
;* @returns #false if it times out
;*          #true if success
;* @notes    %1 does not require the preceding number sign
;*      one line shorter than Q's, no disrespect son
;*      originally written by Smertrios, included in Lexia
;*      Multiple inputs by Quintok, Obfuscation and name-
;*      spacing by snicker7!
;* @example: call s7Subs.euo s7WaitForVars contID = #backpackID contSize = 7_9 3
;* @status tested good
sub s7WaitForVars
  namespace Push
  namespace Local _s7WFVs
  set !C %0 / 3
  set !T #scnt + 5
  if ( %0 % 3 ) = 1
    set !T #scnt + % . %0
  for !i 1 !C
  {
    set !o 3 * !i - 2
    set !p !o + 1
    set !q !o + 2
    if ! ( # . % . !o % . !p % . !q )
      set !i 0
    if #scnt > !T 2
      namespace pop
      return #false
  }
  namespace Pop
return #true
;======================================
;----------End of S7urb----------------
;======================================


;======================================
; Script Name: sub waitForSysVars
; Author: Quintok / Raziel
; Version: 1.05
; Client Tested with: 4.0.2b
; EUO version tested with: 0078
; Shard OSI / FS: OSI / FS
; Revision Date: 22th August 2005
; Public Release: 20th March 2004
; Global Variables Used: none
; Purpose: same as waitForSysVar but for multiple inputs.
;%1 system variable without '#'
;%2 = <> > < ... etc
;%3 comparing value
;%4 system variable without '#'
;%5 = <> > < ... etc
;%6 comparing value
;%n = timeout (not required)
;======================================
sub waitForSysVars
  set !cnt %0 / 3
  set !timeOut #scnt + 5
  if ( %0 % 3 = 1 )
    set !timeOut #scnt + % . %0
  for !i 1 !cnt
  {
    set !offset 3 * !i - 2
    set !evaluation !offset + 1
    set !value !offset + 2
    if ! ( # . % . !offset % . !evaluation % . !value )
      set !i 0
    if #scnt > !timeout
      return #false
  }
return #true
;=======================================
sub SetGlobalVars
gosub putGlobalVar GEN LD #CHARID BANK
gosub putGlobalVar Gen LD #CHARID LIBRARY
gosub putGlobalVar Gen LD #CHARID RUNEBOOK
gosub putGlobalVar Gen LD #CHARID RUNEBOOK2
gosub putGlobalVar Gen LD #CHARID TRAVEL
gosub putGlobalVar Gen LD #CHARID VENDORS
gosub putGlobalVar Gen LD #CHARID DONATIONTYPE
return

sub GetGlobalVars
gosub getGlobalVar Gen LD #CHARID BANK
gosub getGlobalVar Gen LD #CHARID DONATED
gosub getGlobalVar Gen LD #CHARID LIBRARY
gosub getGlobalVar Gen LD #CHARID RUNEBOOK
gosub getGlobalVar Gen LD #CHARID RUNEBOOK2
gosub getGlobalVar Gen LD #CHARID TRAVEL
gosub getGlobalVar Gen LD #CHARID VENDORS
gosub getGlobalVar Gen LD #CHARID DONATIONTYPE
return

;==================================
; Script Name:  CEO*FileSystem (pseudo filesystem)
; Author: CEO
; Version: 1.1
; Client Tested with: 4.0.1b
; EUO version tested with: 1_41_103
; Shard OSI / FS: OSI
; Revision Date: 040219
; Public Release: 040219
; Globals Used: User specified (2 total)
; Purpose: Allows you to use a * variable as a pseudo-filesystem
;=======================================
; CEO's global variable management subs:
;      getGlobalVar  . putGlobalVar  . delGlobalVar
;=======================================
;
;ver 1.1
;changed the lock file to use *variablename_lock so it'll work with any named *variable
;
Sub getGlobalVar

;ver 1.0 posted 19Feb04 by CEO
;purpose: Allows you to store multiple variables in one global variable unique to
;             each player and script. getGlobaVar retrieves a value from a global variable.
;@returns: #result = #false if variable not found, #true if found
;            % . %3 contains variable value
;%1 is the global/persistant variable to use ( %1 + 1 is used for locking)
;%2 is the script identifer or pseudo filename
;%3 is #charid or pseudo filename
;%4 is the variable to search for and return in %. %3
;%5 is for lock control. By default getGlobalVar uses a lock to return a value. In some cases you may want to
;       retrieve a variable (mostly for speed) without needing a lock as long as you are aware of
;      any potentional conflicts, that very rarely may occur. Set this param to NOLOCK to access
;      global storage without a lock.
;sample usage:
;               gosub getGlobalVar 50 MyScript #charid backpackid
; Using global var *50 finds the variable labeled MyScript#charidbackpackid and returns it in %backpackid
;
;               gosub getGlobalVar 50 MyScript #charid clothstat NOLOCK
; Using global var *50 find the variable labeled MyScript#charidclothstat and returns it in %clothstat without using a lock
; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
nameSpace push
nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , GET
set !lpc #lpc
set #lpc 1000
set !lock %1 , _lock
if ( %0 = 5 ) && ( %5 = NOLOCK )
   goto getGlobalVar_skiplock
set !lockcount 0
getGlobalVar_waitforlock:
if * . !lock <> N/A && * . !lock <> #nsname
{
   wait 1 4
   set !lockcount !lockcount + 1
   if !lockcount < 10
      goto getGlobalVar_waitforlock
   if * . !lock <> N/A
   {
      set !currentlock * . !lock
      if !currentlock = N/A
         goto getGlobalVar_waitforlock
      str pos !currentlock _
      set !strres #strres - 1
      str left !currentlock !strres
      set !systime #systime - #strres
      if !systime < 10000 ; if over 10 seconds assume a broken lock and take it
      {
         set !lockcount 0
         goto getGlobalVar_waitforlock
      }
   }
}
set * . !lock #nsname
wait 3 2
if  * . !lock <> #nsname
{
   set !lockcount 0
   goto getGlobalVar_waitforlock
}
getGlobalVar_skiplock:
set !global * . %1
set !varName %2 , ^ , %3 , ^ , %4 , |
str pos !global !varName
set #result #strres <> 0
if #result
{
   set !varNamePos #strres
   str len !varName
   set !delString !varNamePos + #strres - 1
   str del !global 1 !delString
   set !global #strres
   str pos !global |
   set !varNamePos #strres - 1
   str left !global !varNamePos
   set % . %4 #strres
}
if ( %0 < 5 || %5 <> NOLOCK ) && * . !lock = #nsname
   set * . !lock N/A
set #lpc !lpc
nameSpace Clear
nameSpace Pop
return #result

Sub putGlobalVar
;ver 1.0 posted 19Feb04 by CEO
;purpose: Allows you to store multiple variables in one global variable unique to
;             each player and script. putGlobaVar stores a value into a global variable.

;@returns: #result = #false if variable not found, #true if found
;            % . %3 contains variable
;%1 is the global/persistant variable to use
;%2 is the script identifer or pseudo filename
;%3 #charid or other identifier
;%4 is the variable name of the variable to save into the* variable identified in %1
;sample usage:
;               gosub putGlovalVar 50 MyScript #chardid backpackid
; Using global var *50 stores/updates the variable labeled MyScript#charidbackpackid  with %backpackid
; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
nameSpace push
nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , PUT
set !lpc #lpc
set #lpc 1000
set !lock %1 , _lock
set !lockcount 0
putGlobalVar_waitforlock:
if * . !lock <> N/A && * . !lock <> #nsname
{
   wait 1 4
   set !lockcount !lockcount + 1
   if !lockcount < 10
      goto putGlobalVar_waitforlock
   if * . !lock <> N/A
   {
      set !currentlock * . !lock
      if !currentlock = N/A
         goto putGlobalVar_waitforlock
      str pos !currentlock _
      set !strres #strres - 1
      str left !currentlock !strres
      set !systime #systime - #strres
      if !systime < 10000 ; if over 10 seconds assume a hung lock and take it
      {
         set !lockcount 0
         goto putGlobalVar_waitforlock
      }
   }
}
set * . !lock #nsname
wait 4
set !global * . %1
set !varName %2 , ^ , %3 , ^ , %4 , |
str pos !global !varName
if #strres = 0
{
   if  * . !lock <> #nsname
   {
      set !lockcount 0
      goto putGlobalVar_waitforlock
   }
   if  |CEO*FILESYSTEM| notin !global
      set !global |CEO*FILESYSTEM|
   set * . %1 !global , !varName , % . %4 , |
   set * . !lock N/A
   set #lpc !lpc
   nameSpace clear
   nameSpace pop
   return #true
}
set !varNamePos #strres
str len !varName
set !splitString !varNamePos + #strres - 1
str left !global !splitstring
set !globalPart1 #strres
str del !global 1 !splitString
set !global #strres
str len !global
set !globalLen #strres
str pos !global |
set !splitString !globalLen - #strres + 1
str right !global !splitstring
set !global #strres
if  * . !lock <> #nsname
{
   set !lockcount 0
   goto putGlobalVar_waitforlock
}
set * . %1 !globalPart1 , % . %4 , !global
set * . !lock N/A
set #lpc !lpc
nameSpace clear
nameSpace pop
return #true


Sub delGlobalVar
;ver 1.0 posted 19Feb04 by CEO
;purpose: Allows you to delete a variable out of the globalvar pool unique to
;             each player and script. delGlobaVar deletes a global variable in a * variable.

;@returns: #result = #false if variable not found, #true if  deleted
;
;%1 is the global/persistant variable to use
;%2 is the script identifer or pseudo filename
;%3 is #charid or other identifier
;%4 is the variable name of the variable to save into the* variable identified in %1
;sample usage:
;               gosub delGlovalVar 50 MyScript #charid backpackid
; Using global var *50 deletes  the variable label MyScript#charidbackpackid  and it's associated value.
; Warning: do not use *1000. * %1 + 1 is used for locking and there is no *1001!
nameSpace push
nameSpace local #systime , _ , %2 , _ , %3 , _ , %4 , _ , DEL
set !lpc #lpc
set #lpc 1000
set !lock %1 , _lock
set !lockcount 0
delGlobalVar_waitforlock:
if * . !lock <> N/A && * . !lock <> #nsname
{
   wait 1 4
   set !lockcount !lockcount + 1
   if !lockcount <  10
      goto delGlobalVar_waitforlock

   if * . !lock <> N/A
   {
      set !currentlock * . !lock
      if !currentlock = N/A
         goto delGlobalVar_waitforlock
      str pos !currentlock _
      set !strres #strres - 1
      str left !currentlock !strres
      set !systime #systime - #strres
      if !systime < 10000 ; if over 10 seconds assume a broken lock and take it
      {
         set !lockcount 0
         goto delGlobalVar_waitforlock
      }
   }

}
set * . !lock #nsname
wait 4
set !global * . %1
set !varName %2 , ^ , %3 , ^ , %4 , |
str pos !global !varName
set #result #strres <> 0
if #result
{
   set !varNamePos #strres
   str len !varName
   set !splitString !varNamePos + #strres - 1
   set !delString !varNamePos - 1
   str left !global !delString
   set !globalPart1 #strres
   str del !global 1 !splitString
   set !global #strres
   str pos !global |
   set !delString #strres
   str del !global 1 !delString
   if  * . !lock <> #nsname
   {
      set !lockcount 0
      goto delGlobalVar_waitforlock
   }
   set * . %1 !globalPart1 , #strres
}
if  * . !lock = #nsname
   set * . !lock N/A
set #lpc !lpc
nameSpace clear
nameSpace pop
return #result

;=======================================
;----------------Menu-------------------
;=======================================
sub showEUOMenu1
menu Clear
menu Window Title Gen's Library Donations
menu Window Color BtnShadow
menu Window Size 361 442
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color Aqua
menu Font Transparent #false
menu Font Align Left
menu Font BGColor BtnShadow
menu Text EUOLabel1 52 44 Library rune number
menu Text EUOLabel2 52 72 Bank rune number
menu Text EUOLabel3 92 128 Travel Method
menu Text EUOLabel4 8 212 Status:
menu Font Color Lime
menu Text EUOLabel5 44 212 %status
menu Font Color Aqua
menu Text EUOLabel6 52 100 Number of vendors in runebook
menu Text EUOLabel7 8 236 Instructions:
menu Text EUOLabel8 8 252 1. Start at any bank
menu Text EUOLabel9 8 268 2. setup runebooks.
menu Text EUOLabel10 8 284 3. Set Library/Bank rune numbers, # of vendor runes, and travel mothod.
menu Text EUOLabel11 8 316 5. Click start.
menu Text EUOLabel12 8 336 Tips:
menu Text EUOLabel13 8 352 * Don't start with more than 3k gold in pack.
menu Text EUOLabel14 8 368 * You can start with items already in pack.
menu Text EUOLabel15 8 300 4. Choose Donations Type
menu Text EUOLabel16 132 156 Donation Type
menu Text EUOLabel17 8 384 * Mark library runes within 3 tiles of npc.
menu Text EUOLabel18 8 400 * Make sure and remove all items you don't wish to donate!
menu Text EUOLabel19 16 416 Spellbooks, weapons, ect.
menu Button runebook 4 8 131 25 Bank/Library Runebook
menu Combo Create library 4 40 41
menu Combo Add library 1
menu Combo Add library 2
menu Combo Add library 3
menu Combo Add library 4
menu Combo Add library 5
menu Combo Add library 6
menu Combo Add library 7
menu Combo Add library 8
menu Combo Add library 9
menu Combo Add library 10
menu Combo Add library 11
menu Combo Add library 12
menu Combo Add library 13
menu Combo Add library 14
menu Combo Add library 15
menu Combo Add library 16
menu Combo Create bank 4 68 41
menu Combo Add bank 1
menu Combo Add bank 2
menu Combo Add bank 3
menu Combo Add bank 4
menu Combo Add bank 5
menu Combo Add bank 6
menu Combo Add bank 7
menu Combo Add bank 8
menu Combo Add bank 9
menu Combo Add bank 10
menu Combo Add bank 11
menu Combo Add bank 12
menu Combo Add bank 13
menu Combo Add bank 14
menu Combo Add bank 15
menu Combo Add bank 16
menu Button start 4 180 75 25 Start
menu Combo Create travel 4 124 81
menu Combo Add travel Magery
menu Combo Add travel Chiv
menu Combo Create vendors 4 96 41
menu Combo Add vendors 1
menu Combo Add vendors 2
menu Combo Add vendors 3
menu Combo Add vendors 4
menu Combo Add vendors 5
menu Combo Add vendors 6
menu Combo Add vendors 7
menu Combo Add vendors 8
menu Combo Add vendors 9
menu Combo Add vendors 10
menu Combo Add vendors 11
menu Combo Add vendors 12
menu Combo Add vendors 13
menu Combo Add vendors 14
menu Combo Add vendors 15
menu Combo Add vendors 16
menu Button runebook2 148 8 115 25 Vendor(s) Runebook
menu Combo Create Donation 4 152 121
menu Combo Add Donation Mace and Sheild
menu Combo Add Donation Wizard's Crystal
menu Combo Add Donation Fold & Steel
menu Show 10 50
return


sub showEUOMenu2
menu Clear
menu Window Title Gen's Library Donations
menu Window Color BtnShadow
menu Window Size 256 72
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color Aqua
menu Font Transparent #false
menu Font Align Left
menu Font BGColor BtnShadow
menu Text EUOLabel1 14 4 Status:
menu Text EUOLabel3 4 24 Donated:
menu Text EUOLabel5 16 44 Points:
menu Button %pause 160 20 75 25 %pause_resume
menu Show 250 495
return

sub showEUOMenu3
menu Clear
menu Window Transparent 80
menu Window Title Gen's Library Donations
menu Window Color BtnShadow
menu Window Size 190 75
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 10
menu Font Style
menu Font Color Aqua
menu Font Transparent #false
menu Font Align Left
menu Font BGColor BtnShadow
menu Text EUOLabel1 16 8 Do you wish to run setup?
menu Font Size 8
menu Button yes 8 44 75 25 YES
menu Button no 96 44 75 25 NO
menu Show 350 300
return

sub menu_refresh
menu delete status
menu delete donated
menu delete points
menu Font Color lime
menu Text status 52 4 %status
menu Text donated 52 24 %donated
menu Text points 52 44 %points
return

sub menu_refresh2
menu delete euolabel5
menu Font Color lime
menu Text EUOLabel5 44 212 %status
return

Title: Re: Gen's Library Donations
Post by: ErwinEUO on August 11, 2016, 01:37:47 PM
Hi,

Thanks for posting the updated script, it's running very well for me on OSI.  I did comment out this line (line 141) for performance tuning purposes.

;gosub recall2bank

Thanks!

Erwin
Title: Re: Gen's Library Donations
Post by: cybercasper on August 11, 2016, 02:14:41 PM
your welcome glad that i could actually help someone out :)
Title: Re: Gen's Library Donations
Post by: cherrios on June 20, 2018, 09:05:29 AM
Haven't run this script in many years, but i tried it today and when it went back to library to drop of spellbooks it would not change page to get to the spellbook. Im on OSI ty
Title: Re: Gen's Library Donations
Post by: Crisis on June 20, 2018, 01:54:42 PM
Haven't run this script in many years, but i tried it today and when it went back to library to drop of spellbooks it would not change page to get to the spellbook. Im on OSI ty

You will most likely need to change the size of the gump.
Title: Re: Gen's Library Donations
Post by: cherrios on June 21, 2018, 07:39:28 AM
Yea changing the gump is not something i know how to do but thx
Title: Re: Gen's Library Donations
Post by: cybercasper on June 21, 2018, 09:59:56 AM
i posted and update to the script not to far up
Title: Re: Gen's Library Donations
Post by: cherrios on June 22, 2018, 08:01:37 AM
It still will not donate even with your update. Script will bring up the donation box but will not change the page to click on the spell book. Script works fine up to the point of donation
Title: Re: Gen's Library Donations
Post by: Gaderian on June 24, 2018, 12:10:19 AM
I do not believe it is the gump size that changed. When Endless Journey was released, Broadsword included a token that can be purchased for RL $$ that grants points in various turn-in options (brit library, moonglow zoo, etc.). This token has taken an early place in the donation list for each NPC at the library. Most of the turn-ins have now slipped down and onto a 2nd page when accessing the NPC's menu for donations.

I have a highly modified version of this script that works since those changes were made on the server side.  I am uncertain if there is a clean version of the code where it would allow a simple copy/paste of the modifications. The original uses a series of goto statements to get around and doubles in the donation routine for anti-lag/slow-connection resiliency. In my mixture of boredom when I can't go outside and dislike for goto (in favor a cleaner sub's with a clean exit status) I revamped the major portions of the script.

The code for one of the turn in's includes samurai weapons and already has code to access the 2nd page for selecting which item to donate. That is a reasonable hint at how to handle the 2nd page turn in to modify the donation routine area.

On a side note, I had this able to run for about 22-25 hours for mace and shield glasses. Just prior to EJ it was optimized down to 16-18 hours. The extra click from the EJ change has it back up to about 26 hours to turn in the 88K axes necessary. :(
Title: Re: Gen's Library Donations
Post by: lamerucolo on October 26, 2023, 10:43:03 PM
Hello Gaderian... I think you are the only one who can help me :)
I appreciate very much your contributions here and on easyuo site...

I have been trying to make this script work for a while but unfortunately I have two problems:
1. 90% of the times, the script menu remains invisible thus making me impossible even to configure and start the script
2. The couple of times I was able to start the script menu, unfortunately it stops when it gets to donating to the LIbrary NPCs (i.e spellbooks to Abram on ATL): the script opens the donation gump but it remains stuck on first page and nothing happens...

I have changed the CONTSIZE of the sub "openstatusbar"  but is till does not work :(

sub openstatusbar
openstatusbar:
event macro 8 2
gosub WaitForSysVars CONTSIZE = 345_359 CONTNAME = status_gump
if ! #result
{
   goto openstatusbar
}
movestatus:
set #CONTPOSX 800
set #CONTPOSY 420
gosub WaitForSysVars CONTPOSX = 800 CONTPOSY = 420 5
if ! #result
{
   goto movestatus
}
wait 20



Can you help???
...I would love to test your modified script :)

Thanks so much
Federico