[Gruescript] How to activate or deactivate easily cverbs

So… I would like that one could just “Activate verb” or “deactivate verb”.

I think I understand that right now, to activate a verb one must use the block setverb, and depending if the block return true, then the verb in question is activated. I mean, activating verbs depends on the world state, instead of a direct command to activate or deactivate them. Am I right?

Sometimes is difficult to wrap my brain around that (the same happens with the management of scenes in inform 7, you just can’t say something like End this scene now).

Anyway, a good trick to have something like that is to assign an arbitrary tag to the task, so you can just tag or untag it, and that will launch the activation or deactivation of the verb. For example:

verb taste water
say Very salty.
tag water onDrink

verb drink water
say Drinking saltwater is really bad idea.
untag water onDrink

setverb drink water
has water onDrink

So, if needed, I can activate the verb just using the direct command tag water onDrink

Anyway, I’m interested to know if there is a more direct way to do that.

Regards.

2 Likes

Yes, that is the right way to do it (as I envisaged it, anyway.) If you tie a setverb to a tag, as you have done, you can easily “switch” the verb by tagging/untagging any thing. If you have several conditionally-drinkable things and don’t want to make an individual setverb for each, you can use the contextual variable this:

setverb drink
has $this onDrink

If you want the verb to behave as a cverb (i.e. only activate when carried, subject to whatever condition you want), include a carried assertion in your setverb:

setverb eat
carried $this
has $this edible

then you can tag/untag foo edible to toggle the “eat” verb for foo, but only when foo is in inventory (that includes held or worn).

1 Like