Page 1 of 13

Extracting and enabling the console

Posted: Sat Apr 21, 2012 6:56 pm
by seebs
Edit by petri:

To enable the console all you have to do is to change/add the following lines to the config file at Documents/Almost Human/Legend of Grimrock/grimrock.cfg:

console = true
consoleKey = 192 --uses tilde as console key


-----------------------





As we've been nicely asked not to distribute the modified console.lua, but some people have been having trouble with the extraction and editing process:

I've taken the liberty of modifying the Python extractor someone posted here to do the following:

1. Extract Console.lua, and no other file.
2. Modify the console height from 10 lines to 42.
3. Modify the two instances of .developer. to .muteMusic., so an existing setting lets you toggle the console's availability.
4. Change the activation character to '~', since my keyboard doesn't have the one it originally had.
5. Remove the references to psyco, because it's unsupported and doesn't work with recentish Python.

http://www.seebs.net/tmp/grimrock_console.py

I've tested this very lightly, but it's offered without warranty. And most importantly, don't hassle the devs about issues with this; they are being pretty tolerant of our mucking about. To use this:

1. Make sure you have Python. I used the Python 2.7 from http://www.python.org.
2. Copy this file to your LoG game directory (the one containing grimrock.exe, NOT your save directory).
3. Open a shell in your LoG game directory.
4. Run the script. If you're clever and have mingw, this looks like /c/python27/python foo.py. If you are foolish and use the horrible, lame, Windows shell, this loooks like C:\Python27\python foo.py.

If you see:

found Console.lua
Modifying file...

and get your prompt back, you're set. Next time you start LoG, ~ should open the console.

And here's some handy stuff:

http://www.seebs.net/tmp/debug.lua

To use this:
1. Copy it to the LoG directory (again, the one containing grimrock.exe).
2. At the console, dofile('debug.lua')

It's not really documented, but for a quick starting point:

$ p = d.partymembers()
$ d.dump(p, 1)
$ d.bump_level(1)
$ d.bump_stat(1, 'strength', 99)

Go wild. Be aware that the console persists between game sessions, and if you keep references to old objects or mobs around, bad stuff can happen. So don't do that!

Re: Extracting and enabling the console

Posted: Sat Apr 21, 2012 7:14 pm
by Grale
Seebs, your a star. I've been pulling my hair out for two days tyring to get this to work!

I have chaged your script to change "developer" to "mouseLook" instead of "muteMusic" so i can keep the music+ambient sounds.

Thankyou :D

Re: Extracting and enabling the console

Posted: Sat Apr 21, 2012 7:34 pm
by petri
Please note that the console at its current state is meant to be used only by developers (that's why it can't be enabled without hacking). You can do some pretty nasty things with it. So obviously the standard disclaimer applies here: we don't take responsibility if you manage to wipe out your filesystem by executing a malicious script with it.

Re: Extracting and enabling the console

Posted: Sat Apr 21, 2012 7:44 pm
by seebs
petri wrote:Please note that the console at its current state is meant to be used only by developers (that's why it can't be enabled without hacking). You can do some pretty nasty things with it. So obviously the standard disclaimer applies here: we don't take responsibility if you manage to wipe out your filesystem by executing a malicious script with it.
Yes, absolutely.

I have found SO many cool ways to crash the game with it, too! You will note the suspicious absence of forum posts in which I complain about those as "bugs".

Mostly, the reason I'm pushing this is that while the console may be dangerous, I am much more concerned about the damage/risks of stuff like cheat programs and "trainers" which work by poking about directly in program memory. Here at least we can try to use the provided API.

Re: Extracting and enabling the console

Posted: Sat Apr 21, 2012 11:16 pm
by Darklord
Thanks for this, looks good I may give it a bash some time, I'm feeling to tired at the moment to start messing with Python and such! :lol:

Daniel.

Re: Extracting and enabling the console

Posted: Sun Apr 22, 2012 1:46 am
by sdweimer
Hey is there a step i'm missing here? Because when I used this tool it did everything it was supposed to except I cannot see the console for the life of me I have pressed shift+` and ` but so far no dice. If it helps I have the GOG version fully updated. I know its not guaranteed to work but hopefully with guidance I can get it to work.

Re: Extracting and enabling the console

Posted: Sun Apr 22, 2012 6:25 am
by shadmin
sdweimer wrote:Hey is there a step i'm missing here? Because when I used this tool it did everything it was supposed to except I cannot see the console for the life of me I have pressed shift+` and ` but so far no dice. If it helps I have the GOG version fully updated. I know its not guaranteed to work but hopefully with guidance I can get it to work.
FYI, as is, the script requires you to mute the music in order to use the console (correct me if I'm wrong guys).

Re: Extracting and enabling the console

Posted: Sun Apr 22, 2012 10:16 am
by seebs
shadmin wrote:
sdweimer wrote:Hey is there a step i'm missing here? Because when I used this tool it did everything it was supposed to except I cannot see the console for the life of me I have pressed shift+` and ` but so far no dice. If it helps I have the GOG version fully updated. I know its not guaranteed to work but hopefully with guidance I can get it to work.
FYI, as is, the script requires you to mute the music in order to use the console (correct me if I'm wrong guys).
That is correct. You could change it to use mouseLook instead of muteMusic; you just need a nine-letter thing which happens to be an option that can be set in the config file.

Re: Extracting and enabling the console

Posted: Sun Apr 22, 2012 6:21 pm
by Darklord
seebs wrote: 1. Make sure you have Python. I used the Python 2.7 from http://www.python.org.
Hmm there's loads of different versions, which is the correct one to do this for Windows 7 64bit? :?

EDIT: Alright I've gone for, Windows X86-64 MSI Installer (2.7.3) [1] (sig), lets see...

Daniel.

Re: Extracting and enabling the console

Posted: Sun Apr 22, 2012 6:32 pm
by Darklord
Hmm I've opened up Python, it seems similar to a dos prompt,

what does this mean?

3. Open a shell in your LoG game directory.

And how do you run the script?

4. Run the script. If you're clever and have mingw, this looks like /c/python27/python foo.py. If you are foolish and use the horrible, lame, Windows shell, this loooks like C:\Python27\python foo.py.

Do I need to open that file using the python prompt? This file doesn't seem to exsist, running the grimrock_console.py program would make more sense. :?

Daniel.