xzfc / agar-expose

Yet another ogar client
12 stars 12 forks source link

Example, Add a kawaii face to viruses #7

Closed aaxxo closed 8 years ago

aaxxo commented 8 years ago

I may be missing the obvious, but where do I run this code?

image.crossOrigin = 'anonymous';
image.src = 'http://i.imgur.com/V8EOXwT.png';
window.agar.hooks.cellSkin = function(cell, old_skin) {
if (old_skin) return old_skin;
if (cell.isVirus) return image;
return null;
}

I want to have it in a custom main_out.js file but I get

Cannot read property 'hooks' of undefined
xzfc commented 8 years ago

Paste it into the browser console.

SJMakin commented 8 years ago

Or you could put in in to a userscript! Example:

// ==UserScript== // @name VirusMod // @namespace VirusMod // @include http://agar.io/ // @include https://agar.io/ // @version 0.01 // @grant none // @author xzfc@Github // ==/UserScript==

image = new Image(); image.crossOrigin = 'anonymous'; image.src = 'http://i.imgur.com/V8EOXwT.png'; window.agar.hooks.cellSkin = function(cell, old_skin) { if (old_skin) return old_skin; if (cell.isVirus) return image; return null; }

aaxxo commented 8 years ago

Thanks :) In future I will maybe try to include agar-expose in the cusotm client so other people can see the kawaii face :+1: