Jump to content

battleguard

Members
  • Posts

    54
  • Joined

  • Last visited

  • Feedback

    100%

Everything posted by battleguard

  1. You should look into using a memory profiler and taking snapshots of your memory at the start of your run and after a while when it reaches the higher memory levels. Then look at the objects its holding onto and tracking down where those references are created. I have only done this mainly in c# though for work but I am sure its just as easy to do in java. Edit from what I can tell it looks like osbot adds this argument when running a script "-XX:+DisableAttachMechanism". Which looks to disable heap dumps if anyone knows if this is correct and you cannot looks at your scripts heap please let me know.
  2. Works great thanks for open sourcing this. The main problem I ran into was the stop was not working because the message } else if (outputLine.contains("OSBot is now ready!")) { https://github.com/Explv/osbot_manager/blob/master/osbot_manager/src/bot_parameters/configuration/Configuration.java#L422 never fired on mine so I changed it to } else if (outputLine.contains("Successfully loaded OSBot!")) { Also I am hoping I can find a way to call my onstop on the script so I can gracefully shutdown the script. And it would be nice for the parameters you put on a script to show up when selecting them because if you have 2 different CLI commands you cannot see the difference in the script selector. If you are down for changes I can push some of these up to you I also made it a maven project so its easier to get running after cloning.
  3. Instead of calling this line !myPlayer().isMoving() & !myPlayer().isAnimating() On every single area type you should just check the statement at the beginning of your loop and return if either is found to be true. Once you get more java experience you should look into using parallel arrays or creating a class for each area jump action. That way you dont have a long list of if statements. A good way to think of it is what if you had 1000 areas for that course how would you handle it so that you did not have to call 1000 if checks in your main loop.
  4. Here is some code that i wrote years ago that might be of some help to you. It looks like I went with checking the message listener for when the coal bag was full you could also though count the number of times you put coal in the bag I would imagine. https://github.com/battleguard/rsbot5scripts/blob/master/rsbot5/src/com/battleguard/olderscripts/p****bot-Miner/CoalBag.java package Miner; import org.p****bot.core.event.events.MessageEvent; import org.p****bot.core.script.job.Task; import org.p****bot.core.script.job.state.Node; import org.p****bot.game.api.methods.tab.Inventory; import org.p****bot.game.api.wrappers.node.Item; public class CoalBag extends Node { public static final int COAL_BAG_ID = 18339; private static final int COAL_ID = 453; private static final String EMTPY_MSG = "Your coal bag is empty."; private static final String FULL_MSG = "Your coal bag is already full."; private static boolean inUse = false; public static boolean bagFull = false; public static final boolean setup() { return inUse = Inventory.getCount(COAL_BAG_ID) > 0; } public static final boolean isValid() { return inUse; } public static final void withdrawCoal() { RockTimer.state = "Withdrawing Coal"; final Item CoalBag = Inventory.getItem(COAL_BAG_ID); if (CoalBag != null) { if(CoalBag.getWidgetChild().interact("Withdraw-many")) { bagFull = false; } else { checkBag(); } Task.sleep(1000); } } public static final void checkBag() { RockTimer.state = "Checking Bag"; final Item CoalBag = Inventory.getItem(COAL_BAG_ID); if (CoalBag != null) { CoalBag.getWidgetChild().click(true); } } public static final void putCoalInBag() { RockTimer.state = "Adding coal to bag"; final Item CoalBag = Inventory.getItem(COAL_BAG_ID); final Item Coal = Inventory.getItem(COAL_ID); if (CoalBag != null && Coal != null) { Coal.getWidgetChild().click(true); Task.sleep(1000); CoalBag.getWidgetChild().click(true); Task.sleep(1000); } } public static final void checkMessage(final MessageEvent msg) { if (msg.getId() == 0) { if (msg.getMessage().equals(FULL_MSG)) { bagFull = true; } if (msg.getMessage().equals(EMTPY_MSG)) { bagFull = false; } } } @Override public boolean activate() { return !Banker.isDepoOpen() && Inventory.isFull() && !bagFull; } @Override public void execute() { putCoalInBag(); } }
  5. https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextInt-int-
  6. I am willing to offer 360k per account. Since a tutorial account costs only 120k I figured 240k to do 7qp with one of the many free 7qp scripts should be enough.
  7. Looking for a reputable account seller for buying 10+ 7 QP Accounts.
  8. ok thanks for everyones help I did not know you could right click the player and trade after they have traded to open up the window I thought you had to click the accept trade message in the chat.
  9. All of those methods are for when the trade window is open. There is nothing for accepting a trade offer in the message window.
  10. Hey I am trying to write an automated muler, but I am not seeing any easy way to accept trade anyone have a snippet I can use.
  11. The bot looks to have lost its hook to getplayername we will just have to wait for an update later today.
  12. considering thats just one item I dont see that as a trend. Look at 3 months out on Yew Logs Willow Logs Gold ore Iron ore Raw Lobster Big Bones Cowhide Copper ore etc... They all are going through there normal peaks and valleys I feel like all items would be surging like oak logs if there was a big hit to the f2p bots.
  13. prices looks pretty normal to me on most of the f2p botted item.
  14. on the repaint does run in a seperate thread and should not be used for state logic because it does not run with certain command line arguments that reduce cpu load.
  15. public static OsBuddyItemConfig[] getItems() throws IOException { JsonParser parser = new JsonParser(); JsonElement parse = parser.parse(readUrl("https://rsbuddy.com/exchange/summary.json")); JsonObject asJsonObject = parse.getAsJsonObject(); Gson gson = new Gson(); Set<Map.Entry<String, JsonElement>> entries = asJsonObject.entrySet(); Iterator<Map.Entry<String, JsonElement>> iterator = entries.iterator(); OsBuddyItemConfig[] items = new OsBuddyItemConfig[entries.size()]; for(int i = 0; i < entries.size(); i++) { JsonElement value = iterator.next().getValue(); OsBuddyItemConfig osBuddyItemConfig = gson.fromJson(value, OsBuddyItemConfig.class); items[i] = osBuddyItemConfig; } return items; } private static String readUrl(final String urlPath) throws IOException { URL url = new URL(urlPath); URLConnection con = url.openConnection(); con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"); con.setUseCaches(true); BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream())); String json = br.readLine(); br.close(); return json; } public class OsBuddyItemConfig { public int id; public String name; public int buy_average; public int sp; public int overall_average; public boolean members; public int sell_average; } Here is what I have been using lately, but this requires you to extract GSON's source into your script, but its so nice and clean and I use many json classes so rolling my own parser just was not worth it.
  16. I have a problem where I am making a folder hierarchy that has a folder for each run and a folder for each account being ran. This works great for saving off everything, but I cannot seem to find a way to change where the script logging output goes at runtime. Currently I log the script output using intellij's save console to output file feature, but I need to change the folder path at runtime so this wont work. - Things I have tried or thought about - redirecting output of jar using > out.txt in command line arguments but once again this is not runtime - redirecting system output using System.setOut(printstream), but once again the super locked down jar does not support this feature sadly - I can change all my calls in the entire script from the bots logger to a custom logger that I have implemented that saves the output to a fiile So far this is all I have thought of and I really do not like the idea of using the final option.
  17. I didnt think of extracting the source thanks I will have to try that and let you know how it works.
  18. I am trying to modify the policy information so I can use rxjava in my local script. I looked into the permissions you suggested because it looks like you are correct and its not something in osbot at all. I tried changing my policy to allow everything and I tried manually specifying the policy file when loading up the jar with vm variables but nothing seems to work sadly.
  19. you can extract the jar inside your artifact to get around this problem. The main problem is it has a locked down security permissions so it might not be able to do everything you need it to do. Also if your making an SDN script I highly doubt the developers are going to approve of a script that has giant library's extracted into there main script jar. @Alek Is there anyway to fix this problem when running the jar where I cannot view the System Properties. This line here "System.getProperties();" will always throw this error -> Blocked permission: ("java.util.PropertyPermission" "*" "read,write"). I am using jxjava in a script but I am unable to do anything with time intervals because it requires making a scheduler from a SchedulerPoolFactory but on the static constructor of the class it blows up because it cannot access these properties (https://github.com/ReactiveX/RxJava/blob/2.x/src/main/java/io/reactivex/internal/schedulers/SchedulerPoolFactory.java#L95) static { boolean purgeEnable = true; int purgePeriod = 1; Properties properties = System.getProperties(); if (properties.containsKey(PURGE_ENABLED_KEY)) { purgeEnable = Boolean.getBoolean(PURGE_ENABLED_KEY); } if (purgeEnable && properties.containsKey(PURGE_PERIOD_SECONDS_KEY)) { purgePeriod = Integer.getInteger(PURGE_PERIOD_SECONDS_KEY, purgePeriod); } PURGE_ENABLED = purgeEnable; PURGE_PERIOD_SECONDS = purgePeriod; start(); }
  20. How would you implement custom breaks in scripts is there a way built in or do you need to handle logging out and back in completely in your script.
  21. how would you use colors for rocks can you get all colors on a model or are you just doing something like getting the central pixel color.
  22. Debugging scripts in osbot is pretty simple once you learn abut debugging localprocesses. Here are the basic steps you will need 1. Add a breakpoint into your local script you have create 2. Set your build output to go to your OSBOT scripts folder 3. Create a debug configuration that starts an application with the entry point of org.osbot.boot 4. Run your configuration (do not debug it) to bring up osbot so your local processes in intellij can see it. 5. log into your account and then you are ready to attach to the local script process through intellij. Once you have attached run your script and you should now be debugging your script so any breakpoints that the code hits will now stop and allow you to see the variables. 6. you can also add watches to quickly look up things without using print lines and make debugging much easier now. 7. if you need to do more complex statements you can use evaluate expression to have multiple lines. Looks like images got deleted from site so to view the gifs that explain each step use this google cache link https://webcache.googleusercontent.com/search?q=cache:zre9YWkp3WsJ:https://osbot.org/forum/topic/133159-using-the-debugger-with-osbot-local-scripts/+&amp;cd=1&amp;hl=en&amp;ct=clnk&amp;gl=us or this imgur link: https://imgur.com/a/smwr5lu
  23. you can debug osbot by running debugging intellij as an application and setting your main class to org.osbot.Boot. You then need to just use run instead of debug configuration when running it. Once you start your script inside the jar you can then go to run->attach process and you will now see your script running in a process you can attach to. From there your breakpoints should work
×
×
  • Create New...