Register
Hello There, Guest!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Agma Flip/Spin/jump/Shake & Wacky-Script
#1
UPDATE: New Script! Updated the link to the new script. It includes the old animation script.




Animation-Script for Agma.io! Press a key and a randomly animation - including /wacky - will be written to the chat.

Then just press "ENTER" to send it! Very helpful to "spam" animations. Per default the key to press is  "CTRL".


[Image: wacky.jpg?1564604267]


Installation:
- To include custom scripts you have to install either the Greasemonkey (Firefox) or Tampermonkey (Chrome, Microsoft Edge, Safari, Opera, and Firefox) browser extension
- Then go to https://greasyfork.org/de/scripts/391142...le-scripts and click on the "Install script" button
- Another page will open. Click on "Install" to actually install the script
[-] The following 2 users Like samira's post:
  • GAS666, yukichan
Reply
#2
(08-01-2019, 06:11 PM)samira Wrote: Animation-Script for Agma.io! Press a key and a randomly animation - including /wacky - will be written to the chat.

Just press "ENTER" to start it! Very helpful to "spam" animations. Per default the key to press is the key left to 1 / below "ESC": "`" on English QWERTY layout, "^" on German QWERTZ keyboard layout.


[Image: wacky.jpg?1564604267]


Installation:
- To include custom scripts you have to install either the Greasemonkey (Firefox) or Tampermonkey (Chrome, Microsoft Edge, Safari, Opera, and Firefox) browser extension
- Then go to https://greasyfork.org/de/scripts/388056...ion-script and click on the "Install script" button
- Another page will open. Click on "Install" to actually install the script

Checked through your code, seems like the function "sendKey" is undefined. - line 50
[-] The following 3 users Like Nuke 's post:
  • GAS666, samira, yukichan
Reply
#3
Oh forgot to upload the fixed version lol. Thanks! Smile ( Must do it tomorrow though )

First time I use that Tampermonkey etc. to actually publish a script . Smile
[-] The following 1 user Likes samira's post:
  • yukichan
Reply
#4
Code:
// ==UserScript==
// @name         Agma Animation Script
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Let your cell spin, jump, shake, flip and wacky!
// @author       You
// @match        http://agma.io/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Mouse button to use to start. Nell = do not listen to mosue click.
    // 0 = left, 1 = middle, 2 = right
    var startMouseButton = null

    // Key to use to start. Null = do not key press..
    // Use this tool to find out key codes - just press a button: https://unixpapa.com/js/testkey.html
    // 17 = CTRL
    var startKeyCode = 17;

    // True = Combine wacky with others animations,
    // False = Only other aninmations
    var combine = true;

    console.log('Agma Animation Script started! ?');

    /**
     * Returns a random number between min (inclusive) and max (exclusive)
     * Source: MDN
     */
    var getRandomArbitrary = function(min, max) {
        return Math.random() * (max - min) + min;
    }

    var chatAnimate = function()
    {
        // The available commands
        var items = ['spin', 'flip', 'shake', 'jump'];

        // Choose randomly an item of the items array
        // Source: https://stackoverflow.com/questions/5915096/get-random-item-from-javascript-array
        var item = items[Math.floor(Math.random()*items.length)];

        if (combine) {
            item = 'wacky' + item;
        }

        // Add text into the chatbox and focus it
        $('#chtbox').val('/' + item).focus();

        // Stop the event so that the pressed key won't be written into the chatbox!
        event.preventDefault();
    }

    window.addEventListener('mousedown', function(event)
    {
        if (event.button == startMouseButton) {
            chatAnimate();
        }
    });
    window.addEventListener('keydown', function(event)
    {
        if (event.keyCode == startKeyCode && ! event.shiftKey) {
            chatAnimate();
        }
    });
})();
[-] The following 4 users Like samira's post:
  • GAS666, MadMan YT, Squirrel , yukichan
Reply
#5
(08-02-2019, 12:12 AM)samira Wrote:
Code:
// ==UserScript==
// @name         Agma Animation Script
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Let your cell spin, jump, shake, flip and wacky!
// @author       You
// @match        http://agma.io/
// @grant        none
// ==/UserScript==

(function() {
   'use strict';

   // Mouse button to use to start. Nell = do not listen to mosue click.
   // 0 = left, 1 = middle, 2 = right
   var startMouseButton = null

   // Key to use to start. Null = do not key press..
   // Use this tool to find out key codes - just press a button: https://unixpapa.com/js/testkey.html
   // 17 = CTRL
   var startKeyCode = 17;

   // True = Combine wacky with others animations,
   // False = Only other aninmations
   var combine = true;

   console.log('Agma Animation Script started! ?');

   /**
    * Returns a random number between min (inclusive) and max (exclusive)
    * Source: MDN
    */
   var getRandomArbitrary = function(min, max) {
       return Math.random() * (max - min) + min;
   }

   var chatAnimate = function()
   {
       // The available commands
       var items = ['spin', 'flip', 'shake', 'jump'];

       // Choose randomly an item of the items array
       // Source: https://stackoverflow.com/questions/5915096/get-random-item-from-javascript-array
       var item = items[Math.floor(Math.random()*items.length)];

       if (combine) {
           item = 'wacky' + item;
       }

       // Add text into the chatbox and focus it
       $('#chtbox').val('/' + item).focus();

       // Stop the event so that the pressed key won't be written into the chatbox!
       event.preventDefault();
   }

   window.addEventListener('mousedown', function(event)
   {
       if (event.button == startMouseButton) {
           chatAnimate();
       }
   });
   window.addEventListener('keydown', function(event)
   {
       if (event.keyCode == startKeyCode && ! event.shiftKey) {
           chatAnimate();
       }
   });
})();

  $('#chtbox').val('/' + item).focus();

error Line 51
Reply
#6
Oh no... Confused but what error?! There should be an error description, can you please copy and Paste it here as well? Idea
Reply
#7
(08-06-2019, 11:51 AM)samira Wrote: Oh no... Confused but what error?! There should be an error description, can you please copy and Paste it here as well? Idea

I am in mobile right now, sorry. But I will give you the error description tomorrow Smile
[-] The following 1 user Likes Lazaro's post:
  • samira
Reply
#8
(08-06-2019, 11:51 AM)samira Wrote: Oh no... Confused but what error?! There should be an error description, can you please copy and Paste it here as well? Idea

11:2 warning Unexpected unnamed function. (func-names)
25:3 warning Unexpected console statement. (no-console)
25:3 error 'console' is not defined. (no-undef)
31:9 error 'getRandomArbitrary' is assigned a value but never used. (no-unused-vars)
31:30 warning Unexpected unnamed function. (func-names)
35:23 warning Unexpected unnamed function. (func-names)
48:5 error '$' is not defined. (no-undef)
51:5 error Unexpected use of 'event'. (no-restricted-globals)
51:5 error 'event' is not defined. (no-undef)
54:3 error 'window' is not defined. (no-undef)
55:22 error Expected '===' and instead saw '=='. (eqeqeq)
59:3 error 'window' is not defined. (no-undef)
60:23 error Expected '===' and instead saw '=='. (eqeqeq)
[-] The following 1 user Likes Lazaro's post:
  • samira
Reply
#9
More than 250 installations so far Smile
[-] The following 1 user Likes samira's post:
  • Squirrel
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)