lobbyplox 0 Posted July 17, 2017 Hi everyone, I have a quick question regarding a scripting function. I'm having trouble finding the function to select an item in your inventory? Could anyone help me out here? Thanks
Pyth 128 Posted July 17, 2017 getInventory().get("ItemName") or getInventory().get("ItemName").interact("Use");
Nex 2546 Posted July 17, 2017 getInventory().get("ItemName") or getInventory().get("ItemName").interact("Use"); to add onto this there is also a useOn option: getInventory().get("Item").useOn("Item2");
lobbyplox 0 Author Posted July 25, 2017 Another question, related to this one: Is it a similiar command to interact with an NPC? I'm using NPC = getNpcs().closest(f-> f.getName().contains("npc name"));NPC.interact("Use"); but am having trouble, could it be because they are out of vision? and if so How could I move nearby the NPC.
RetroBot 35 Posted July 25, 2017 Another question, related to this one: Is it a similiar command to interact with an NPC? I'm using NPC = getNpcs().closest(f-> f.getName().contains("npc name")); NPC.interact("Use"); but am having trouble, could it be because they are out of vision? and if so How could I move nearby the NPC. You need to null check the npc and check if the npc is on screen. If the npc is not on your screen you can grab the distance of the npc to determine whether you should turn your camera or walk to the NPC. To use an item on an npc you can use getInventory().get("Item").useOn(npc);. I suggest you learn some java (if you havn't already) and look at some open source scripts to get a better understanding on how to use the API, and how to form the logic of your script.
lobbyplox 0 Author Posted July 25, 2017 You need to null check the npc and check if the npc is on screen. If the npc is not on your screen you can grab the distance of the npc to determine whether you should turn your camera or walk to the NPC. To use an item on an npc you can use getInventory().get("Item").useOn(npc);. I suggest you learn some java (if you havn't already) and look at some open source scripts to get a better understanding on how to use the API, and how to form the logic of your script. Thanks. Yeah I've done a handful of C and C++ before, so I've ran into a little learning curve here. I appreciate your advice!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.