Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Please read the forum rules before posting.



Check if you are posting in the correct category.



The Off Topic section is not meant for discussing Cookie Clicker.

Modding Cookie Clicker

TaimanderTaimander Posts: 1Member
edited March 2016 in General Discussion
Hello! I'm here to tell you about modding Cookie Clicker!

I just made a mod for cookie clicker that works really good!

But Im here to talk about how to make mods.

NOTE: You need to know or learn Javascript.

First of all, the game has a "Mod Loader" function, its " Game.LoadMod(url) ", it will download the file(js code) and run it.
But for debug and testing just copy and paste on the browser's console.

Now, some constants that you need to know to mod the game:

Mod Hooks:
Game.customChecks - Its an array, that updates every few seconds.
Game.customInit - Its an array, that's called on the initialization.
Game.customLogic - Its an array, that's called on the logic calls
Game.customDraw - Its an array, its called on draw calls.
Game.customSave - Its an array, its called on save(To save to you own localstore key)
Game.customLoad - Its an array, its called on load(Load your saves)
Game.customReset - Its an array, its called on reset(Reset your variables)
Game.customTickers - Its an array, its called on the random tickers(Should return a text array)
Game.customCps - Its an array, its called on CpS computation(return something to add to the multiplier)
Game.customCpsMult - Its an array, its called on CpS multiplicative computation (return something to add to the multiplier)
Game.customMouseCps - Its an array, its called on cookies earned per click computation.
Game.customCpsMult - Its an array, same as CpsMult but on cookies on click.
Game.customCookieClicks - Its an array, calls on cookie click.
Game.customCreate - To create your new upgrades and achievements here.

Game Objects:
Game.Objects[ 'OBJECT' ] :

replace OBJECT with the object you want to get, for example:
Game.Objects['Cursor'] will return the cursor object.

Now, what you can do with that object?
Game.Objects['Cursor'].price will return the price of the cursors.
Game.Objects['Farm'].buy() will buy a farm.

Game Variables:
Game.cookies - will return the number of cookies that you have.
Game.cookiesPs - will return the CpS.

And you can explore other variables on the source code, you can get it on orteil.dashnet.org/cookieclicker/main.js?v=2.0

Now, you remember the "Its an array" on the Mod Hooks? well, I'll explain you how to use them:

To use them, on your mod you have to replace the array to add new functions:

For example, we want to increment by 1 our var 123 every custom check:

Game.customChecks= [
function increment() {
xyz += 1;
}
]

Now, it will execute the increment() function every check.

As easy as that!

now lets make a real mod to show you!

NOTE: When using mods, remember to Game.Win('Third-party');

----------------------------------
Game.Win('Third-party'); // Give you the Third Party achievement

var myMod = {}; // Create our mod's class

myMod.init = function() { //Our initialization method

myMod.enabled = false; //This will allow us to control when we want to make our mod work.

//Add your variable and function declarations here

Game.customChecks = [//Add the event listener
function clickbcookie() {
Game.ClickCookie();//Click the cookie every check
}
]

myMod.enable = function() {//enable function
myMod.enabled = true;
}
}

myMod.init();//init the mod
myMod.enable();//enable the mod
----------------------------------

If you copy and paste this code into your console on the game, it'll click the cookie every check, and also will give you and achievement!

Now you can make your own mods!
Sign In or Register to comment.