/**
  * Uses an item on a game object.
  *
  * @param item the item to use
  * @param target the game object to be used on by the item
  * @return <tt>true</tt> if the "Use" action had been used on both the inventory item and the game
  *     object; otherwise <tt>false</tt>
  */
 public static boolean useItem(Item item, GameObject target) {
   if (item != null && target != null) {
     for (int i = 0, r = Random.nextInt(5, 8); i < r; i++) {
       if (!isItemSelected()) {
         if (item.interact("Use")) {
           for (int j = 0; j < 10 && !isItemSelected(); j++) {
             Task.sleep(100, 200);
           }
         } else {
           return false;
         }
       }
       // just make sure in case something bad happened
       if (isItemSelected()) {
         final String itemName = item.getName();
         final ObjectDefinition targetDef = target.getDef();
         final Model targetModel = target.getModel();
         if (targetDef != null && itemName != null && targetModel != null) {
           final String targetName = targetDef.getName();
           Mouse.move(targetModel.getNextPoint());
           final String action =
               "Use "
                   + itemName.replace("<col=ff9040>", "")
                   + " -> "
                   + targetName.replace("<col=ff9040>", "");
           for (int j = 0, s = Random.nextInt(5, 8); j < s; j++) {
             if (Menu.contains(action) && Menu.click(action)) {
               return true;
             } else {
               Mouse.move(targetModel.getNextPoint());
             }
           }
         }
         // kay, since that failed, let's try just use
         if (target.interact("Use")) {
           return true;
         }
       }
     }
   }
   return false;
 }