Advertisement
Guest User

something

a guest
Dec 10th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.91 KB | None | 0 0
  1.  
  2. //  .Get the closest GameObject with the action "Jump-over". If the object exists, print out its name and location as Objectname:[1000,1000,0] (all on the same line). If it is not around, print out "No object found".
  3. //  Interact with the object, print "I jumped over!" if the interaction was successful.
  4. //  Print "I'm bad at jumping :(" if the interaction failed.
  5.    
  6.     public void jumpOverObject() {
  7.     GameObject ourObject = getGameObjects().closest(g -> g != null && g.hasAction("Jump-over"));
  8.     if (ourObject != null && ourObject.exists()) {
  9.         log(ourObject.getName() + ": " + ourObject.getTile());
  10.         if (ourObject.interact()) {
  11.             log("I jumped over!");
  12.         } else {
  13.             log("I'm bad at jumping :(");
  14.         }
  15.     } else {
  16.         log("No object found");
  17.     }
  18. }
  19.    
  20.    
  21.    
  22. //  Create a method that prints out your current equipment in the following format:
  23. //      AMULET: itemName
  24. //      ARROWS: itemName
  25. //      CAPE: itemName
  26. //      etc..
  27. //      Lastly: Print out the item with the longest name out of the list.
  28.     private void ourEquipment() {
  29.         String neck;
  30.         String arrows;
  31.         String cape;
  32.        
  33.         // I CANT REMEMBER THE NUMBER ASSOSIATED WITH EACH SLOT
  34.         neck = getEquipment().getNameForSlot(1);
  35.         arrows = getEquipment().getNameForSlot(2);
  36.         cape = getEquipment().getNameForSlot(3);
  37.         log("Amulet: " + neck + " Arrows: " + arrows + " Cape " + cape);
  38.         // Maybe something like this.. repeat for each item
  39.         if (neck.length() > arrows.length() && neck.length() > cape.length()) {
  40.             log("Neck is longest String");
  41.         }
  42.        
  43.     }
  44.    
  45.    
  46.    
  47.    
  48.    
  49. //  3. Create a method getClosestNPC(int x), which returns the Xth closest NPC with name "Artis dealer".
  50. //  Example: getClosestNPC(2) would return the second-closest NPC with that name.
  51. //  If the passed parameter has value 0, return null as there is no such thing as a 0th closest NPC.
  52. //  If there are less NPCS around than the given parameter (for example: 3rd closest, but there are only two npcs): return the closest npc.
  53.    
  54.     private void getClosestNPC() {
  55.         NPC npc = getNpcs().closest(g -> g != null && g.getName().equals("Artis dealer"));
  56.         if (npc != null) {
  57.             log("Found nearest NPC");
  58.         }
  59.     }
  60.    
  61.    
  62.    
  63. //  4. Create a method that prints out what type of runes you need for the spell "Telekinetic Grab". On the next line,
  64. //  print if the player can cast this spell, and if not, print out what type and how many runes the player is missing.
  65.     private void spellReqs() {
  66.         if (getMagic().canCast(Normal.TELEKINETIC_GRAB)) {
  67.             log("We can cast this spell!");
  68.         } else {
  69.             log("We can't cast this spell");
  70.         }
  71.        
  72.     }
  73.    
  74.    
  75. //  5. Create a small snippet that empties out your bank. Make it withdraw all items: If the item being withdrawn
  76. //  has a noted form, withdraw it noted. If the item is stacked, withdraw it in its normal form.
  77. //  If your inventory is full, close the bank and drop all items in your inventory.
  78. //  Your method should return true after everything mentioned is done.
  79.     private void banking() {
  80.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement