sudoinit6 Posted April 8, 2020 Share Posted April 8, 2020 As the title says, is there any way to programmatically determine how many hours an account has been logged in? Quote Link to comment Share on other sites More sharing options...
Naked Posted April 8, 2020 Share Posted April 8, 2020 Like in a current session? Not unless you keep track of it in a script. Overall play time? Hans in lumby Quote Link to comment Share on other sites More sharing options...
IDontEB Posted April 8, 2020 Share Posted April 8, 2020 on OSB I don't think so, but the reflection check packet has a counter in there and the number there is equal to ticks so you could just multiply by 0.6. Quote Link to comment Share on other sites More sharing options...
sudoinit6 Posted April 8, 2020 Author Share Posted April 8, 2020 Yeah, I can figure out for a single session. I was hoping for the lifetime of the bot which it sounds like isn't possible. I can go to hans in lumby but I don't know how to capture that data and make decisions based on it. I don't think OSB can do that but I was hoping for a way I don't know about. Quote Link to comment Share on other sites More sharing options...
Naked Posted April 8, 2020 Share Posted April 8, 2020 4 hours ago, IDontEB said: on OSB I don't think so, but the reflection check packet has a counter in there and the number there is equal to ticks so you could just multiply by 0.6. nerd 4 hours ago, sudoinit6 said: Yeah, I can figure out for a single session. I was hoping for the lifetime of the bot which it sounds like isn't possible. I can go to hans in lumby but I don't know how to capture that data and make decisions based on it. I don't think OSB can do that but I was hoping for a way I don't know about. Just read the widget in the chatbox Quote Link to comment Share on other sites More sharing options...
Ace99 Posted April 8, 2020 Share Posted April 8, 2020 4 hours ago, sudoinit6 said: Yeah, I can figure out for a single session. I was hoping for the lifetime of the bot which it sounds like isn't possible. In the onExit() method you can log the time of that session (this would be session botted not actually logged in assuming you have breaks set). You can have that sent to a discord server you own for your bots and then manually add up the times every day/week/month. More advanced version of this would be to send the session data to a web server and have it do the additions for you. This post is on the featured section about that. Quote Link to comment Share on other sites More sharing options...
IDontEB Posted April 8, 2020 Share Posted April 8, 2020 40 minutes ago, Naked said: nerd Just read the widget in the chatbox I spoof my packets so hard jagex thinks im afking sand crabs while im killing zulrah. Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted April 8, 2020 Share Posted April 8, 2020 4 hours ago, sudoinit6 said: Yeah, I can figure out for a single session. I was hoping for the lifetime of the bot which it sounds like isn't possible. I can go to hans in lumby but I don't know how to capture that data and make decisions based on it. I don't think OSB can do that but I was hoping for a way I don't know about. No easy way to do it, you will have to grab the text from hans and parse it. Example this returns the lifetime of the account in milliseconds. Quote import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.utility.ConditionalSleep; import java.util.function.BooleanSupplier; public class AccountLifetimeChecker extends MethodProvider { public long getAccountLifetime() { NPC hans = getNpcs().closest(npc -> npc.getName().toLowerCase().equalsIgnoreCase("hans") && npc.hasAction("Age")); if (hans == null) getWalking().webWalk(new Position(3220, 3222, 0)); else if (!getDialogues().isPendingContinuation() && hans.interact("Age")) sleepUntil(() -> getDialogues().isPendingContinuation(), 10000, 100); else if (getDialogues().isPendingContinuation() && getWidgets().getWidgetContainingText("you arrived") != null) return parseDialogueData(getWidgets().getWidgetContainingText("you arrived").getMessage()); return -1; } private long parseDialogueData(String data) { final char[] dataChars = data.toCharArray(); final String[] times = new String[4]; final StringBuilder timeWord = new StringBuilder(); long totalTime = 0; boolean creatingWord = false; int currentTimeWord = 0; // Construct the different time strings. for (char c : dataChars) { if (isCharNumber(c)) { creatingWord = true; timeWord.append(c); } else if (creatingWord) { creatingWord = false; times[currentTimeWord] = timeWord.toString(); currentTimeWord++; timeWord.delete(0, timeWord.length()); } } if (times[3] != null) { totalTime += getMillisFromDays(Integer.parseInt(times[0])); // Parse days totalTime += getMillisFromHours(Integer.parseInt(times[1])); // Parse hours totalTime += getMillisFromMinutes(Integer.parseInt(times[2])); // Parse minutes } else { totalTime += getMillisFromHours(Integer.parseInt(times[0])); // Parse hours totalTime += getMillisFromMinutes(Integer.parseInt(times[1])); // Parse minutes } return totalTime; } private boolean isCharNumber(char c) { try { Integer.parseInt(c + ""); return true; } catch (Exception e) { return false; } } private long getMillisFromDays(int days) { return days * 24 * 60 * 60 * 1000; } private long getMillisFromHours(int hours) { return hours * 60 * 60 * 1000; } private long getMillisFromMinutes(int minutes) { return minutes * 60 * 1000; } private boolean sleepUntil(BooleanSupplier condition, int maxTime, int checkInterval) { new ConditionalSleep(maxTime, checkInterval) { @Override public boolean condition() throws InterruptedException { return condition.getAsBoolean(); } }.sleep(); return condition.getAsBoolean(); } } Use getAccountLifetime method to retrieve the time. You will need to check if it doesn't return -1 before using the result as it is set up in a way to only execute one action each time it is called. So if the dialogue is not visible it will talk to or walk to hans than you will have to call it again for it to either talk to hans, or retrieve the lifetime. Example usage. Quote @Override public int onLoop() throws InterruptedException { long lifeTime = getAccountLifetime(); if (lifeTime != -1) { log(lifeTime); } return random(800, 3000); } Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted April 8, 2020 Share Posted April 8, 2020 Best way is to check it at Hans Quote Link to comment Share on other sites More sharing options...
sudoinit6 Posted April 8, 2020 Author Share Posted April 8, 2020 5 hours ago, BravoTaco said: No easy way to do it, you will have to grab the text from hans and parse it. Example this returns the lifetime of the account in milliseconds. Use getAccountLifetime method to retrieve the time. You will need to check if it doesn't return -1 before using the result as it is set up in a way to only execute one action each time it is called. So if the dialogue is not visible it will talk to or walk to hans than you will have to call it again for it to either talk to hans, or retrieve the lifetime. Example usage. Wow, thanks for this. Very helpful! Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted April 9, 2020 Share Posted April 9, 2020 17 hours ago, sudoinit6 said: Wow, thanks for this. Very helpful! Np Quote Link to comment Share on other sites More sharing options...
TeamSSL Posted June 8, 2023 Share Posted June 8, 2023 what is these days the way to check it, must be more easy Quote Link to comment Share on other sites More sharing options...
Delivery Posted June 17, 2023 Share Posted June 17, 2023 On 6/8/2023 at 3:43 PM, TeamSSL said: what is these days the way to check it, must be more easy Make a webserver that pings when you're online and store that in a database? use your SSL skills and make it on a site Quote Link to comment Share on other sites More sharing options...
TeamSSL Posted June 22, 2023 Share Posted June 22, 2023 I just used the widget from the osbot but weird no1 posted that before Quote Link to comment Share on other sites More sharing options...
BananaTown Posted June 28, 2023 Share Posted June 28, 2023 (edited) On 6/22/2023 at 2:40 PM, TeamSSL said: I just used the widget from the osbot but weird no1 posted that before I assume you're reading the widget in the account tab? this is a way to do it . RS2Widget playtime = getWidgets().get(712, 2, 100); RS2Widget yes = getWidgets().get(219, 1, 1); if (playtime == null) { new ConditionalSleep(5000) { @Override public boolean condition() { return playtime.isVisible(); } }.sleep(); } else { playtime.interact("Reveal"); } if (dialogues.inDialogue()){ yes.interact("Continue"); } Edited June 28, 2023 by BananaTown459 added cdoe Quote Link to comment Share on other sites More sharing options...