lovelypker Posted August 3, 2014 Share Posted August 3, 2014 Hey guys I'm working on my first script and I'd like to use an inventory item on an RS object. I couldn't find anything in the API on how to do this so I figured all I needed to do was select the item in the inventory and then click on the RS object to use them together. In order to do this I am using mouse#move but can't figure out how to get the central point (or any point for that matter) of the entity. I know this is a very basic question but it's my first go so any help would be appreciated! Link to comment Share on other sites More sharing options...
Dreamliner Posted August 3, 2014 Share Posted August 3, 2014 Hey guys I'm working on my first script and I'd like to use an inventory item on an RS object. I couldn't find anything in the API on how to do this so I figured all I needed to do was select the item in the inventory and then click on the RS object to use them together. In order to do this I am using mouse#move but can't figure out how to get the central point (or any point for that matter) of the entity. I know this is a very basic question but it's my first go so any help would be appreciated! It's not perfect, but you can get center x and y in the Rectangle class included in Java. Link to comment Share on other sites More sharing options...
lovelypker Posted August 3, 2014 Author Share Posted August 3, 2014 It's not perfect, but you can get center x and y in the Rectangle class included in Java. I've tried this however the center x and y are doubles and when I try to convert them into integers I get an error that double cannot be dereferenced. Link to comment Share on other sites More sharing options...
Swizzbeat Posted August 3, 2014 Share Posted August 3, 2014 I've tried this however the center x and y are doubles and when I try to convert them into integers I get an error that double cannot be dereferenced. wut (int) doubleVar #casting 2 Link to comment Share on other sites More sharing options...
lovelypker Posted August 3, 2014 Author Share Posted August 3, 2014 Select inventory item if inventory item selected interact use with rs2object see leaked nudes of kate upton acquire virus that downloads child porn from russia get raided by fbi/nsa/cia/fyg have hard life in prison escape #profit I tried that but it wouldn't use the item with object. After i had selected the item my code was bankbox.interact("Use Bones ->"); but that did nothing wut (int) doubleVar #casting I tried casting but that's when I got the error that double cannot be dereferenced. Maybe I made a mistake. Link to comment Share on other sites More sharing options...
FrostBug Posted August 3, 2014 Share Posted August 3, 2014 You can get a MouseDestination for it. Create an EntityDestination (subclass of MouseDestination) like this: EntityDestination dest = new EntityDestination(bot, object); and then click the mouse at that destination getMouse().click(dest); Link to comment Share on other sites More sharing options...
Extreme Scripts Posted August 3, 2014 Share Posted August 3, 2014 Well judging from the original question I'm just going to go ahead and answer this for you without reading the off-topic stuff, for your first script you should start with the basics and not worry about getting the central points: RS2Object fire = objects.closest("Fire"); if(!inventory.isItemSelected){ inventory.interact(COMMAND_HERE,ITEM_ID/NAME HERE); } sleep(gRandom(50,250)); fire.interact("Use"); That's the most simplest way to do it, yes yes not the best but for the purpose of the question it does the trick. All this would do is interact with the inventory item if none is selected and then interact withe RS2Object. Hope you find that useful Link to comment Share on other sites More sharing options...
lovelypker Posted August 4, 2014 Author Share Posted August 4, 2014 Well judging from the original question I'm just going to go ahead and answer this for you without reading the off-topic stuff, for your first script you should start with the basics and not worry about getting the central points: RS2Object fire = objects.closest("Fire"); if(!inventory.isItemSelected){ inventory.interact(COMMAND_HERE,ITEM_ID/NAME HERE); } sleep(gRandom(50,250)); fire.interact("Use"); That's the most simplest way to do it, yes yes not the best but for the purpose of the question it does the trick. All this would do is interact with the inventory item if none is selected and then interact withe RS2Object. Hope you find that useful You can get a MouseDestination for it. Create an EntityDestination (subclass of MouseDestination) like this: EntityDestination dest = new EntityDestination(bot, object); and then click the mouse at that destination getMouse().click(dest); I'd like to thank you both for your help! Ended up figuring out what I was doing wrong with casting so I got it to find the central point but these are nice methods to know as well Link to comment Share on other sites More sharing options...