Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

takeitem4

By: ace on Aug 18th, 2010  |  syntax: None  |  size: 0.94 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public String takeItem(String itemName)
  2.         {
  3.          Item item = currentRoom.itemCheck(itemName);
  4.            
  5.             if(currentRoom.roomContents() == false)
  6.             {
  7.                 return "there is nothing here.";
  8.             }
  9.            
  10.             if(currentRoom.roomContents() == true)
  11.          {  
  12.             if(item.getItemWeight() > strength)
  13.              {
  14.                  return "" + itemName + " is too heavy";
  15.                 }  
  16.              
  17.              if(item.getItemWeight() <= strength - encumberance)
  18.              {
  19.              items.add(item);
  20.              encumberance = encumberance + item.getItemWeight();
  21.              return "you have taken " + itemName;
  22.             }
  23.              
  24.                 else
  25.                 {
  26.                     return "You are carrying too much to take " + item.getItemName();
  27.                 }
  28.             }
  29.                 return null;
  30.                 }