Jump to content
Bobrocket

Use item on entity?

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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!

 

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.

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...