Last active
April 20, 2020 04:33
-
-
Save ZebTheWizard/64f18a97b7542de8432092b193b885e2 to your computer and use it in GitHub Desktop.
A simple javascript function that automatically collects loot on twitch streams.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// COPY AND PASTE ONE OF THE OTHER. | |
// THE SCRIPT WILL START AUTOMATICALLY. | |
// USE autoLoot.stop() to stop the script. | |
// USE autoLoot.every(insertTimeHere) to set how often the script executes. | |
// USE autoLoot.start() to start the script. | |
// MINIFIED VERSION | |
Object.assign(window,{l:console.log,r:console.clear,autoLoot:{i:null,t:5* 1e3,c:0,every:function(t){this.t=t},_c:function(){r(),this.c+=1;try{document.querySelector(".tw-button.tw-button--success.tw-interactive").click(),l(`ATTEMPT ${this.c}: LOOT FOUND!!`)}catch(t){l(`ATTEMPT ${this.c}: no loot`)}},start:function(){if(this.i)return l("Already started. Run autoLoot.stop() to stop.");r(),l("STARTING AUTO LOOT SCRIPT\n================="),this._c(),this.i=setInterval(this._c.bind(this),this.t)},stop:function(){if(!this.i)return l("Already stopped. Run autoLoot.start() to start.");l("STOPPED AUTO LOOT SCRIPT\n================="),this.i=clearInterval(this.i)}}}).autoLoot.start(); | |
// RAW VERSION | |
(Object.assign(window, { | |
l: console.log, | |
r: console.clear, | |
autoLoot: { | |
i: null, | |
t: 1000 * 5, | |
c: 0, | |
every: function (ms) { | |
this.t = ms | |
}, | |
_c: function () { | |
r(); | |
this.c += 1; | |
try { | |
document | |
.querySelector(".tw-button.tw-button--success.tw-interactive") | |
.click(); | |
l(`ATTEMPT ${this.c}: LOOT FOUND!!`); | |
} catch (err) { | |
l(`ATTEMPT ${this.c}: no loot`); | |
} | |
}, | |
start: function () { | |
if (this.i) return l("Already started. Run autoLoot.stop() to stop."); | |
r(); | |
l('STARTING AUTO LOOT SCRIPT\n================='); | |
this._c(); | |
this.i = setInterval(this._c.bind(this), this.t); | |
}, | |
stop: function () { | |
if (!this.i) return l("Already stopped. Run autoLoot.start() to start."); | |
l('STOPPED AUTO LOOT SCRIPT\n================='); | |
this.i = clearInterval(this.i); | |
} | |
} | |
})).autoLoot.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment