ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Noobie on April 05, 2010, 08:21:54 PM

Title: Buying regs from faction vendors
Post by: Noobie on April 05, 2010, 08:21:54 PM
I wrote this to just stand in one spot and buy regs from the faction vendors. I think there are like 10 reg vendors on Legends and I have got this to cycle through each vendor and buy all the regs one line at a time. I was wondering if some of the experienced scripters could take a look at this and help me improve it some possibly speeding it up.
Basically right now it stand in one spot and buys regs. I would like to make it pull gold from the bank and maybe a menu to count what you have spent and how many of each reg it has bought. Also maybe throw in a timer that will wait while the regs respawn.

Update:5/15/2010
now pulls gold from the bank until you run the count up to make it charge stright from the bank. Also will cash any checks it finds.
added the ability to buy potion bottles
added GUI
added user set number of potion bottles
added counter for each type of reg and bottles
added a start and pause button to the GUI
Update:5/31/2010
now casts invisibility while waiting for regs to respawn
Added check boxes so that user can choose what reg to buy
Update: 12/25/2010
Fixed bug with buying potion bottles and amount to buy



Title: Re: Buying regs from faction vendors
Post by: JackCiaran on April 06, 2010, 06:59:32 PM
I dont know if I can mention using razor but use the razor buy option it will help speed things up a lot! instead of purchasing them individually put u would have to change ur script to loot them off the ground and bank em =) unless u only wanna buy like certain amount of regs at a time so it only falls in ur pack def something to check out
Title: Re: Buying regs from faction vendors
Post by: Noobie on April 06, 2010, 09:06:34 PM
Well I have messed with this some more today and this is what i have came up with now. Updated from the first post it will pull gold from bank and will buy all of each reg on the vendor I am pretty much a noobie when it comes to scripting so if some one will take a look at my code and give advice on ways to do it better it would be great.

Title: Re: Buying regs from faction vendors
Post by: Noobie on April 07, 2010, 08:12:29 AM
Has anyone ever used the #gold variable? I used it in this script to check the amount of gold in your backpack but if i droped 60k in my pack it made #gold show a negative number that i could not figure out. Has anyone ever seen this or know a better way to check the amount of gold in the backpack?


;----------check backpack for gold-------------------
sub goldck
event macro 8 2
finditem POF C_ , #BACKPACKID
if #GOLD < 10000
gosub getgold
return
Title: Re: Buying regs from faction vendors
Post by: Noobie on April 15, 2010, 06:51:12 PM
Anyone willing to criticize this thing and give me some ideas to grow my skill on? I know it is rather simple, but at this point I at my limit because of my scripting skills. I am to the point that every time i set down to play uo I end up thinking about what ever I am trying to script it. Any suggestions for me to grow on would be greatly appreciated.
Title: Re: Buying regs from faction vendors
Post by: darian on April 24, 2010, 12:37:56 PM
Hi, you might take a look at Raven's Resource Buying Script over on Easyuo, i think the currently updated version that ive been taking care of is on like page 3 of that forum. ive been keeping it updated with all the new patches of late, cause noone else does, it might give you some idea's bro.
Title: Re: Buying regs from faction vendors
Post by: luv2luvlong on April 24, 2010, 01:38:54 PM
my favorite is still Gen's auto item buyer
http://www.scriptuo.com/index.php?topic=3099.0;highlight=buyer (http://www.scriptuo.com/index.php?topic=3099.0;highlight=buyer)
Title: Re: Buying regs from faction vendors
Post by: darian on April 25, 2010, 11:30:56 PM
Yeah, ive used that one too, I like them both
Title: Re: Buying regs from faction vendors
Post by: 12TimesOver on May 10, 2010, 07:45:51 AM
Heya Noobie.

Thanks for the submission. I've been a little AFK in IRL as of late so sorry I haven't tried giving any feedback. I will give things a shot when I can get back in front of the game this week.

Just a comment here on your thread though, you should consider 1) removing your code from all of the posts in this thread other than the first one in order to maintain some version integrity and 2) instead of posting the whole script as a

Code: [Select]
Code Block
you should attach the file instead. This will make the thread a lot more easily read, the code itself easier to download, and for you to have a little more control over what code people are running for you.

Let me know if you want me to help clean the thread up for you.

X

Oh, and PS - on the #gold question, I would suggest simply searching for POF and getting the #findcnt value, a lot more reliable.

Title: Re: Buying regs from faction vendors
Post by: Noobie on May 11, 2010, 08:35:32 AM
12X Thanks for you suggestions!
 I updated the thread based on your suggestions. I would appreciate any suggestions on how to make my script run better, layout, or ideas.

Thanks
Title: Re: Buying regs from faction vendors
Post by: 12TimesOver on May 11, 2010, 09:01:32 AM
Ah me likes...much better organization!! ;)

Ok, in return I promise I'll check it out when I get in game next - I might actually play again tonight (played last night for the first time in weeks)!

X
Title: Re: Buying regs from faction vendors
Post by: Noobie on May 30, 2010, 06:49:46 PM
Added some more functionality for the user. If anyone could give this a try and provide some feed back on what i am doing i would appreciate it greatly. I am trying to learn just need some feed back on what i am doing or some ideas on what i could do better.


Thanks
Noobie
Title: Re: Buying regs from faction vendors
Post by: darian on May 31, 2010, 09:32:24 PM
hi there, i used this for awhile today on Pacific shard, all in all i think it has alot of potential. One problem i ran into was, after it bought the regs, and they dropped to my pack, then it moved them one at a time to my bank box, but fter moving them, it then moved them back to my pack. maybe have an option to choose a bag within your bank to drop the purchased regs into. That would be nice. but like i said, all in all a very good script, one that is very useful to the community i think.  ;D
Title: Re: Buying regs from faction vendors
Post by: Noobie on June 01, 2010, 05:03:40 AM
Thanks a bunch! I was wondering if anyone else would have issues with it. I appreciate the feed back and adding a bag to drop in to is simple at this point so I will see what i can do.

When you say it moved them one at a time do you mean one reg or one stack? It should move the whole stack, but if not i think i can figure that out.

Title: Re: Buying regs from faction vendors
Post by: darian on June 04, 2010, 11:11:50 AM
yes, moved a stack of regs, dropped into bank, did that for all the stacks, then moved them back to my pack. LOL!
Title: Re: Buying regs from faction vendors
Post by: Noobie on June 04, 2010, 01:14:02 PM
I have not been able to get it to do this. Can you maybe provide some more info to help me figure out what happened?

Title: Re: Buying regs from faction vendors
Post by: Noobie on June 08, 2010, 05:35:14 PM
I guess i should maybe change the name of this thing so that everyone knows that you do not have to be in factions to buy from faction vendors.
Title: Re: Buying regs from faction vendors
Post by: NObama on June 08, 2010, 08:03:03 PM
my favorite is still Gen's auto item buyer
http://www.scriptuo.com/index.php?topic=3099.0;highlight=buyer (http://www.scriptuo.com/index.php?topic=3099.0;highlight=buyer)

Gen's is so good I stopped writing my own script after a few valuable learning points.
Title: Re: Buying regs from faction vendors
Post by: Noobie on June 15, 2010, 02:37:37 AM
I think this is running pretty solid now IMO, but I am working on making it stack regs in 60k piles and turn deed them. I have it working i just need to let it run a while and watch for bugs.
Title: Re: Buying regs from faction vendors
Post by: Wilk on August 30, 2010, 12:06:49 PM
Hmm...I've tried this for the last half hour to no avail.

I'm inside the bank.
My bank box is open.
The script opens the purchase menu on each vendor.
The script does not purchase anything.
It just moves on to the next npc vendor.
Title: Re: Buying regs from faction vendors
Post by: Cerveza on August 30, 2010, 12:13:42 PM
Does it cycle through the items on the NPC Vendor?

If it's not cycling then there is a "click x y" value that doesn't line up.

Do this:

Open an NPC Vendor buy gump by hand.

Type this into EUO

contpos 0 0
halt

Then hit play. That will move the vendor's gump to position 0, 0 on your screen.

Now hover your mouse over the down slider spot.... and note the cursorX and cursorY position.

Check those numbers against what is in the script. That's where it should be clicking until it finds the appropriate item type in the vendors gump.
Title: Re: Buying regs from faction vendors
Post by: Wilk on August 30, 2010, 12:23:28 PM
There is only one item type on the vendors I am searching.

It's the bottle vendors.

It opens the buy menu, but doesn't purchase the 500 bottles listed.

Then it moves on to the next bottle vendor. Rinse and repeat.
Title: Re: Buying regs from faction vendors
Post by: Cerveza on August 30, 2010, 01:05:19 PM
Are the bottle visible in the gump when it's opened?
Title: Re: Buying regs from faction vendors
Post by: Wilk on August 30, 2010, 01:26:47 PM
Yes they are.

It just does not double click the bottles to start the transaction.
Title: Re: Buying regs from faction vendors
Post by: Cerveza on August 30, 2010, 01:53:03 PM
Ok, so go from there... what is the ID of the bottles?

Do the same thing I said earlier, but hover your mouse over the "buy up these bottles" button and note the cursor position. See if that's the same in the script.

You know you can use F7 and F8 to do the script line by line right? Just use F7 and try to find the area where it's not working correctly.
Title: Re: Buying regs from faction vendors
Post by: Noobie on December 25, 2010, 04:56:28 PM
Wilk,

I want to apologize for not responding to your problem. I have not been active in UO for several months I am on christmas break from school and I will look at this and see what I messed up and try to fix it while I am out of school.

All the Best,

Noobie
Title: Re: Buying regs from faction vendors
Post by: Noobie on December 25, 2010, 05:26:36 PM
Wilk,

You should be good to go now if you re-download the script.

All the best,

Noobie

Title: Re: Buying regs from faction vendors
Post by: Noobie on August 05, 2011, 12:11:13 PM
Can I get a Elite to take a look at this for me and give some constructive Criticism? I Would like some ideas to make it more stable and efficient as well ECT...

Thanks in advance!
Title: Re: Buying regs from faction vendors
Post by: camotbik on August 05, 2011, 04:03:42 PM
Tried your script today, it works pretty well, but it has some issues.
1: When a buying menu has, e.g. two one type regs it only buys one of them.
2; line 18; sset%buyMandrakeRoot N/A
3;
Code: [Select]
sub check_gold
  if #gold < 10000
   {
    event macro 1 1 sacar 10000
    wait 20
   }
return

instead of

Code: [Select]
sub getgold
gosub isbankopen
finditem POF C_ , %bankbox
if #findstack < 10000 && #findcnt <= 1
{
gosub findcheck
return
}
else
if #findstack < 10000
{
 while #findstack < 10000
 {
 ignoreitem #findid
 finditem POF C_ , %bankbox
 {
 if #findcnt = 0
 {
 gosub findcheck
 return
 }
 }
 }
 }
gosub gold
gosub goldck
return

sub goldck
event macro 8 2
finditem POF C_ , #BACKPACKID
if #FINDSTACK < 10000
gosub getgold
return

sub gold
finditem POF C_ , %bankbox
if #findstack < 10000
gosub findcheck
else
Exevent drag #FINDID 10000
wait 12
Exevent Dropc #BACKPACKID
wait 8
return


I'm not sure, but I think this isnt the right way to end a sub(with brackets after return)?   Few example.

Code: [Select]
;Your code was a little bit haotic, so i used ScriptUOs autoindent to organise it.
sub journal
  if #jindex > %jrnl
  {
    scanjournal %jrnl
    if Begging thy pardon in #journal
    {
      display you bank is out of gold
      halt
    }
    else
    {
      set %jrnl %jrnl + 1
    return
  }
}
;#######################################
sub findvendor
  finditem IS G
  if #FINDCNT > 0
  {
    for #FINDINDEX 1 #FINDCNT
    {
      event property #FINDID
      wait 1
      if Reagent notin #PROPERTY
      {
        ignoreitem #findid
      }
      else
      {
        set #LTARGETID #findid
      return
    }
  }
}
else
{
  event macro 15 43
  target
  event macro 23 0
  wait 200s
  event macro 15 43
  target
  event macro 23 0
  wait 200s
  event macro 15 43
  target
  event macro 23 0
  wait 200s
  goto n1
}
;#######################################
sub buybottles
  finditem IS G
  if #FINDCNT > 0
  {
    for #FINDINDEX 1 #FINDCNT
    {
      event property #FINDID
      wait 1
      if Bottle notin #PROPERTY
      {
        ignoreitem #findid
      }
      else
      {
        set #LTARGETID #findid
        return
      }
    }
  }
  else
  {
  return
}

And so on.

I made few changes so your code would look better to the eye, and wont get an overload. But it's still a haotic one.
Title: Re: Buying regs from faction vendors
Post by: Crome969 on August 05, 2011, 09:51:41 PM
stupid idea but:
Code: [Select]
sub popup
  exevent Popup #findid
  gosub GumpWait NULL normal_gump normal_gump
return
why not directly choose the entry u want?
Code: [Select]
exevent Popup #findid 3??
Title: Re: Buying regs from faction vendors
Post by: Noobie on August 06, 2011, 02:30:07 AM
That would be cool, but unless this is working (I am at work so I cant test it atm) I was under the impression it did not work because of the notes in the EUO documentation.


Quote
Synopsis
Exevent Popup {id} [entry]

Description
The Exevent Popup command opens the context menu of an item/npc given by its id.

If entry is not specified then the popup will open at screenpos 0/0. Otherwise the entry (index starting at 1) will be chosen without even displaying the popup. (The [entry] option does not currently work on OSI shards)