imancity Posted May 10, 2016 Share Posted May 10, 2016 I made a simple Kebab Buying script, but how would I keep track of how many are bought? I've tried having it get the amount of the inventory but I can't seem to figure out how to keep it adding onto a number. I tried to do a KebabCount = KebabCount + 1 after the dialogue where the Kebab is bought but nope. ALSO, if you're reading this, what would be my best way of walking my player from Al Kharid to the GE so he can sell the Kebabs. Not planning on adding this yet but just wondering. Quote Link to comment Share on other sites More sharing options...
Aiban Posted May 10, 2016 Share Posted May 10, 2016 Tping with Varrock teleport and using Home tele to get back would be the best way? Quote Link to comment Share on other sites More sharing options...
imancity Posted May 10, 2016 Author Share Posted May 10, 2016 Tping with Varrock teleport and using Home tele to get back would be the best way? Sorry for that question I meant more of walking-wise. Would webWalk work or should I split it up to go to the gate then to GE. I've never scripted such long distances. 1 Quote Link to comment Share on other sites More sharing options...
Chris Posted May 10, 2016 Share Posted May 10, 2016 (edited) I made a simple Kebab Buying script, but how would I keep track of how many are bought? I've tried having it get the amount of the inventory but I can't seem to figure out how to keep it adding onto a number. I tried to do a KebabCount = KebabCount + 1 after the dialogue where the Kebab is bought but nope. ALSO, if you're reading this, what would be my best way of walking my player from Al Kharid to the GE so he can sell the Kebabs. Not planning on adding this yet but just wondering. int kebabCount; //After you get a full inventory and head to the bank. //before you open the bank kebabCount += getInventory().getAmount("name of item"); for walking grab a position near the GE WebWalkEvent toGE = new WebWalkEvent(INodeRouteFinder.createAdvanced(), new Position(0,0,0)); context.execute(toGE); hope this helps Edited May 10, 2016 by Sinatra 2 Quote Link to comment Share on other sites More sharing options...
Tom Posted May 10, 2016 Share Posted May 10, 2016 Does it say in chat when you buy a kebab? You could use the message listener in that case and just +1 everytime it pops up in chat, you could alternatively create your own inventory listener kind of thing, but its pretty unnecessary for this. 1 Quote Link to comment Share on other sites More sharing options...
imancity Posted May 11, 2016 Author Share Posted May 11, 2016 Does it say in chat when you buy a kebab? You could use the message listener in that case and just +1 everytime it pops up in chat, you could alternatively create your own inventory listener kind of thing, but its pretty unnecessary for this. It does! How would I do this message listener? Never heard of it tbh. 1 Quote Link to comment Share on other sites More sharing options...
Tom Posted May 11, 2016 Share Posted May 11, 2016 It does! How would I do this message listener? Never heard of it tbh. I'm on my at the moment so i'm not going to dig through the API But its an interface called MessageListener that you implement, and it will give you a method like public void onMessage(Message m) e.g. public class Test implements MessageListener Quote Link to comment Share on other sites More sharing options...
Rxd Posted May 11, 2016 Share Posted May 11, 2016 is tom a pornstar? Quote Link to comment Share on other sites More sharing options...
Chris Posted May 11, 2016 Share Posted May 11, 2016 is tom a pornstar? Yes It does! How would I do this message listener? Never heard of it tbh. Should implement it like this then you should have a method @Override public void onMessage(Message m) { if(m.getMessage().contains("Blah")) { kebabCounter++; } } 1 Quote Link to comment Share on other sites More sharing options...
imancity Posted May 11, 2016 Author Share Posted May 11, 2016 Yes Should implement it like this then you should have a method @Override public void onMessage(Message m) { if(m.getMessage().contains("Blah")) { kebabCounter++; } } Sweet! Thanks a ton. What exactly is the 'MetalDragonsMain'? Do I put whatever I like there or? Quote Link to comment Share on other sites More sharing options...
Chris Posted May 11, 2016 Share Posted May 11, 2016 Sweet! Thanks a ton. What exactly is the 'MetalDragonsMain'? Do I put whatever I like there or? That is the name of my Class refer to this topic http://osbot.org/forum/topic/91021-basic-java-tutorial-i-found-online-for-anyone-wanting-to-learn-basics-also-contains-link-for-more-information/ Could help you out a bunch Quote Link to comment Share on other sites More sharing options...
Tom Posted May 11, 2016 Share Posted May 11, 2016 is tom a pornstar? Yes i am apart of the industry Quote Link to comment Share on other sites More sharing options...