Author Topic: TrailMyx's Buy Agent Subs  (Read 30891 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
TrailMyx's Buy Agent Subs
« on: February 06, 2009, 07:22:32 AM »
+1
Code: [Select]
;=================================================================
; Script Name: TrailMyx's Buy Agent Subs
; Author: TrailMyx
; Version: 1.0
; Shard OSI / FS: OSI / FS OK
; Revision Date: 9/29/2007
; Purpose: Automates the process of buying items from NPCs
;
;  TM_BuyAgent_ID = If you know the #FINETYPE of the items you want to purchase
;  TM_BuyAgent_Name = If you want to purchase an item by name
;  #RETURNS #TRUE (-1) if error occurs
;           number of items purchased (no error)
;
; http://www.scriptuo.com
;
; Example:
; set %npc_id XXYYZZ1
; gosub TM_BuyAgent_ID %npc_id OIK 5 ; 5 wooden shields
; gosub TM_BuyAgent_ID %npc_id BSF 10 ; 10 battleaxe
; gosub TM_BuyAgent_Name %npc_id battle_axe 2 ; 10 battleaxe
; gosub TM_BuyAgent_Name %npc_id mandrake_root 100 ; 100  mandrake root
;=================================================================

Just some quick subs I put together to buy items from npc vendors.  Useful to see how the getshopinfo and setshopinfo routines work.

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
tm_buyagent1.txt
« Last Edit: February 06, 2009, 07:24:23 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: TrailMyx's Buy Agent Subs
« Reply #1 on: February 06, 2009, 09:46:29 AM »
+1
Coolness. Going to try these out in my donator, I mean damn why not, half of it is made up from your subs already LOL!

XII

Edit -

BTW, I've been meaning to ask this and it's kind of related to your sub but let me know if I should start a new thread. One of the turnin items available for all NPC's is books. From what I can tell not all purchasable books are the same and not all books are accepted by the NPC's. It also seems as if some NPC's accept more than one type. However, from what I can tell, all of the book types seem to have the same #FINDTYPE value. I haven't gone further with my research yet, I've just been totally overwhelmed lol, but I'm curious how else to handle this. Is it possible to buy an item of type X based on meeting some other type of property?

« Last Edit: February 06, 2009, 10:08:48 AM by 12TimesOver »
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's Buy Agent Subs
« Reply #2 on: February 06, 2009, 10:22:02 AM »
+1
I was under the impression that if a book was a different shape or used a different graphic, then the book should have a different FINDTYPE.  Books hued differently might be different.  I can't tell you with 100% certainty, but I would think they would act like other items in UO.  dunno.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's Buy Agent Subs
« Reply #3 on: February 06, 2009, 10:59:19 AM »
+1
Also, there are easier ways to do this buy thing.  With either UOA or Razor, it's pretty much automatic.  However I don't like relying on an external program.  The way EasyUO does it is slow, but honestly it's nearly the same as one would do it at the keyboard.

I just wish you could sell as well.  ;)
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Cerveza

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +403
  • Referrals: 11
    • View Profile
Re: TrailMyx's Buy Agent Subs
« Reply #4 on: February 06, 2009, 11:14:49 AM »
+1
Hmmm.... TM's buy agent and UOA's sell agent.... sounds like a script that's dying to be made  :-X
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: TrailMyx's Buy Agent Subs
« Reply #5 on: February 06, 2009, 11:48:05 AM »
+1
Yeah the sell piece is extremely frustrating since it relies on clicks and gump coordinates. I haven't figured out a better way than to make sure there is nothing in the pack that is sellable other than the one item I'm trying to sell otherwise I don't know how to tell the script what gump coordinates to use.  At least if there is only one itemtype that a given vendor will buy I can assume it will be the top line of the sell gump.

I'll have to double-check your point about the item types, I swear I checked that and that was why I was stumped as to how to differentiate between the books but I may have been very tired and screwed up. I went to a Provisioner, bought each kind of book, and checked the ITEMTYPE value - I either screwed up or they all had the same value. Of course not all three books were donatable which leads me to believe I did screw up. Guess I'll have to go check again.

XII

Edit -
Just wanted to confirm that yes, I screwed up before. Not sure what I did but I'll bet lunch I had two clients running and was looking at the #LLIFTEDTYPE of the wrong client hehe. Blue book = AZF, Red Book = XYF, Brown Book (with a story in it) = NYF.

That's good news for me then :P
« Last Edit: February 06, 2009, 12:07:56 PM by 12TimesOver »
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: TrailMyx's Buy Agent Subs
« Reply #6 on: December 31, 2009, 10:29:41 AM »
+1
working with these subs here...
I came across this I think maybe something is up here.
if an item isn't on the vendor I get to the bottom of the list, and it just loops forever.
I think this might be the problem.

      event property #SHOPITEMID
      if !item_name notin #PROPERTY
      {
        set !temp #SHOPCURPOS
        click !clickx !clicky dmc
        repeat
          getshopinfo
        until #SHOPCURPOS <> !temp

maybe it should be...

until #SHOPCURPOS <> !temp || #SHOPCURPOS = #ShopCnt
« Last Edit: December 31, 2009, 10:34:03 AM by Khameleon »

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's Buy Agent Subs
« Reply #7 on: December 31, 2009, 01:10:23 PM »
+1
Ah, that's a good idea.  I never thought about an item that isn't in the list.  +1 karma!
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: TrailMyx's Buy Agent Subs
« Reply #8 on: December 31, 2009, 01:34:49 PM »
+1
atm it doesn't return #True....

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: TrailMyx's Buy Agent Subs
« Reply #9 on: January 01, 2010, 01:12:17 PM »
+1
found another little hiccup...

        wait 5
        set !clickx #CONTPOSX - 44
        set !clicky #CONTPOSY - 150
        click !clickx !clicky d dmc
        setshopitem #shopItemID !amount
        set !clickx #CONTPOSX + 44
        set !clicky #CONTPOSY + 207
        click !clickx !clicky dmc
        set #RESULT !amount
        repeat
        until #CONTNAME <> bill_gump
        break

maybe something like...
if #ShopItemMax < !Amount
Set !Amount #ShopItemMax
        setshopitem #shopItemID !amount

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's Buy Agent Subs
« Reply #10 on: January 01, 2010, 07:30:50 PM »
+1
If you get a version that's running smoother, let me know your changes and I'll update with appropriate kudos to ya!  :)  I just have no time to play with this particular snippet.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: TrailMyx's Buy Agent Subs
« Reply #11 on: January 01, 2010, 07:55:45 PM »
+1
It kinda got it working with the two mods I posted up here. only thing is I'm not sure how to force it to close the buy gump, and return a #True statement instead it returns a 0 item bought value.

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
tm_buyagent1.1.txt

Offline NObama

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: TrailMyx's Buy Agent Subs
« Reply #12 on: March 24, 2010, 05:42:15 PM »
+1
I've been trying to incorporate this into a wider script.  Unfortunately, I've just learned that it only buys one item at a time - inconvenient if you're using it to farm regs.

If I wanted this to purchase, say, 20 nightshade, how could I change it?

For the record, I'm using the correct syntax and I've var dumped to check the value of !amount...it is correct, but the script keeps dbl clicking the buy option in these lines:

      {
        wait 5
        set !clickx #CONTPOSX - 44
        set !clicky #CONTPOSY - 150
        click !clickx !clicky d dmc
        setshopitem #shopItemID !amount  <--- at this point, vardump tells me !mount is 20
        set !clickx #CONTPOSX + 44
        set !clicky #CONTPOSY + 207
        click !clickx !clicky dmc  <--- At this point, the script clicks 'buy' with only one nightshade on the contract
        set #RESULT !amount
        repeat
        until #CONTNAME <> bill_gump
        break
      }

Offline NObama

  • Everything I need to know, I learned from Miffy's Item Finder.
  • Elite
  • *
  • *
  • Posts: 3454
  • Activity:
    0%
  • Reputation Power: 43
  • NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.NObama is a force to reckon with.
  • Respect: +161
  • Referrals: 2
    • View Profile
Re: TrailMyx's Buy Agent Subs
« Reply #13 on: March 24, 2010, 05:44:01 PM »
+1
Whoops - I just read Kham's post.  I'll try his version.

 :P

EDIT:  Nope - same problem.  Help?  I really don't think the answer is 19 more clicks...or 998.

« Last Edit: March 24, 2010, 05:46:02 PM by NObama »

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's Buy Agent Subs
« Reply #14 on: March 24, 2010, 05:44:55 PM »
+1
It should by whatever number you want.  Or it did the last time I tested it.
Please read the ScriptUO site RULES
Come play RIFT with me!