Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // .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".
- // Interact with the object, print "I jumped over!" if the interaction was successful.
- // Print "I'm bad at jumping :(" if the interaction failed.
- public void jumpOverObject() {
- GameObject ourObject = getGameObjects().closest(g -> g != null && g.hasAction("Jump-over"));
- if (ourObject != null && ourObject.exists()) {
- log(ourObject.getName() + ": " + ourObject.getTile());
- if (ourObject.interact()) {
- log("I jumped over!");
- } else {
- log("I'm bad at jumping :(");
- }
- } else {
- log("No object found");
- }
- }
- // Create a method that prints out your current equipment in the following format:
- // AMULET: itemName
- // ARROWS: itemName
- // CAPE: itemName
- // etc..
- // Lastly: Print out the item with the longest name out of the list.
- private void ourEquipment() {
- String neck;
- String arrows;
- String cape;
- // I CANT REMEMBER THE NUMBER ASSOSIATED WITH EACH SLOT
- neck = getEquipment().getNameForSlot(1);
- arrows = getEquipment().getNameForSlot(2);
- cape = getEquipment().getNameForSlot(3);
- log("Amulet: " + neck + " Arrows: " + arrows + " Cape " + cape);
- // Maybe something like this.. repeat for each item
- if (neck.length() > arrows.length() && neck.length() > cape.length()) {
- log("Neck is longest String");
- }
- }
- // 3. Create a method getClosestNPC(int x), which returns the Xth closest NPC with name "Artis dealer".
- // Example: getClosestNPC(2) would return the second-closest NPC with that name.
- // If the passed parameter has value 0, return null as there is no such thing as a 0th closest NPC.
- // If there are less NPCS around than the given parameter (for example: 3rd closest, but there are only two npcs): return the closest npc.
- private void getClosestNPC() {
- NPC npc = getNpcs().closest(g -> g != null && g.getName().equals("Artis dealer"));
- if (npc != null) {
- log("Found nearest NPC");
- }
- }
- // 4. Create a method that prints out what type of runes you need for the spell "Telekinetic Grab". On the next line,
- // print if the player can cast this spell, and if not, print out what type and how many runes the player is missing.
- private void spellReqs() {
- if (getMagic().canCast(Normal.TELEKINETIC_GRAB)) {
- log("We can cast this spell!");
- } else {
- log("We can't cast this spell");
- }
- }
- // 5. Create a small snippet that empties out your bank. Make it withdraw all items: If the item being withdrawn
- // has a noted form, withdraw it noted. If the item is stacked, withdraw it in its normal form.
- // If your inventory is full, close the bank and drop all items in your inventory.
- // Your method should return true after everything mentioned is done.
- private void banking() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement