Skip to content

Instantly share code, notes, and snippets.

@TheEpicFace007
Created December 23, 2020 21:22
Show Gist options
  • Select an option

  • Save TheEpicFace007/5b93b8a937e4eed90baeb3a874da9d66 to your computer and use it in GitHub Desktop.

Select an option

Save TheEpicFace007/5b93b8a937e4eed90baeb3a874da9d66 to your computer and use it in GitHub Desktop.

Reason why rate limit happen in free draw 2

  1. You change the color to quickly
  2. You spam click

Rate limitting information

Rate limit test result with a human

  • An rate limit last in average 4.84 seconds
  • An rate limit lasting over 1 second last in average during 1.92s
  • An rate limit lasting less than 1 second last 0.36s

Rate limit test result with robotjs

  • An rate limit last in average 1.84 seconds
  • An rate limit lasting over 1 second last in average during 2.17s
  • An rate limit lasting less than 1 second last 0.1s

Script used to conduct the test:

local network;
for _, instance in ipairs(getnilinstances()) do
    if instance.Name == "Network" then
        network = require(instance)
    end
end

_G.avg = { }
local timeSinceLastRateLimit = 0
network.on("dialog_error", function(p)
    if p ~= "Rate limited" then
        return
    end
    local eslapsed = tick() - timeSinceLastRateLimit
    table.insert(_G.avg, eslapsed)
    print(eslapsed)
    timeSinceLastRateLimit = tick()
    
end)
--warn("Average: ")
local Average, AverageUnder1, AverageOver1 = 0, 0 , 0
local amntOver1, amntLess1 = 0, 0

for i,v in next, _G.avg do
    Average += v
    if v < 1 then
        amntLess1 += 1
        AverageUnder1 += v
    else
        amntOver1 += 1
        AverageOver1 += v
    end
end

warn("Average: ",   #_G.avg / Average )
warn("Average over 1: ",  amntOver1 / AverageOver1)
warn("Average under 1: ",  AverageUnder1 / amntLess1)

Way to counter rate limit when drawing with robot js

Draw more than one pixel at a time

I noticed this is having a side effect as it causes robotjs to not draw well round corner. This can be countered by reducing the number of pixel it draw at a time. Don't forget to set a timeout to appear human.
Example of this method:

import { PngDrawing } from "./drawing";
import { readFileSync } from "fs";
import * as robot from "robotjs";
import FocusWindow from "./util/FocusWindow";
import setTimeoutSync from "./util/syncTimeout";
import _ from "lodash";

PngDrawing.optimizationOption.optimizationEnabled = true;
PngDrawing.optimizationOption.whitePixelOptimization.enabled = true;

let poop = new PngDrawing(readFileSync(`images\\png\\5lb-holiday-poop-brown.png`));
poop.setImageOffset(200, 200);
poop.scriptSocket.close();

// Speed up the mouse.
robot.setMouseDelay(2);

var twoPI = Math.PI * 2.0;
var screenSize = robot.getScreenSize();
var height = (screenSize.height / 2) - 20;
var width = screenSize.width;

FocusWindow("Roblox");
(async function ()
{
  for (var x = 0; x < width; x += 259)
  {
    robot.mouseToggle("down");
    var y = height * Math.sin((twoPI * x) / width) + height;
    robot.moveMouseSmooth(x, y);
    robot.mouseToggle("up");
    await setTimeoutSync(_.random(0.4, 1.92, true));
  }
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment