Extracting and enabling the console

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
seebs
Posts: 268
Joined: Sat Apr 14, 2012 8:58 pm

Extracting and enabling the console

Post 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!
Grale
Posts: 3
Joined: Mon Apr 16, 2012 6:07 pm

Re: Extracting and enabling the console

Post 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
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Extracting and enabling the console

Post 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.
seebs
Posts: 268
Joined: Sat Apr 14, 2012 8:58 pm

Re: Extracting and enabling the console

Post 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.
User avatar
Darklord
Posts: 2001
Joined: Sat Mar 03, 2012 12:44 pm
Location: England

Re: Extracting and enabling the console

Post 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.
A gently fried snail slice is absolutely delicious with a pat of butter...
sdweimer
Posts: 7
Joined: Sat Apr 21, 2012 3:40 am

Re: Extracting and enabling the console

Post 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.
shadmin
Posts: 7
Joined: Wed Apr 04, 2012 4:08 am

Re: Extracting and enabling the console

Post 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).
seebs
Posts: 268
Joined: Sat Apr 14, 2012 8:58 pm

Re: Extracting and enabling the console

Post 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.
User avatar
Darklord
Posts: 2001
Joined: Sat Mar 03, 2012 12:44 pm
Location: England

Re: Extracting and enabling the console

Post 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.
A gently fried snail slice is absolutely delicious with a pat of butter...
User avatar
Darklord
Posts: 2001
Joined: Sat Mar 03, 2012 12:44 pm
Location: England

Re: Extracting and enabling the console

Post 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.
A gently fried snail slice is absolutely delicious with a pat of butter...
Post Reply