Questioning the player. *RESOLVED* Thanks!

I’m wanting to set up a game where the main character has a name and a hair color etc. But I’m wanting to have the player make these decisions. The problem is I’m not sure how to set it up. I know how to assign values to the “me actor” but I can’t figure out how to have the game ask for a name before play starts. (You know The computer goes “Enter name” and you type a name…) I’ve been looking through the manuals for a while now and… I’m at a loss. Please forgive me if I’ve missed something obvious. I need to know how to have a function run at start time AND how to direct player input to a variable. I know that is sort of two questions… sorry about that.

Thanks in advance for any help.

  • Selva :smiley:

I’ve read somewhere in the help files about being able to do that, I honestly haven’t a clue how to actually do it but from flicking through the help files I found the ‘Some Common Input/Output Issues’ page in the tads 3 Technical Manual, it’s got in there about pausing the screen mid text; the inputManager and captureOutput and a few other bits that might be useful like clearing the screen and such.

As for asking on start game I’m not sure… Maybe put a function in the showIntro() that would give the player the options straight off if you could do it that way… Actually off the top of my head that sounds like the easiest way but I’m not the one to ask on either of those things <>

Hope it helps any how :slight_smile:

Here’s a basic example.

gameMain: GameMainDef
	initialPlayerChar = me

	showIntro() {
		"What's your name? ";
		local name = inputManager.getInputLine(nil, nil);
		"<p>Hi, <<name>>. It's nice to meet you.<.p> ";
		me.setName(name);
	}
;

me: Person
	desc = "You're the same as always, <<myName>>. "

	setName(str) {
		myName = str;
	}

	myName = 'Joe'
;

:smiley: :smiley: :smiley: Thanks to both of you. bcressey, that works perfectly. Much appreciated. :smiley: :smiley: :smiley: