Jump to content

How do I make a loot counter?


imancity

Recommended Posts

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.

Link to comment
Share on other sites

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 by Sinatra
  • Like 2
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...