Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17

Thread: Bot pruchasing

  1. #1
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,769

    Bot pruchasing

    So I am about to add item purchasing and did a simple implementation:

    Code:
    -- [...]
    -- some code deciding I should buy the next item on the list
    
    		local result = Bot:ActionImmediate_PurchaseItem(itemName);
    		local bPurchased = (result == ItemPurchaseResults.PURCHASE_ITEM_SUCCESS);
    
    		if (bPurchased == true) then
    			table.remove(ItemList, 1);
    		else
    			DebugLog("couldn't purchase " .. itemName .. ": " .. result);
    		end
    Howver, result has a strange value after returning from ActionImmediate_PurchaseItem:
    couldn't purchase item_clarity: 0
    What is result 0?

    As far as I know, these are the enum values:
    Code:
    ItemPurchaseResults =
    {
    	PURCHASE_ITEM_SUCCESS				= -1,
    	PURCHASE_ITEM_OUT_OF_STOCK			= 82,
    	PURCHASE_ITEM_DISALLOWED_ITEM		= 78,
    	PURCHASE_ITEM_INSUFFICIENT_GOLD		= 63,
    	PURCHASE_ITEM_NOT_AT_HOME_SHOP		= 67,
    	PURCHASE_ITEM_NOT_AT_SIDE_SHOP		= 66,
    	PURCHASE_ITEM_NOT_AT_SECRET_SHOP	= 62,
    	PURCHASE_ITEM_INVALID_ITEM_NAME		= 33
    }
    Are there any other possible values Chris?
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  2. #2
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,698
    0 indicates that the unit was not controllable by the player. What unit is trying to do the purchase?

  3. #3
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,769
    Legion. She is a bot with full takeover.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  4. #4
    Basic Member
    Join Date
    Dec 2016
    Posts
    643
    Quote Originally Posted by The Nomad View Post
    Legion. She is a bot with full takeover.
    Was it an Illusion by any chance?

  5. #5
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,769
    No, she was level 1
    I am talking about start-up items, before the horn.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  6. #6
    Basic Member
    Join Date
    Dec 2016
    Posts
    643
    Quote Originally Posted by The Nomad View Post
    No, she was level 1
    I am talking about start-up items, before the horn.
    What is "Bot"? I guess, can you post more code in that function?

  7. #7
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,769
    It's the parameter assigned by GetBot(). I bought a new laptop as my old one is slightly... "affected" shall we say
    So I haven't moved stuff and don't have the sources atm.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  8. #8
    Basic Member
    Join Date
    Mar 2012
    Posts
    1,769
    Chris, can you please check ActionImmediate_PurchaseItem() ?
    Maybe it's just me but it seems it's taking a long time to execute (since I always get the ItemPurchaseThink() profiling warning without that many code instructions... believe me, I don't have anything costly in it; in fact, the only way I got it to not throw the warning is with a simple hardcoded purchase list and only the command to buy which is weird considering how much stuff you can throw in Bot:Think() without it triggering a warning unless you do unoptimized code)
    Last edited by The Nomad; 05-17-2017 at 10:51 AM.
    Explanations on the normal, high and very high brackets in replays: here, here & here
    Why maphacks won't work in D2: here

  9. #9
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,698
    I'm not seeing it do anything that looks expensive. Do you have simple examples of it being slow?

  10. #10
    Basic Member
    Join Date
    Oct 2016
    Posts
    210
    not sure about examples i could give, but i can vouch for the fact that itempurchase think takes up most of the MS warnings that i get in my scripts.
    im just running an old version (dont know if its still the same) of EXP bots purchase think, which was based on furiouspuppy's(?) - with the build folder.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •