Outputting random text replies for a command - TADS3.1

Yes, the pest is back. When I enter a command, I would like to have random text replies returned. This is especially true for commands that fail and many other commands and/or actions. Would like some information where to find out how to do this. Thanks, in advance.

A lot depends on the command, and on why it fails, but the tool you’ll end up using is probably a ShuffledEventList. Very handy class.

Can you be more specific about what command(s) you’re talking about?

Excerpting from your backpack code:

	dobjFor(Take) {
		action() {
			"<<one of>>
			You sling the pack over your shoulders. <<or>>
			You heave the pack off the ground. <<or>>
			You manage to lift the heavy pack. 
			<<at random>>";

(Documented here: String Literals.)

Commands can fail in lots of ways and with lots of different messages. Unless you are prepared to do a huge amount of work, or strictly limit the range of permitted actions, you should focus on customizing successful commands first, and then tackle misleading or inappropriate failure messages.

If you have a specific failure message you want to change or randomize, post it and I can help. The general case is too broad to address in a forum post.

Thanks for the help. That’s really all I need for right now. However, I’ll surely be back with more questions.