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

Thread: Pop Up Gold and Number Animation

  1. #1
    Basic Member
    Join Date
    May 2014
    Posts
    270

    Pop Up Gold and Number Animation

    During my testing on my bot script in the lobby a got a pop up gold and number every time the bot stands or walks near all shops. And I have that console text spam. Is it because there is something wrong with my script?
    20170203180107_1.jpg20170203180136_1.jpg

  2. #2
    Basic Member
    Join Date
    Jan 2017
    Posts
    25
    I think you will see those messages if your script function takes too long to execute? Just my guess. I also see these messages every now and then.

  3. #3
    Basic Member
    Join Date
    May 2014
    Posts
    270
    Yes I knew it, but how about the pop up numbers and golds animation though? The bot didn't sell anything during that situation but there is gold animation like when you selling an item.
    Last edited by arz_on4dt; 02-03-2017 at 04:54 AM.

  4. #4
    Basic Member
    Join Date
    Feb 2015
    Posts
    15
    The pop up gold looks like your bot keep buying and selling tps, just my guess though. Are you absolutely sure your bot didn't sell anything when in base ?

  5. #5
    Basic Member
    Join Date
    May 2014
    Posts
    270
    Maybe It's always happen in > 30 minutes mark. I've done the check to sell and purchase tps in the code bellow.
    Purchase TP
    Code:
    function PurchaseTP()
    	if GetNumCouriers() == 0 then
    		return 
    	end
    	local npcCourier = GetCourier(0);
    	local npcBot = GetBot();
    	if( not IsInvFull(npcBot) and 
    		not HasItem(npcBot, "item_tpscroll") and 
    		not HasItem(npcCourier, "item_tpscroll") and 
    		not HasItem( npcBot, "item_travel_boots") and
    		npcBot:GetGold() >= GetItemCost( "item_tpscroll" ) and 
    		DotaTime() > 60 ) 
    	then
    				npcBot:Action_PurchaseItem("item_tpscroll");
    	end
    end
    Check if Bots have certain item
    Code:
    function HasItem( hUnit, sItem )
    	if hUnit:FindItemSlot( sItem ) >= 0 then
    		return true
    	end
    	return false
    end
    and this one to sell early item including tp
    Code:
    function SellEarlyGameItem()
        local earlyGameItem = {
    		 "item_magic_wand",
    	 	 "item_ring_of_aquila", 
    		 "item_urn_of_shadows", 
    		 "item_clarity", 
    		 "item_flask", 
    		 "item_quelling_blade", 
    		 --"item_stout_shield", 
    		 "item_poor_mans_shield",
    		 "item_tango", 
    		 "item_soul_ring", 
    		 "item_bottle", 
    		 --"item_ward_observer",
    		 "item_tpscroll"
    	}
    	local npcBot = GetBot();
    	if ( npcBot:DistanceFromFountain() <= 100 or npcBot:DistanceFromSecretShop() <= 100 ) and DotaTime() > 30*60  then
    		for _,item in pairs(earlyGameItem)
    		do
    			local itemSlot = npcBot:FindItemSlot(item);
    			if itemSlot >= 0 then
    				if item == "item_stout_shield" and not HasCGorABBuild()  then
    					npcBot:Action_SellItem(npcBot:GetItemInSlot(itemSlot));
    				elseif 	item == "item_tpscroll" and  HasItem(npcBot, "item_travel_boots") then
    					print('sell tp')
    					npcBot:Action_SellItem(npcBot:GetItemInSlot(itemSlot));
    				else
    					npcBot:Action_SellItem(npcBot:GetItemInSlot(itemSlot));
    				end
    			end
    		end		
    	end
    end
    Is there any error logic on that? Even though my bots has tp in his inventory/backpack, that pop up gold is still exist.
    Last edited by arz_on4dt; 02-03-2017 at 07:15 AM.

  6. #6
    Basic Member
    Join Date
    Dec 2016
    Posts
    733
    one minor thing "item_travel_boots" is not a thing. There is "item_travel_boots_1" and "item_travel_boots_2".

  7. #7
    Basic Member
    Join Date
    Feb 2015
    Posts
    15
    Can you use this code in SellEarlyGameItem function and check again ?
    Code:
    if itemSlot >= 0 then
    	if item == "item_stout_shield" and not HasCGorABBuild()  then
    		npcBot:Action_SellItem(npcBot:GetItemInSlot(itemSlot));
    	elseif 	item == "item_tpscroll" and  HasItem(npcBot, "item_travel_boots_1") then
    		print('sell tp')
    		npcBot:Action_SellItem(npcBot:GetItemInSlot(itemSlot));
    	elseif item ~= "item_tpscroll" then
    		npcBot:Action_SellItem(npcBot:GetItemInSlot(itemSlot));
    	end
    end
    Last edited by antigame; 02-03-2017 at 07:27 AM.

  8. #8
    Basic Member
    Join Date
    May 2014
    Posts
    270
    Quote Originally Posted by nostrademous View Post
    one minor thing "item_travel_boots" is not a thing. There is "item_travel_boots_1" and "item_travel_boots_2".
    But I've tried this
    Code:
    if HasItem( npcBot, "item_travel_boots_1") then
    	print("have BOT")
    else
    	print("no BOT")
    end
    Even though I give the bots level 1 BoT it's still printing "no BOT", but when I changed it to "item_travel_boots" it prints haveBOT. And when I give the bot level 2 BoT and I changed item name to "item_travel_boots_2" it prints "have BOT". I can't give level 1 BoT to bot with this command "-givebots item_travel_boots_1", but I can when I use "-givebots item_travel_boots". It's always working for "-givebots item_travel_boots_2" though.

    Edit : Wait, if I do it in local lobby with this command "-givebots item_travel_boots", it gives bot BoT but it still prints "No BOT". Alright, maybe that was the problem. I'll try to change it and see if it works.

    Edit 2 : It still persist. Even though I have bot that has tp in its inventory. The gold increased is still normal ( No sudden -50 or +50 )

    Edit 3 : Yep, it's the buy sell tp that gone too fast. There is a logic error in my code. After I changed it to this. It never shows up again.

    Code:
    local npcBot = GetBot();
    	if ( npcBot:DistanceFromFountain() <= 100 or npcBot:DistanceFromSecretShop() <= 100 ) and DotaTime() > 30*60  then
    		for _,item in pairs(earlyGameItem)
    		do
    			local itemSlot = npcBot:FindItemSlot(item);
    			if itemSlot >= 0 then
    				if item == "item_stout_shield"  then
    					if not HasCGorABBuild() then
    						npcBot:Action_SellItem(npcBot:GetItemInSlot(itemSlot));
    					end
    				elseif item == "item_tpscroll" then
    					if HasItem(npcBot, "item_travel_boots_1") then
    						print(npcBot:GetUnitName()..'sell tp')
    						npcBot:Action_SellItem(npcBot:GetItemInSlot(itemSlot));
    					end
    				else
    					npcBot:Action_SellItem(npcBot:GetItemInSlot(itemSlot));
    				end
    			end
    		end		
    	end
    Last edited by arz_on4dt; 02-03-2017 at 08:24 AM.

  9. #9
    Basic Member
    Join Date
    Feb 2015
    Posts
    15
    Yeah, I thought so also try to optimize your ItemPurchaseThink function if you can because it's a bad sign when those messages appear too many times (once in a while is okay though).

  10. #10
    Basic Member
    Join Date
    Jun 2013
    Posts
    275
    It's odd to me if 2 milliseconds is considered taking too long. Some of my larger functions can take up to 30ms depending on some situations and conditions and I don't get this kind of spam.

Posting Permissions

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