Jump to content

Use item on entity?


Recommended Posts

Posted (edited)

Interact with item 'use'

Check if item is selected

See if ent is not null & visible

Interact with ent

biggrin.png API is ur friend for the code tongue.png

 

Thanks dude, but the API isn't very useful to me..

Anyway, so now I am trying to simulate a "press enter" in the Make-X section. I currently have this:

sleep(125 + rand.getRandom(99));
getKeyboard().typeKey(Character.forDigit(rand.getRandom(3, 9), 10));
sleep(11 + rand.getRandom(200, 482));
				
getKeyboard().typeKey(Character.forDigit(rand.getRandom(0, 9), 10));
sleep(14 + rand.getRandom(50, 122));
				
getKeyboard().typeKey((char)13);

Character 13 is your standard carriage return, and is used a lot for detection with JS normally.

Is RS checking for a standard CLRF? (\r\n - 13 10) or just 13 or just 10?

 

EDIT: Sorted this myself. OSRS expects the standard CLRF, which is character 13 followed by character 10. (Do not put a delay between these as when you press enter, your keyboard sends both characters simultaneously)

getKeyboard().typeKey((char)13);
getKeyboard().typeKey((char)10);
Edited by Bobrocket
Posted (edited)

Thanks dude, but the API isn't very useful to me..

Anyway, so now I am trying to simulate a "press enter" in the Make-X section. I currently have this:

sleep(125 + rand.getRandom(99));
getKeyboard().typeKey(Character.forDigit(rand.getRandom(3, 9), 10));
sleep(11 + rand.getRandom(200, 482));
				
getKeyboard().typeKey(Character.forDigit(rand.getRandom(0, 9), 10));
sleep(14 + rand.getRandom(50, 122));
				
getKeyboard().typeKey((char)13);

Character 13 is your standard carriage return, and is used a lot for detection with JS normally.

Is RS checking for a standard CLRF? (\r\n - 13 10) or just 13 or just 10?

 

API Is very useful when you understand it tongue.png

 

For the typing and pressing enter use this

 

keyboard.typeString(String.valueOf(random(50,100)), true);

 

Or something similar, the true means press enter after the string has been typed i believe

Edited by Fruity
Posted

API Is very useful when you understand it tongue.png

 

For the typing and pressing enter use this

 

keyboard.typeString(String.valueOf(random(50,100)), true);

 

Or something similar, the true means press enter after the strign has been typed i believe

 

I see. I wanted to type each character individually as then it feels more like a human click. I seem to be reinventing the wheel every time :p

Thank you though. My script seems to be working well so far so all is good.

 

Is there a way to find out when my character has crafted a gold item? Usually you would use Onmessage (right?) but there is no message when you create a gold item.

Posted

I see. I wanted to type each character individually as then it feels more like a human click. I seem to be reinventing the wheel every time tongue.png

Thank you though. My script seems to be working well so far so all is good.

 

Is there a way to find out when my character has crafted a gold item? Usually you would use Onmessage (right?) but there is no message when you create a gold item.

 

Maybe on animation? is there an animation that the player does when it crafts the gold item?

Posted

Alright, so I really cannot figure this out.

When smithing an item, the animation ID is 899.

So it will smith the item, go back to no animation, and then smith another. How would I detect this and add another item to my counter?

 

 

If there is a chat message, you can listen for that.

if there is XP gain, you can calculate it from that.

 

Posted

If there is a chat message, you can listen for that.

if there is XP gain, you can calculate it from that.

 

 

 I ended up just making a Thread and checking the animation from that (and then doing a conditonalsleep until the animation was finished). Not the best, but it works.

 

Thanks everyone!

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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