NC29 1 Share Posted February 25, 2018 Hey. I am new to Runescape scripting and still getting to know the API.. I am trying to check if an item slot is empty, or already contains the required item. I am unable to test at the moment so looking for some advice on the below on whether I am taking the right approach and ways to improve if ((getEquipment().isSlotEmpty(EquipmentSlot.HAT.getSlot())) || (EquipmentSlot.HAT.name() != "Iron Full Helm")) After this I will either: a. Equip item if in inventory b. Go to bank, withdraw and equip item c. Go to shop, buy item and equip Thanks!! Link to comment Share on other sites More sharing options...
dQw4w9WgXcQ 184 Share Posted February 25, 2018 equipment.contains Link to comment Share on other sites More sharing options...
Nuclear Nezz 2056 Share Posted February 25, 2018 (EquipmentSlot.HAT.name() != "Iron Full Helm")) Is not how you check that. That'll just give you the name of the enum. Also don't use == or != on objects, they're different things. Use .equals Item item = getEquipment().getInSlot(EquipmentSlot.HAT); or whatever the method is if(item == null || !item.getName().equals("Shit")){stuff} Link to comment Share on other sites More sharing options...
NC29 1 Author Share Posted February 26, 2018 Thanks Nezz (EquipmentSlot.HAT.name() != "Iron Full Helm")) Is not how you check that. That'll just give you the name of the enum. Also don't use == or != on objects, they're different things. Use .equals Item item = getEquipment().getInSlot(EquipmentSlot.HAT); or whatever the method is if(item == null || !item.getName().equals("Shit")){stuff} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.