Jump to content

[osbot or script issue?] Finally found out whats causing deaths while running my script. but how do i solve it?


dot_b0T

Recommended Posts

Been having some issues with one of my combat scripts, it died seemingly random. buy i  finally managed to be at the PC when the script was messing up.

What happened was that when the client tried shift dropping a vial, it instead normally clicked on it so basically it clicked "use" on it. and then went on to proceed with the script. it's just that it wont be able to interact with anything since all the interact options is now replaced with use vial > on. And for some reason the osbot wont notice this which results in the bot doing nothing since it cant use any interactions in either the game window or in the inventory. which means even though i have super strict priorities in the script to always eat and teleport away above anything else, it cant execute it cause it cant interact with anything cause the vial is highlighted for use and replace all the items other interactions.

So i was thinking, I'll just add a check for it; if something is highlighted. but how do i do that?

 And also is this a osbot bug i should report, cause im 99% sure the logic in my script isn't causing this. I'm sure this isn't a big problem if your script involves walking around alot since it would simply normal click in the game window and the "use" would go away. but my script is in a super crowded area and walks between 2 tiles that has mobs on them which means it pretty much allways relies on right click>walk here which it cant do when the item is highlighted.

to sum it shortly: highlighted(use) item is fucking my script.

Link to comment
Share on other sites

2 minutes ago, dot_b0T said:

Been having some issues with one of my combat scripts, it died seemingly random. buy i  finally managed to be at the PC when the script was messing up.

What happened was that when the client tried shift dropping a vial, it instead normally clicked on it so basically it clicked "use" on it. and then went on to proceed with the script. it's just that it wont be able to interact with anything since all the interact options is now replaced with use vial > on. And for some reason the osbot wont notice this which results in the bot doing nothing since it cant use any interactions in either the game window or in the inventory. which means even though i have super strict priorities in the script to always eat and teleport away above anything else, it cant execute it cause it cant interact with anything cause the vial is highlighted for use and replace all the items other interactions.

So i was thinking, I'll just add a check for it; if something is highlighted. but how do i do that?

 And also is this a osbot bug i should report, cause im 99% sure the logic in my script isn't causing this. I'm sure this isn't a big problem if your script involves walking around alot since it would simply normal click in the game window and the "use" would go away. but my script is in a super crowded area and walks between 2 tiles that has mobs on them which means it pretty much allways relies on right click>walk here which it cant do when the item is highlighted.

to sum it shortly: highlighted(use) item is fucking my script.

 

"cause im 99% sure the logic in my script isn't causing this"

I wouldn't be so sure about that...

Post your code, otherwise we cannot help.

Link to comment
Share on other sites

for (int i=0; i< 28; i++) {
			if (inventory.isItemSelected())
				break;
			Item item = inventory.getItemInSlot(i);
			if (item != null && item.nameContains(Constants.ITEM_NAME)) {
				inventory.interact(i);
				if (i == 27)
					Utils.condSleep(5000, 20, () -> inventory.getItemInSlot(slot) == null);
			}
		}

A rough solution to your problem

Pay attention to the

if (inventory.isItemSelected())
				break;

part

+ What Shudsy say. Deselect item if it's selected before doing shift dropping

Edited by nosepicker
Link to comment
Share on other sites

Just now, TrekToop11 said:

Shift dropping sometimes does cause this issue whether it be from lag or god knows what, but its simple fix as shudsy posted.

yes I figured it would be simple solution to have a check for it but just thought it silly to be needed but maybe I'm just spoiled. haha

 

6 minutes ago, Explv said:

 

"cause im 99% sure the logic in my script isn't causing this"

I wouldn't be so sure about that...

Post your code, otherwise we cannot help.

Well since I nowhere in the script call for the client to use a vial it's obviously not something I'm directly causing. however now i know how i can prevent it with a simple check :) just thought I'd share it, maybe someone else had problems with deaths without knowing from what.

Link to comment
Share on other sites

Yeah, unfortunately this is something you've got to check for. You can't expect the client to click accurately 100% of the time, after all this is a live game so barriers such as latency fluctuation can cause misclicks.

There are other similar situations you might want to consider adding checks for as well, for example if the script misclicks on a bank at an inopportune time, misclicks a ladder, accidentally opens the store/collection box, etc. 

Best of luck

Apa

  • Like 1
Link to comment
Share on other sites

2 hours ago, Shudsy said:

if (getInventory().isItemSelected()) {

getInventory().deselectItem();

}

Fucking hell, I didn't know there was deselectItem() lol, I used to do this shit 

if (s.getInventory().isItemSelected()) {
            s.getMouse().click(new RectangleDestination(s.bot, new Rectangle(10,10,500,330)));
        }

 

:feels:

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