Jump to content

dreameo

Scripter II
  • Posts

    410
  • Joined

  • Last visited

  • Days Won

    2
  • Feedback

    100%

dreameo last won the day on February 22 2019

dreameo had the most liked content!

About dreameo

Profile Information

  • Gender
    Male

Recent Profile Visitors

2408 profile views

dreameo's Achievements

Black Poster

Black Poster (5/10)

187

Reputation

  1. That would make it thread safe but programming logic would still be incorrect. You wouldn't want to reset the 'shots' counter while you're iterating over the 'projectiles list'. You would want to wait until that loop is finished and then allow the reset.
  2. This is not thread safe. You need to guard access to 'shots'.
  3. In cases like this, it's negligible even if it did check. However, just know that the java compiler is smart and sophisticated and in a lot of cases, optimizes for situations like this. Where it wont perform a set of executions given the outcome doesn't change anything.
  4. You have the right idea, just the wrong execution. (You can try reading this but if it doesn't make sense, try some simpler java tutorials - https://javagoal.com/static-and-non-static-variable-in-java/) There's a few different options but here's an easy one: static List<Position> path; static { path = new ArrayList<>(); path.add(new Position(x,y,z)); path.add(new Position(x,y,z)); path.add(new Position(x,y,z)); } // your onLoop would remain the same.
  5. URLConnection request = url.openConnection(); request.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0"); request.connect();
  6. https://pastebin.com/B7GexCCy Offers: - Thread Safe (same object can be used by multiple threads) - Throws lock exception if two or more distinct objects pointing to the same file try to acquire a lock (locks acquired by performing read/write) (One minor thing: Assumes EOF contains new line - you can put some hack to fix it but I didn't bother) Notes (from java lib): This file-locking API is intended to map directly to the native locking facility of the underlying operating system. Thus the locks held on a file should be visible to all programs that have access to the file, regardless of the language in which those programs are written. Whether or not a lock actually prevents another program from accessing the content of the locked region is system-dependent and therefore unspecified. The native file-locking facilities of some systems are merely advisory, meaning that programs must cooperatively observe a known locking protocol in order to guarantee data integrity. On other systems native file locks are mandatory, meaning that if one program locks a region of a file then other programs are actually prevented from accessing that region in a way that would violate the lock. On yet other systems, whether native file locks are advisory or mandatory is configurable on a per-file basis. To ensure consistent and correct behavior across platforms, it is strongly recommended that the locks provided by this API be used as if they were advisory locks.
  7. you could just write to a file: if the information is not there, go to bank, get info, dump it to file this information will be persistent and can/should be updated each time you have the bank open
  8. tldr: This is all a conditional sleep does: while(timeRunningFor < timeout && !myBooleanCondition){ Thread.sleep(some_small_value_in_ms); }
  9. Both sides don't agree, you have to manually go in and define a new packet for every type of message.
  10. I think there's a bit of over complication here. Instead of defining a 'packet' for every kind of message, just define a protocol. This way, you have a single send and receive. Internally, you decide how you make sense of the data. I'd also suggest keeping your classes minimal and light.
  11. https://osbot.org/api/org/osbot/rs07/event/webwalk/PathPreferenceProfile.html -You can try disabling all the preferences -Don't think there's a list anywhere -use getPositions from WebWalkEvent
  12. You have two different 'bank' objects and only one is being initialized using 'exchangeContext'. What you could do is make those classes singletons and ensure the main class exchange context prior to them being used elsewhere
  13. @Override public void onStart() throws InterruptedException { getBot().getMouseListeners().add(new BotMouseListener() { @Override public void checkMouseEvent(MouseEvent mouseEvent) { // on shift + left click if(mouseEvent.getModifiersEx() == 1088){ } } }); } Didn't find any documentation but this will do (for win 10 at least).
  14. You can add key listeners - press the key(s) which triggers the file read. or if you're real lazy -> https://osbot.org/api/org/osbot/rs07/input/mouse/ClientMouseEventHandler.html
×
×
  • Create New...