Macro Feed

A simple, fast feeding macro for Agar.io

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Macro Feed
// @name:tr      Makro Besleme
// @name:de      Makro-Fütterung
// @name:fr      Macro d’alimentation
// @name:es      Macro de alimentación
// @name:pt-BR   Macro de alimentação
// @name:ru      Макро-кормление
// @name:ja      マクロフィード
// @name:ko      매크로 먹이기
// @name:zh-CN   宏喂食
// @name:zh-TW   巨集餵食
// @name:ar      ماكرو التغذية
// @name:it      Macro di alimentazione
// @name:nl      Macro voeren
// @name:pl      Makro karmienia
// @name:sv      Makro matning
// @name:uk      Макро-годування
// @name:id      Makro pemberian makanan
// @name:vi      Macro cho ăn
// @name:hi      मैक्रो फीड
// @description        A simple, fast feeding macro for Agar.io
// @description:tr     Agar.io için basit ve hızlı bir besleme makrosu
// @description:de     Ein einfaches, schnelles Fütterungs-Makro für Agar.io
// @description:fr     Une macro d’alimentation simple et rapide pour Agar.io
// @description:es     Una macro de alimentación simple y rápida para Agar.io
// @description:pt-BR  Uma macro de alimentação simples e rápida para Agar.io
// @description:ru     Простое и быстрое макро-кормление для Agar.io
// @description:ja     Agar.io 用のシンプルで高速なフィードマクロ
// @description:ko     Agar.io용 간단하고 빠른 먹이 매크로
// @description:zh-CN  适用于 Agar.io 的简单快速喂食宏
// @description:zh-TW  適用於 Agar.io 的簡單快速餵食巨集
// @description:ar     ماكرو تغذية بسيط وسريع لـ Agar.io
// @description:it     Una macro di alimentazione semplice e veloce per Agar.io
// @description:nl     Een eenvoudige en snelle voedermacro voor Agar.io
// @description:pl     Proste i szybkie makro karmienia do Agar.io
// @description:sv     Ett enkelt och snabbt matningsmakro för Agar.io
// @description:uk     Простий і швидкий макрос годування для Agar.io
// @description:id     Makro pemberian makanan yang sederhana dan cepat untuk Agar.io
// @description:vi     Macro cho ăn đơn giản và nhanh cho Agar.io
// @description:hi     Agar.io के लिए एक सरल और तेज़ फीड मैक्रो
// @namespace    https://greasyfork.org/users/1372128
// @version      1.0
// @author       Dragon9135
// @icon         https://agar.io/favicon-32x32.png
// @match        *://agar.io/*
// @grant        none
// @run-at       document-end
// @license      MPL-2.0
// ==/UserScript==

(function() {
    'use strict';
    // ====== Settings ======
    const START_KEY = 87;     // Key to start/stop the macro (W = 87)
    const FEED_KEY  = 87;     // Feed key (W = 87)
    const INTERVAL  = 50;     // Feed key press delay (MS)
    const MAX_COUNT = 500;    // Maximum number of feeds (Safety Limit)

    let feeding = false;
    let feedCount = 0;

    window.addEventListener('keydown', function(e) {
        if (e.keyCode === START_KEY) {
            feeding = true;
            if (feedCount >= MAX_COUNT) {
                feedCount = 0;
            }
            doFeed();
        }
    });

    window.addEventListener('keyup', function(e) {
        if (e.keyCode === START_KEY) {
            feeding = false;
        }
    });

    function doFeed() {
        if (feeding && feedCount < MAX_COUNT) {
            window.onkeydown({keyCode: FEED_KEY});
            window.onkeyup({keyCode: FEED_KEY});
            feedCount++;
            setTimeout(doFeed, INTERVAL);
        }
    }
})();