Fran 99 Posted February 25, 2015 Hey guys, hope you're doing good, Can someone please provide me an example of using an inventory item on another inventory item? Thanks in advance!
SpareGold 4 Posted February 26, 2015 log("Burning"); Item logs = getInventory().getItem("Logs"); Item tinderbox = getInventory().getItem("Tinderbox"); if(//Stuff isnt null) { tinderbox.useOn(2); logs.useOn(2); } This is what I did to light a fire. i couldn't find any other working solutions, this basically just selects the first item and then selects the second, thus lighting the fire.
Pandemic 2846 Posted February 26, 2015 Does this not work? getInventory().getItem("Logs").useOn("Tinderbox");
Vlad 216 Posted February 26, 2015 Does this not work? getInventory().getItem("Logs").useOn("Tinderbox"); Nope. It seems like getSelectedItem() is broken. It seems to always be an empty String, "".
Pandemic 2846 Posted February 26, 2015 Nope. It seems like getSelectedItem() is broken. It seems to always be an empty String, "". Sounds like a hook issue, I'll fix right now
Fran 99 Author Posted February 26, 2015 Does this not work? getInventory().getItem("Logs").useOn("Tinderbox"); Hi Pandemic! That doesn't work :S Edit resolved: Item tinderbox = getInventory().getItem("Tinderbox"); Item logs = getInventory().getItem("Logs"); getDialogues().clickContinue(); if(tinderbox != null && logs != null){ getInventory().interactWithItem("Tinderbox", "Use"); getInventory().interactWithItem("Logs", "Use"); log("Burning logs"); MethodProvider.sleepUntil(new Condition() { @Override public boolean verify() { return getInventory().getItem("Tinderbox").useOn("Logs"); } }, 10000); }
Vlad 216 Posted February 26, 2015 Sounds like a hook issue, I'll fix right now Seems like it wasn't. My bad. Not sure why it didn't work that time. getInventory().getItem("Logs").useOn("Tinderbox"); still doesn't work though. I made some work around code for that though for anyone needing it: if (getItemContainer().getInventory().contains("Feather", "Newcomer map")) { String select = getItemContainer().getInventory() .getSelectedItemName(); if (select != null && select.contains("Feather")) { getInventory().interactWithItem("Newcomer map", "Use"); } else { getInventory().interactWithItem("Feather", "Use"); } }
Pandemic 2846 Posted February 26, 2015 Seems like it wasn't. My bad. Not sure why it didn't work that time. getInventory().getItem("Logs").useOn("Tinderbox"); still doesn't work though. I made some work around code for that though for anyone needing it: if (getItemContainer().getInventory().contains("Feather", "Newcomer map")) { String select = getItemContainer().getInventory() .getSelectedItemName(); if (select != null && select.contains("Feather")) { getInventory().interactWithItem("Newcomer map", "Use"); } else { getInventory().interactWithItem("Feather", "Use"); } } Wasn't a hook issue, was a noto issue It'll be fixed in the next version (tonight possibly).
Recommended Posts
Archived
This topic is now archived and is closed to further replies.