Jump to content

yfoo

Lifetime Sponsor
  • Posts

    171
  • Joined

  • Last visited

  • Feedback

    100%

1 Follower

About yfoo

Profile Information

  • Gender
    Male
  • Location:
    SW U.S

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

yfoo's Achievements

Steel Poster

Steel Poster (4/10)

67

Reputation

  1. Thanks for the info. I eventually ended up with using the equipment check.
  2. If you're are already using myVertCount to determine how long you're stunned you should go ahead and also use it to determine if you are stunned. There is no reason to use 2 since one can do both for you.
  3. Just now figured out that using vertices count is the way to go. The birds that appear add to your vertices count, bumping it up by 42. Set your starting vertices count in onStart. Then you can check if stunned by comparing it against your current vertex count. Something like... // When player is stunned their vertices count goes up by ~42. // Get baseline vertices when idle to determine when stunned. MidStunUtil.approxVerticesCountStunned = myPlayer().getModel().getVerticesCount() + 42; public static boolean isPlayerStunned() { return approxVerticesCountStunned - globalMethodProvider.myPlayer().getModel().getVerticesCount() <= 5; } I used to use player height (normal ~ 198, stunned ~ 240) but that doesn't work if player is wielding certain items like a staff that increases your height over 240. Checking animation also is a nogo, The animation id flips back to -1 before the stun ends. So you wouldn't be able to ConditionalSleep until unstunned. Player hp is also bad, what if dodgy necklace procs?
  4. Generally you shouldn't really care about the exact positions or areas of objects, or at least i don't. The only time I did was Areas of banks. I rely more on the locations of Rs2Objects or Entitles instead since those objects can be easily interacted with using the api, and that is likely what you're going to do anyway. Your dynamic instance is still going to have common Rs2Objects/Entities right, why not use those to navigate instead?
  5. RS2Widget myWid = widgets.get(219, 1, 1); You are referring to this line right? Its ok to do because I am assigning an Object reference here. An object reference is just like a regular variable assignment (ex: int myint = 1;) except it deals with a class (ex: Rs2Widget, ArrayList, String) instead of a primitive (int, double, boolean). Remember, in Java an object reference can be assigned to null. Assuming the widgets.get() returns null, a null pointer will only occur if I attempt to do something with it without null checking, (Such as myWid.isVisible()). Thats why I still have your original null check just modified to use myWid. if(myWid != null && myWid.isVisible()) Watch this video to get a more indepth explanation of primitives vs references.
  6. It looks like if(dialogues.isPendingOption()){ if(widgets.get(219, 1, 1) != null && widgets.get(219, 1, 1).isVisible()){ RS2Widget myWid = widgets.get(219, 1, 1); if(myWid.getMessage().equals("Take to sawmill: 26 x Mahogany logs")){ if(inventory.contains("Mahogany logs")) { if (dialogues.selectOption("Take to sawmill: 26 x Mahogany logs")) {} } else { useLogsOnButler(); } } else if(myWid.getMessage().equals("Take to sawmill: 26 x Teak logs")){ if(inventory.contains("Teak logs")) { if (dialogues.selectOption("Take to sawmill: 26 x Teak logs")) {} } else { useLogsOnButler(); } } } //etc. should work but its bad practice to refer to widgets with more than root id, I think I read this in the SDN guidelines. Even if this is not going on SDN, good idea anyway. Separate note. Put... RS2Widget myWid = widgets.get(219, 1, 1); Above if(widgets.get(219, 1, 1) != null && widgets.get(219, 1, 1).isVisible()) Then change the if to if(myWid != null && myWid.isVisible()) So you don't make 3 calls to get the same widget.
  7. In that case, I would handle it by... - first determining if you are using Teak/Mahogany based on inventory. (ex: boolean isTeak) - Using widgets.containingText("Take To Sawmill") to get a List<Rs2Widget> of all the dialog options with the corresponding string. - Then based on "isTeak" search the List<Rs2Widget> for a rs2widget whose message ( rs2Widget.getMessage() ) contains both the correct log type AND 26. - Interact with the found widget.
  8. 1042 doesn't work. it increments even when I don't consume a charge. The Runelite plugin doesn't know what the charges are until they are manually checked. Then it starts counting. Pretty sure its checking if I get hit and the stun anim plays (Player height > 230 or whatever). I can use check ammy slot for simplicity equipment.isWearingItem(EquipmentSlot.AMULET, "Dodge necklace");
  9. Anyone willing to share how dodgy necklaces charges are detected? Its a persistent value on logout so I'm sure that means its a config. Personally rather use a config than a onMessage solution. Looking at config change history until I figure out the pattern . Edit: Looks like something to do with config 1042.
  10. Do you mean there are multiple options to select but all of them have the same text? There are different overloads of selectOptions. You probably want the one that takes in an int. https://osbot.org/api/org/osbot/rs07/api/Dialogues.html Also does typing in the exact string not work?
  11. Its invisible, you need to draw it on the screen in onPaint or enable Mouse Position in debug/settings menu (Right side of osbot window, 3 gears icon).
  12. When a npc is killed, its loot doesn't appear immediately. Death animation plays first. Change if (groundItems.closest("Raw rat meat") != null) { To a ConditionalSleep, sleep until you see your raw meat drop.
  13. >I was also not aware of a conditionalSleep2 method - what is the difference? regular CS requires you to make an object to call sleep. CS2.sleep() is a static method. >randomGaussian method is a good idea for sleeps! Although I feel like I would add a base 50ms just because reaction time? That's the point actually, I was using it to delay menu interactions by a small amount, like a human would. ex:) sleep(randomGaussian(300, 100)); keyboard.pressKey(KeyEvent.VK_SPACE); ScriptPaint.setStatus("Spacebar-ing make widget"); result = ConditionalSleep2.sleep(2000, () -> { List<RS2Widget> widgets = new ArrayList<>(getWidgets().containingActions(270, CREATE_VERBS)); return widgets.isEmpty(); }); sleep(randomGaussian(300, 100)); keyboard.releaseKey(KeyEvent.VK_SPACE); In this block, I wanted to wait a moment after the make widget appears before interacting with it. Then wait again after spacebar-ing it before releasing it.
  14. Neat! What about adding an additional step to have headless arrowheads in inventory and use those as well? Regarding the make widget I think the root id is 270. Also you can use "1" hotkey instead of clicking the widget since arrowheads are always the 1st option from the left. Here is a example of how I get the widget then interact with it with spacebar. Same concept as "1" hotkey. Except spacebar repeats the last widget interaction used. https://github.com/YifanLi5/Bankstanding-Skiller/blob/cc8c13d063fd141125494fe3bf7643330d14a49d/src/Task/CombineItems.java#L86
×
×
  • Create New...