Just because OpenOffice.org Basic is designed to automate mundane tasks doesn't mean that you must use it only for serious work. It's a programming language after all, and nothing stops you from using it to write something fun. Today we'll use it write a simple game where you have to guess a word, a letter at a time, from among words you've stored in a Base database. Although this is not a particularly sophisticated game, it contains a couple of string manipulation techniques and a clever trick for picking a random record from a database, which you might find useful when writing your own macros.
Before you start coding the game, you have to create a simple Base database (let's call it "WordDB") with a table called "wordlist" containing two fields: the "ID" integer field that acts as a primary key, and the "Word" text field used for storing words. Populate the database with the words you want to use in the game.
With the database in place, you are ready to get to work. You can connect to the database with three lines of code: