Jump to content

Inserting sleeps randomly into a script for anti-patterning


ButNotaBot

Recommended Posts

Hello everyone,

I apologize if there is already a topic thread about this, I was definitely unable to find an answer though. 

I'm curious if there is a way to randomly have the script sleep in between actions, as if there was something IRL distracting the player from the game. So like, every 100 loops it has a chance to insert a sleep(random(x, y)), (with extended sleep times around 15-45 seconds, maybe even long enough to log out,) somewhere in the loop and then remove it for the next 100 loops. 

I'm still new to scripting, but I've got the basics of osrs down and I feel like the next big challenge for me is going to be figuring out stuff like this, the anti-patterning techniques that prevent immediate bans.

I do get that bans are almost a certainty, but there are definitely things that can keep the bot detection guessing for longer. For instance, I found a toic about a mouse controller that uses bezier curves to make the mouse seem more human. 

Thank you in advance. I know asking to be spoonfed is frowned upon so if somebody knows but doesn't feel like explaining it, I would appreciate it if you could even point me in the right direction for research

Edited by ButNotaBot
Link to comment
Share on other sites

@ButNotaBot Use a switch. Like this...

 

switch (random(1, 100)) {
            
            case 1 : sleep(random(20000,50000));
            break;
            
            case 2 : sleep(random(60000, 150000));
            break;
            
            case 3 : sleep(random(150000, 500000));
    		break;
            
            default: sleep(random(1000, 5000));
            break;
        }

Also do you know some Java? If not learn that before doing some scripting. After that just read the API  https://osbot.org/api/

Link to comment
Share on other sites

Just so you know, human-like not equals to random. Hence if you were to replicate human-like activities/breaks through random breaks, it's not gonna work.

What you need could be profiling.

Where player A takes "X" breaks, player B takes "Y" breaks etc, and not just any random breaks.

  • Like 1
Link to comment
Share on other sites

56 minutes ago, Charlotte said:

Just so you know, human-like not equals to random. Hence if you were to replicate human-like activities/breaks through random breaks, it's not gonna work.

What you need could be profiling.

Where player A takes "X" breaks, player B takes "Y" breaks etc, and not just any random breaks.

in the next episodes of CSI Charlotte 😛 

Link to comment
Share on other sites

19 minutes ago, dreameo said:

I'm confused, why does random(0,4) do 0,1,2,3 and not up to 4?
So in a scenario like this, it would never actually get 15?

	    public void randomInterfaceEvent() {
        int rN = random(0, 15);
        if (!mp.getTabs().isOpen(Tab.INVENTORY)) {
            switch (rN) {
                case 0:
                    this.mp.getTabs().open(Tab.INVENTORY, true);
                    break;
                case 1:
                    this.mp.getTabs().open(Tab.ACCOUNT_MANAGEMENT, true);
                    break;
                case 2:
                    this.mp.getTabs().open(Tab.ATTACK, true);
                    break;
                case 3:
                    this.mp.getTabs().open(Tab.CLANCHAT, true);
                    break;
                case 4:
                    this.mp.getTabs().open(Tab.EMOTES, true);
                    break;
                case 5:
                    this.mp.getTabs().open(Tab.EQUIPMENT, true);
                    break;
                case 6:
                    this.mp.getTabs().open(Tab.FRIENDS, true);
                    break;
                case 7:
                    this.mp.getTabs().open(Tab.INVENTORY, true);
                    break;
                case 8:
                    this.mp.getTabs().open(Tab.LOGOUT, true);
                    break;
                case 9:
                    this.mp.getTabs().open(Tab.PRAYER, true);
                    break;
                case 10:
                    this.mp.getTabs().open(Tab.MAGIC, true);
                    break;
                case 11:
                    this.mp.getTabs().open(Tab.MUSIC, true);
                    break;
                case 12:
                    this.mp.getTabs().open(Tab.QUEST, true);
                    break;
                case 13:
                    this.mp.getTabs().open(Tab.SETTINGS, true);
                    break;
                case 14:
                    this.mp.getTabs().open(Tab.SKILLS, true);
                    break;
                case 15:
                    this.mp.getTabs().open(Tab.SKILLS, true);
                    break;
            }
        } else {
        }
    }
	

Link to comment
Share on other sites

On 12/10/2019 at 3:55 AM, Gunman said:

@ButNotaBot Use a switch. Like this...

 


switch (random(1, 100)) {
            
            case 1 : sleep(random(20000,50000));
            break;
            
            case 2 : sleep(random(60000, 150000));
            break;
            
            case 3 : sleep(random(150000, 500000));
    		break;
            
            default: sleep(random(1000, 5000));
            break;
        }

Also do you know some Java? If not learn that before doing some scripting. After that just read the API  https://osbot.org/api/

@Gunman Thank you, and I only know the basics that I've learned through writing basic scripts for osbot. I'm much better at learning when I have something to go along with what I'm learning at the time. I've learned some more about switches, the question I have is where to put that in the script in order to have it run while the onLoop is doing it's thing. I want it to be running alongside the loop itself so that if there are 5 actions in the loop, it may fall between actions 1 and 2, it may fall between actions 2 and 3, it may not happen at all, it may happen during the interaction with a shop. I'd like it to seem like the player got distracted by something, like they had to stop what they were doing and get something off the top shelf for their short roommate or something lol. I would assume that it would not be included in the onLoop for that script, so it would go before the onLoop itself. Is that wrong?

 

On 12/10/2019 at 5:45 AM, Charlotte said:

Just so you know, human-like not equals to random. Hence if you were to replicate human-like activities/breaks through random breaks, it's not gonna work.

What you need could be profiling.

Where player A takes "X" breaks, player B takes "Y" breaks etc, and not just any random breaks.

@CharlotteJust so I can be sure I understand, do you mean kind of setting up a fake life for an account. So to say, "Player A" works from 9-5 so he plays for 2 hours before work then stops until 6 when hes home, where he plays until dinner at 7 then finishes out the night playing for another 3 hours after dinner. That's his routine and he does it 4 days a week, 1 day he wont play at all but then on the weekends he goes on osrs sprees? In a predictable manner? It makes sense when I look at when I usually play (unless I'm on mobile because I just use it to kill time in between orders at work.) Is there more to it that you were thinking of or is that the gist of it? I'm super curious because you've been doing this for a while and it definitely seems like a necessity.

On 12/10/2019 at 11:03 AM, dreameo said:

@dreameo Did you end up expanding on Gaussian Randoms anywhere? Thank you for pointing me towards the article. I'm sure it will come in handy when i start integrating random switches into the scripts.

Edited by ButNotaBot
Link to comment
Share on other sites

@ButNotaBot

3 hours ago, ButNotaBot said:

@Gunman Thank you, and I only know the basics that I've learned through writing basic scripts for osbot. I'm much better at learning when I have something to go along with what I'm learning at the time. I've learned some more about switches, the question I have is where to put that in the script in order to have it run while the onLoop is doing it's thing. I want it to be running alongside the loop itself so that if there are 5 actions in the loop, it may fall between actions 1 and 2, it may fall between actions 2 and 3, it may not happen at all, it may happen during the interaction with a shop. I'd like it to seem like the player got distracted by something, like they had to stop what they were doing and get something off the top shelf for their short roommate or something lol. I would assume that it would not be included in the onLoop for that script, so it would go before the onLoop itself. Is that wrong?

You should really try and keep only 1 action per loop. Go to 15 of this and look how Explv made the script to call to have one action per loop of the onloop.

You can also read that to learn more about the API and scripting. So if you do how he does then your code should turn out very consistent and "Flawless". You can also go through each part of this to learn some more Java. https://www.programiz.com/java-programming#recommended-books

EDIT: After re reading this I kinda didn't answer the question lol. You don't need the default so you can remove it and if the number isn't one of the cases then it would do nothing. So you can just call the switch at the end of a method of actions you would like it to sleep during. Though if you would like to be like what you said and this isn't pvp and can get you killed then probably would be easiest to put it right above the return.

Edited by Gunman
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...