Purchasing items from BHH

flamin_scotsman

New member
Does anyone know how to purchase the bounty hunting outfit, as retrieve_item( [int], [item] ) appears to fail.

Here's the offending bit of code:
Code:
      if (retrieve_item( 1 - item_amount( $item[2416] ) , $item[2416] ) )
      {
        cli_execute("mirror prep.txt");
        print( "Helmet aquisition successful." );
        cli_execute("mirror");
      }
      else
      {
        cli_execute("mirror prep.txt");
        print( "Error in aquisition of helmet." );
        cli_execute("mirror");
      }
      if (retrieve_item( 1 - item_amount( $item[2418] ) , $item[2418] ) )
      {
        cli_execute("mirror prep.txt");
        print( "Pants aquisition successful." );
        cli_execute("mirror");
      }
      else
      {
        cli_execute("mirror prep.txt");
        print( "Error in aquisition of pants." );
        cli_execute("mirror");
      }

2416 and 2418 are the item ID's of the bounty-hunting helmet and pants respectively. I just end up with a false value.
 

Bale

Minion
There is no command for purchasing items with tokens. You'll need to use visit_url(). I believe the command will look like:

Code:
visit_url("bhh.php?action=buy&whichitem=[COLOR="#ff0000"]2416[/COLOR]&pwd&howmany=1");

Obviously you need to replace 2416 with the item number for whichever you want to purchase. That will trade an appropriate amount of lucre for the item number you specify. Check available_amount() to see if you have the item and if you have enough lucre before attempting to purchase it.

Incidentally, rather than use 2416, I'd usually use to_int($item[bounty-hunting helmet]) because it makes the code more readable.

Code:
visit_url("bhh.php?action=buy&whichitem=[COLOR="#ff0000"]" + to_int($item[bounty-hunting helmet]) + "[/COLOR]&pwd&howmany=1");
 
Last edited:
Top