Recently, I have been playing Widelands. Well, cheating on its single player mode.

I code, therefore I cheat

I never like playing game's single-play mode if I don't cheat. The fun of playing is to cheat and beat the hell out of computer players.

It's actually not about cheating but more about coding if you need to find the address in save file. Though, there is usually cheatcode available, then you need to cheat with creativity.

Anyway, a week ago, I installed Widelands. After I looked into its save file. "Meh, they are binary!" I groaned. I read there is Lua embeded, so I decided to go using Lua.

I have tried to learn Lua about a year ago, but I didn't finish. Probably even before I learned its control flow. This time I did learn some from cheating on this game.

The release package doesn't have debug console, you need to download the repo. For that, I have to whine about how slow bzr is. I waited probably for an hour or even longer for bzr to clone the repo. Anyway, you compiled it with debug mode.

Once you enter the game and start a map, F6 is the start point to be a cheater. There is no command history , you can't use Up arrow key. So I found I can use dofile() and that's how this script comes

Save it to any filename you like to Wideland's directory. Bring up the console and type dofile('filename.lua'). There are some functions you can call:

  • w999() fills up your warehouses.
  • sw() 100 solders at max skill levels in your warehouses.
  • sm() maximal solders at max skill levels in your military sites.
  • ntns() no tree, no stones.
  • aspca() anti-space. Kills all wild animals.
  • fh() a helper function which calls functions above at once except sw().
  • blacksheepwall() Do you StarCraft?
  • blind() reverses the function above.
  • cq(plr, x, y, radius) conquer an area.
  • pb(plr, name, x, y) places a building.
  • rmim(x, y) removes something from the location.

Here is a list of problematic functions:

  • suicidalbob() removes other's bobs.
  • ghosttown() They all dead! They all dead!
  • controlfreak() You conquer whole map.

I was thinking some funny stuff like letenemiesdothehardwork() or burnbabyburn() or asteroid(). But I didn't start to write them.

The script isn't finished and it's not good. I only learned Lua for a few hours, what can you expect? I posted this because I don't want to play and cheat anymore, it's time to remove Wasteland. I meant Widelands, somehow I kept calling it by Wasteland for some time.

I don't think I will ever code in Lua again, it doesn't suit my taste. I just can't be used to that you can't compare two tables' contents simply by a == b, you need to do it by yourself. It doesn't have continue for a reason. That's what this language is, I am not complaining, just point out what I don't like.