Objects with randomised names and/or descriptions

Here's a typical room definition (note that the class room is simply an object which has light, but also enables you to implement automatic two-way connections between places - although you may or may not want to use that in a maze…):

room dragonsden "Dragon's den"
  with description "A dangerous dragon lives here.",
  short_name "Gandor's End",
  n_to safety;

If you'd like the description and the name to be a little more varied, try something like:

room dragonsden "Dragon's den"
  with description [; print "A ";
    print (string) random("rogue sand",
      "used argon",
      "gored anus");
    print " ";
    print (string) random("on grad",
      "nag rod",
      "gondar",
      "ran dog");
    print " lives here.^"; rtrue;
  ],
  short_name [;
    print (string) random("Gandor's End",
      "Don gas nerd",
      "Nerd gonads",
      "Grand nodes",
      "End drags on",
      "Danger nods"); rtrue;
  ],
  n_to safety;

For a maze, you can even use the random() function in the n_to, se_to etc. declarations - then even the designer of the maze has no clue how to negotiate it…


Go up
Return to main index.