Jump to content

Ziy

Members
  • Posts

    57
  • Joined

  • Last visited

  • Feedback

    100%

Profile Information

  • Gender
    Male

Recent Profile Visitors

1289 profile views

Ziy's Achievements

Iron Poster

Iron Poster (3/10)

11

Reputation

3

Community Answers

  1. Post where the lines you update the allTimes reference. You are assigning it null somewhere
  2. I think you need to import this package import org.osbot.rs07.api.map.Area; Good luck!
  3. If you want to do this for an iron man you need to monitor hit splats and make sure the damage you have done equals the health of the monster
  4. maybe unrelated to the issue but the case won't break on the else of the if, so then it will fall through to the next case handling block, unless of course you want this
  5. Hey man, the reason there was a discussion on reversing a path was that you can use a path to get somewhere and then simply reverse it to return
  6. If you do put it on a separate thread make sure you keep in mind the potential for race conditions
  7. Haha how crude of me, here's a decent looking guide http://www.teachmejoomla.net/code/php/remote-ip-detection-with-php.html
  8. For anyone who want's to host their own php for it <? echo $_SERVER["REMOTE_ADDR"]; ?>
  9. What is the log output when you try? Can we see your onPaint method?
  10. You both have valid approaches to the problem but why not try to achieve the pros of both implementations in one? Performance is key, right? I would go for the lookup table approach similar Botrepreneur, why? It is way faster as all values a precomputed, here are some test results (100,000 function calls timed in nanoseconds) Test 1 (Botrepreneur 100,000 random 1-99 values) : 11839527 Test 2 (NotoriousPP 100,000 random 1-99 values): 467340188 Test 3 (Botrepreneur 100,000 calls just for value 99): 224877 Test 2 (NotoriousPP 100,000 calls just for value 99): 918205715 But it might be a good idea to keep extensibility by precomputing the values in the lookup table using NotoriousPP's method rather than hardcoding the values Therefore we will have both extensibility and performance (using both your arguments)!
  11. It's because you return after eating an item, if you want to return true if at least one item was eaten then hold it in a boolean variable until the loop has finished then return the result
  12. Do you dynamically load the mini-map image in the region preview?
  13. Ziy

    World hopping class

    You're welcome mate! :-)
  14. Ziy

    World hopping class

    This won't work.. Test Program Output Here's the problem.. private void resetList() { if (future.isEmpty() && !past.isEmpty()) { future = past; past.clear(); } } You are making future reference the same object as past and then clearing it so let's change that first private void resetList() { if (future.isEmpty() && !past.isEmpty()) { List<Integer> temp = future; future = past; past = temp; past.clear(); } } Here you add world values to the future list which is fine.. public WorldHopping(boolean p2pworlds, final boolean f2pworlds, final boolean pvpworlds) { if (p2pworlds) { future.addAll(P2P_WORLDS); } if (f2pworlds) { future.addAll(F2P_WORLDS); } if (pvpworlds) { future.addAll(PVP_WORLDS); } } But.. public void toRandomWorldNumber(){ int i = new Random().nextInt(future.size()); int w = future.get(i); System.out.println(w); future.remove(i); past.add(i); resetList(); } In each hopping method you add the index of the world in future to past and then remove the value from the future? Why would you do that? The index is useless now right? I think you meant to add the world value to the past list, like so public void toRandomWorldNumber(){ int i = new Random().nextInt(future.size()); int w = future.get(i); System.out.println(w); future.remove(i); past.add(w); resetList(); } Now we store the past world values rather than their obsolete indexes in the future list Updated program: import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Random; /** * @author Botrepreneur */ public class WorldHopping { private final List<Integer> P2P_WORLDS = Arrays.asList(301, 302, 303, 304, 305, 306, 309, 310, 311, 312, 313, 314, 317, 318, 319, 320, 321, 322, 326, 327, 328, 329, 330, 333, 334, 335, 336, 338, 341, 342, 343, 344, 345, 346, 349, 350, 351, 352, 353, 354, 357, 358, 359, 360, 361, 362, 365, 366, 367, 368, 369, 370, 373, 374, 375, 376, 377, 378); private final List<Integer> F2P_WORLDS = Arrays.asList(308, 316); private final List<Integer> PVP_WORLDS = Arrays.asList(325, 337); private List<Integer> future = new ArrayList<>(); private List<Integer> past = new ArrayList<>(); public WorldHopping(boolean p2pworlds, final boolean f2pworlds, final boolean pvpworlds) { if (p2pworlds) { future.addAll(P2P_WORLDS); } if (f2pworlds) { future.addAll(F2P_WORLDS); } if (pvpworlds) { future.addAll(PVP_WORLDS); } } public void toRandomWorldNumber(){ int i = new Random().nextInt(future.size()); int w = future.get(i); System.out.println(w); future.remove(i); past.add(w); resetList(); } public void toLowestWorldNumber(){ int w = Collections.min(future); int i = future.indexOf(w); System.out.println(w); future.remove(i); past.add(w); resetList(); } public void toHighestWorldNumber(){ int w = Collections.max(future); int i = future.indexOf(w); System.out.println(w); future.remove(i); past.add(w); resetList(); } private void resetList() { if (future.isEmpty() && !past.isEmpty()) { List<Integer> temp = future; future = past; past = temp; past.clear(); } } public static void main(String args[]) { WorldHopping hopper = new WorldHopping(true, true, true); for(int i = 0; i < 1000; i++) { hopper.toRandomWorldNumber(); } } } Output (it ran to 1000 iterations but these are the first few) Note: You will have to put the world hopping method back from the API
×
×
  • Create New...