Wherigo Creator

9. Data tables, quizzes and the Vigenère cipher

Create a data table

A data table is a small spreadsheet embedded in the cartridge: one row per item (a question, a hint, a stage…), one column per field. It is exported as Lua and works on every Wherigo player (Garmin, iPhone, Android, web player).

In the editor, open 🗃️ Data then “Add”. A “Question / Answer” table is offered; rename the columns, add more with + Column (12 maximum) and pick their type (text or number).

New data table

To enter many rows, prepare them in a spreadsheet and use 📥 Import a CSV: the first line holds the column names, the separator can be a semicolon, comma or tab. 📤 Export as CSV does the opposite.

Table filled from a CSV
Four questions imported from a CSV file (500 rows maximum per table).
💡 In an “Answer” cell, separate accepted answers with |: 3|three. In a “Choices” cell, the same syntax makes a multiple choice: Red|Blue|Green. An empty “Choices” cell = free answer.

Make a quiz

Add the 🎯 Quiz (questions from a table) action where the quiz should start (start, entering a zone, a character command…). Choose:

  • the table and its question, answer and optional choices columns;
  • the number of questions (0 = all) and random order to vary games;
  • the correct answers to pass and the variable receiving the score;
  • the If passed and Otherwise actions.
Quiz action settings

During the game each question shows its progress, the player answers, and the cartridge tells whether it was right (otherwise it shows the correct answer):

Quiz question in the player
Quiz passed

Case and surrounding spaces are ignored. Accents matter, as on GPS units: plan eglise|église if needed.

A quiz always has a solution

A quiz with no way out strands the player in the field. Check & export therefore checks every row used and refuses to export while:

  • a row has no question or no answer;
  • the correct answer is not among the offered choices;
  • the pass threshold exceeds the number of questions asked;
  • the table is empty, or a “Read a cell” targets a row that does not exist.
Impossible quiz reported

A warning also flags answers starting with an accented capital (“Église”): GPS units do not lowercase it, add the suggested alternative. The exported code is also guarded: an empty table, a missing row or a game restored in the middle of a quiz never crash the cartridge.

Read a cell, count rows

🗃️ Read a table cell copies a cell into a variable: random row (a random hint), fixed number, or number from a variable (current stage). #️⃣ Number of rows stores the row count in a variable.

From Lua (code level), each table is a list of rows: data_questions[2].reponse, and #data_questions gives the row count. The Lua name is shown at the top of the table.

Vigenère cipher

The 🔐 Vigenère cipher action encrypts or decrypts a text (fixed or from a variable) with a key (fixed or entered by the player) and stores the result in a variable. Classic scenario: the player finds the key in the field, types it in a question, and the cartridge decrypts the next hint.

To get the key typed by the player into a variable, open the question and choose “Store the answer in”: the answer is copied into the variable before the question’s actions.

Vigenère action with test
The 🧪 area lets you try it immediately (with a test key when the key comes from a variable); “Prepare an encrypted message” encrypts your text with the fixed key and copies it.

Accents do not count

  • Accents are removed from the key and the text before encryption: “géocache” = “geocache” = “GEOCACHE”, “ç” = “c”, “œ” = “oe”, “ß” = “ss”. A player typing the key with or without accents gets the same result.
  • Only letters A to Z are then encrypted, case is kept; digits, spaces and punctuation stay as they are without consuming the key.
  • Consequence: a text encrypted then decrypted comes back without its accents.
⚠️ Plan for it from the start. The editor shows it on the action, and Check & export warns when a fixed key or text contains accents. Also tell players in the question that they can type the key without accents.

On the player side, if the entry contained accents the cartridge warns them and shows the key actually used, then carries on. This warning can be turned off (“Warn the player…” box), but the check reports it.

Player warning

From Lua: _wc_vigenere(text, key, true) decrypts, false encrypts; _wc_noacc(text) removes accents.