PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: Eck on 08 January, 2005, 16:48:52

Title: Maze game
Post by: Eck on 08 January, 2005, 16:48:52
This is my first go at a script so be gentle ;)

For some reason it works fine in one of my hubs, but not the other (could be because other running bots are interfering - dunno). Anyway, each 'room' in the maze is like a private room where you can chat to others. The default maze only has 20 rooms, but theoretically theres no limit to how many there can be, just alter/add to the "maze.map" file.

Start by sending a PM to the bot and move around by typing north, south, east or west (or N n e S etc. - its pretty forgiving)

Scoring isnt yet implemented - hopefully by the next release. Any feedback or bug reports appreciated as Ive only tested it with 3 users in the maze at any one time!

Also, if anyone can come up with a better maze file id appreciate that too. And how do you send a \n character in lua? Havent figured that out yet :/

Download it http://ecksbedroom.servebeer.com/files/maze.zip
Title:
Post by: Herodes on 08 January, 2005, 20:27:34
The manual says (http://www.lua.org/manual/4.0/manual.html) ...
Literal strings can be delimited by matching single or double quotes, and can contain the C-like escape sequences `\a' (bell), `\b' (backspace), `\f' (form feed), `\n' (newline), `\r' (carriage return), `\t' (horizontal tab), `\v' (vertical tab), `\\' (backslash), `\"' (double quote), `\'' (single quote), and `\newline' (that is, a backslash followed by a real newline, which results in a newline in the string). A character in a string may also be specified by its numerical value, through the escape sequence `\ddd', where ddd is a sequence of up to three decimal digits. Strings in Lua may contain any 8-bit value, including embedded zeros, which can be specified as `\000'.

basically you can do a tab char by '\t' and a '\r\n' for a new line ...