454
edits
m (formatting) |
m (Loading Scripts formatting) |
||
Line 13: | Line 13: | ||
How to use console commands, scripts, and extensions on Steam. | How to use console commands, scripts, and extensions on Steam. | ||
==Setup== | ===Setup=== | ||
You only have to do this once. | You only have to do this once. | ||
# Download Melvor Idle on Steam, and find the installation directory [...]/steamapps/common/Melvor Idle | # Download Melvor Idle on Steam, and find the installation directory. e.g. [...]/steamapps/common/Melvor Idle | ||
# Download the 0.49.2 version of NW.js SDK. The version might change in the future, but you need the specific one listed. | # Download the 0.49.2 version of NW.js SDK. The version might change in the future, but you need the specific one listed. | ||
#* 64bit Windows: https://dl.nwjs.io/v0.49.2/nwjs-sdk-v0.49.2-win-x64.zip | #* 64bit Windows: https://dl.nwjs.io/v0.49.2/nwjs-sdk-v0.49.2-win-x64.zip | ||
Line 29: | Line 29: | ||
# Place the contents of the nwjs-sdk* directory in the Melvor Idle installation directory. | # Place the contents of the nwjs-sdk* directory in the Melvor Idle installation directory. | ||
# Place the icons, styles, and source (i.e. scripts or sources) directories of the extracted extensions in the Melvor Idle installation directory. | # Place the icons, styles, and source (i.e. scripts or sources) directories of the extracted extensions in the Melvor Idle installation directory. | ||
== | ===Loading Scripts=== | ||
( | Loading scripts must be run every time the game is opened on Steam. | ||
<ol> | |||
<li>Open the game and load a character.</li> | |||
<li>Open the dev tools console (F12).</li> | |||
<li>Set the context of the console to game.</li> | |||
<ul> | |||
<li>The top left of the console has a dropdown: change it from top to game (steam.melvoridle.com). After doing this, you can use the console.</li> | |||
</ul> | |||
<li>Load the scripts and extensions you placed in the installation directory before.</li> | |||
<ul> | |||
<li>You can load SEMI like this:</li> | |||
<pre>require('fs').readFile('scripts/SEMI.js', 'utf8', (err, data) => {eval(data);}) | |||
$(document.head).append(`<link rel="stylesheet" href="${chrome.runtime.getURL('styles/semi.css')}">`)</pre> | |||
<li>You can load the Combat Simulator like this:</li> | |||
<pre>require('fs').readFile('sources/contentScript.js', 'utf8', (err, data) => {eval(data);}) | |||
$(document.head).append(`<link rel="stylesheet" href="${chrome.runtime.getURL('styles/mainStyle.css')}">`)</pre> | |||
<li>You can load user scripts like this, by changing the file name:</li> | |||
<pre>require('fs').readFile('relativePathToMyReallyCoolScript.js', 'utf8', (err, data) => {eval(data);})</pre> | |||
</ul> | |||
</ol> | |||
===Alternate Variation=== | |||
The following variant results in a cleaner directory without potential file name clashes. Note that the above does not clash for Combat Simulator + SEMI at the moment. | |||
The (cleaner) way I do it mainly differs in the target location of steps (4) and (5) : I made a directory Extensions in the Melvor Idle installation directory, in which I made new directories for the extensions and scripts: | The (cleaner) way I do it mainly differs in the target location of steps (4) and (5) : I made a directory Extensions in the Melvor Idle installation directory, in which I made new directories for the extensions and scripts: | ||
Line 97: | Line 106: | ||
==Auto-loading Scripts in Steam== | ==Auto-loading Scripts in Steam== | ||
# Create a .js file in the Melvor Idle directory. | |||
# Set the contents of the .js file | |||
setTimeout(function(){ | |||
setTimeout(function(){ | /*insert all of the commands you would normally put in the console to load your scripts*/ | ||
/*insert all of the commands you would normally put in the console to load your scripts*/ | }, 15000); | ||
}, 15000); | /* the 15000 is just to give the game 15 seconds to get up and running, it doesn't seem to matter if it fires on the character screen or once you load a character.*/ | ||
# Add the following code to the parameters of package.json | |||
"inject_js_end": "pathToYourFile/yourFileName.js" | |||
{{Menu}} | {{Menu}} | ||
[[Category:Guides]] | [[Category:Guides]] |
edits