TADS 3 RPG development

OK for the life of me I can’t find anything in the TADS libraries about creating a system for character customization. I want a system that lets players use their own name and create a specific look for a character as well as choose perks that affect certain things. Does anyone know how to do this.

You can ask the player for a name, use a StringPreParser to grab the name, and assign it to the player character in various ways, depending on how you want to use it – assigning the input to the name property, for example. For the other properties, you’ll probably want to give the player a list of choices – wizard, warrior, sage, whatever. For that, a menu-based input system would probably work.

I’m not aware of any set of pre-configured methods for doing this type of thing. You’ll have to roll your own. But possibly those suggestions will help get you started.

what would be a simple way to code the string preparser. I’m still a bit new to the system so i don’t completely understand it.

Well, you’re kind of jumping into the deep end of the pool here, trying to set up an RPG with player input on character creation. If I were to try to write some code for you, it would be a lot of work (because I’ve never actually tried that), and it might not end up being what you wanted.

Question: Have you done any programming in another language (such as C++ or Javascript)? If not, then I’d suggest that you work your way through some of the tutorials in the TADS author package before tackling any RPG programming. The examples in the tutorials may not be exactly the type of game you’d like to create, but they will familiarize you with TADS programming, at which point any explanation that I (or more likely, Eric) give you will make a lot more sense.

If you’re familiar with the basics of programming, then I’d suggest that you open the Library Reference Manual. Click on “all symbols” in the top banner, click on the letter S in the lower left pane, and scroll down until you see StringPreParser. Click on that. In the page that comes up, click on the line link on the upper right (probably [844]). This will take you to the source code file where the StringPreParser class is defined. If you study this code, you’ll see a method called doParsing. This is the method you need to override in your own StringPreParser object.

Beyond that, I would have to spend an hour or two tinkering with it to give you any sensible information, because I’ve never used StringPreParser.

Depending on exactly what you want to do, StringPreParser might be overkill. For simple input, like requesting the player character’s name, you can use inputManager.getInputLine (you can look up how to use it in the documentation, but it’s quite straightforward).

But we really need more specifics if we’re going to help you more. For instance, with the PC’s appearance, are you imagining the game asks things like “What colour is your hair?” and then X ME reflects the player’s answer: “You are a bold adventurer with pink hair”? Will there be a finite list of hair colours to choose from or can the player type anything? What kind of perks do you want? Are they number-based stats, like “STR 14”? Are they named traits that give specific bonuses, like “Pickpocket: You can steal small objects from NPCs”?

A good way to start is by writing out a sample transcript from your game, showing how you want the character creation process to work. Once you’ve clarified how you want a system to work, it’s usually much easier to see where to start with coding it. After that, break it down into smaller tasks, like “ask the player to name the main character”, and start with the one that looks easiest (you can always go back and put in extra steps later). It’s also easier for us to help you if you come to us with a smaller, more specific task that you’re trying to achieve, and show us what code you’ve tried so far.

The menu based idea from Jim is probably best if you aren’t familiar with TADS. If you’re working with adv3lite, do something like this:

heroMenu: MenuItem ‘Build your Hero’;

  • MenuItem ‘Choose Your Character’;

++ MenuLongTopicItem ‘Knight’
menuContents() {

++ MenuLongTopicItem ‘Thief’
menuContents () {

I didn’t test this code so it may be wrong. See Optional Modules in the adv3lite library manual for more, here:
dl.dropboxusercontent.com/u/583 … l/menu.htm

Sorry for taking so long to respond but here is a basic idea for what the character creation will be like.

what is your name
input name
X what a lovely name

Body type

and the menu system repeats for the rest of the options after name.

So, I think the way I’d go is something like:

/* create player character from input */
buildPlayerChar() {

    /* player character internally is usually called me */
    "What is your name?<.p>";
    me.playerName = inputManager.getInputLine(nil, nil);  
    "That's a lovely name, <<me.playerName>>.<.p>";


/* create menu object, called above */
heroMenu: MenuItem 'Build your Hero';
   + MenuItem 'Choose Your Character';

      ++ MenuLongTopicItem 'Knight'
         menuContents() {

      ++ MenuLongTopicItem 'Thief'
         menuContents () {

This gives you the ability to use TADS built in menu system, which gives you choices onscreen from 1-9. You can make as many menus as you want, and display them programmatically by calling the display() method, as shown above when buildPlayerChar() calls heroMenu.display(); at the end.