More efficient way to create commands and their prereqs?

There has to be a more efficient way to go about this than the monstrosity I’ve created. Background info: since my game is geared towards new players, I want the commands to be as intuitive as possible. Thus what would normally be two separate actions (writing with a pen on a notepad/attacking someone with what is essentially a chloroform rag) are both under USE to reduce confusion (use pen on notepad and use towel on person, respectively). I’ve tested both the pen/notepad and towel/person parts separately and they both work, but I haven’t yet tested this combined version. The problem is that I can’t figure out how to split it up into something a bit more legible and clear. I feel like there has to be a better way to go about this!

Check using something on something:
	if the second noun is drawn:
		say "You step back and admire your handiwork.";
		stop the action;
	if the noun is not a pen or the noun is not a towel and the second noun is not a notebook or the second noun is not a person:
		say "You can't do that";
		stop the action;
	if the noun is a pen and the second noun is not a notebook:
		say "You can't write on that.";
		stop the action;
	if the noun is not a pen and the second noun is a notebook:
		say "You can't write with that.";
		stop the action;
	if the noun is a towel and the second noun is not a person:
		say "There are better things you can do with that.";
		stop the action;
	if the noun is not a towel and the second noun is a person:
		say "That didn't make sense.";
		stop the action;
	if the noun is a towel:
		if the towel is toxic:
			if the second noun is asleep:
				say "[regarding the second noun] [They] [are] already asleep.";
				stop the action;
			if the second noun is awake:
				continue the action;	
		if the towel is stained:
			if the second noun is awake:
				say "'For some unfathomable reason, [regarding the second noun][they] don't seem interested in your coffee-stained towel.'";
				stop the action;
	if the noun is a pen and the second noun is an undrawn notebook:
		if the player is not holding the noun:
			now the player is holding the noun;
			say "(first taking the quill)[paragraph break]";
		continue the action.

Carry out using something on something:
	if the noun is a pen:
		if the second noun is 2B notepad:
			say "You scribble a bunch of dicks.";
		if the second noun is 2D notepad:
			say "You scribble a bunch of hearts.";
		if the second noun is Izzy's notepad:
			if Izzy's notepad is unexamined:
				try examining Izzy's notepad;
				say "You gently sketch over the indentations with the quill, revealing the words you scratched out earlier this morning—the last item on your shopping list: 

[italic type]Apology gift for Edward[roman type][paragraph break]You update your [bold type]shopping list[roman type] accordingly.[paragraph break]";
				now the second noun is drawn;
				stop the action;
	if the noun is a towel and the second noun is a person:
		if the towel is dry:
			say "'[regarding the second noun]You meekly towel [their] head off, but this produces no effects save confusion on both sides.'";
		if the towel is wet:
			if the towel is clear and the towel is nontoxic:
				say "'In an utterly bewildering move, you gently clean [regarding the second noun][their] face with the moist hand towel.'";
			if the towel is toxic:
				say "'They fall asleep near-instantly. You don't even have time to apologize before [regarding the second noun][their] eyes are falling shut, head tucking into [their] chin.'";
				now the second noun is asleep;
			if the towel is stained:
				say "'That was a great nap!'";
				now the second noun is awake;

USE is generally not used because it is so broad. If you use USE for two actions, players may try to use them for all the actions, and it likely would be more confusing.

There is already an ATTACK verb to use, and you can implement a WRITE verb fairly easily. Since you implemented a USE already, I’m assuming you know how to do this well enough. This will also make your code more legible.

3 Likes

Yeah - the (well, a) trouble with USE is that you’re basically ripping out a bunch of the actions created by the Standard Rules and reimplementing them in a single action. So it’s likely to be messy. There are ways to mitigate this - for example, you can try to leverage the existing actions via stuff like “understand “use [key] on [door]” as unlocking it with (with nouns reversed).” You could also break up your rules with more specific headers: “check using when the noun is the towel”, that sort of thing.

Ultimately though this approach is going to be harder both to write, and to debug, than the more standard way of doing things - and given that, it might not wind up being as accessible as all that. Maybe you might want to think about doing a limited-parser interface, where you use only a few verbs and tell the player exactly which ones the parser will understand (perhaps via a VERBS command)? There are a lot of really strong, newbie-friendly games that do that.

3 Likes

Yeah, I was fearing I’d have to split it up into two parts. I was kind of hoping to have a catch-all verb for everything just cause my audience is so new to text adventures and IF that I want to keep the guessing and remembering to a bare minimum, but if I have enough signposting, it’ll probably be okay. For the towels, I think I’ll have to think of a non-ATTACK verb since I have a swordfighting mechanic taking that one up! Maybe uh. SMOTHER or ACCOST something lol.

Ah, breaking it into headers is a good idea! But yeah, I did a few test runs and it’s already a bit messy. Splitting it up into two commands will probably be for the best. And a VERBS command is a good idea! Most of them are covered in the tutorial (thank you Emily Short for all of the extensions) and I made sure to cue a few specialty verbs as well, but having an easy way to be reminded of them is good.

1 Like