guys made of bee pollen script

asturia

Minion
I have changed my twinkly wad script with the following, but I'm not sure if it will work or not.
Can someone verify if I didn't make a mistake?

Code:
                    	int tobuy = 0;
        	int pollenused = 0;
        	int countpollen = 0;
            if( item_amount( $item[guy made of bee pollen]) > 0)
            {
            	while( item_amount( $item[guy made of bee pollen]) > 0 && counterpollen < 5)
	            {
					use (1, $item[guy made of bee pollen]);
            		int pollenused = pollenused + 3;
					countpollen = countpollen + 1;
	            }
			}
			tobuy = 15 - item_amount( $item[twinkly wad])- pollenused;
			pollenused = 15 - pollenused;
        	if( tobuy > 0)
      		{
        		buy (tobuy, $item[twinkly wad]);
            	use (pollenused, $item[twinkly wad]);
        	}
        	else
        	{
        		use (pollenused, $item[twinkly wad]);
        	}
 

Veracity

Developer
Staff member
I studied your code and it seems to be doing the equivalent of this:

Code:
    // How many guys to use from inventory at 3 spleen each
    int guys = item_amount( $item[ guy made of bee pollen ] );

    // How many wads to use from inventory or the mall at 1 spleen each
    int wads = 15;

    // Use up to five guys
    if ( guys > 0 )
    {
        if ( guys > 5 )
            guys = 5;
        use( guys, $item[ guy made of bee pollen ] );
        wads = wads - ( guys * 3 );
    }

    // Use up to fifteen wads
    if ( wads > 0 )
    {
        int have = item_amount( $item[ twinkly wad ] );
        if ( wads > have )
            buy( wads - have, $item[ twinkly wad ] );
        use( wads, $item[ twinkly wad ] );
    }

Except you are using one pollen at a time in the loop and are (potentially) "using" 0 twinkly wads if you've used 5 guys. You are also assuming you have 15 spleen available. Perhaps that is always true when you run this script, but if you have Spleen of Steel and/or have used other spleen items (medicinal herbs, for example), it won't be true.
 

asturia

Minion
I never go for liver of steel and never use any other spleen item.
So my script would work fine.

Thanks for your suggestion, I will try yours and see if that works better then mine.
 
Top