[I7] Using Kinds of Actions?

Is there a way for me to use the name of a kind of action instead of a specific action in the following way:

Instead of doing something other than kindofaction: say "You can't do that."

It produces an error for me, though it seems like something there should be a way to do.

Try this:

Waiting is allowed.
Looking is allowed.

Before doing something when the current action is not allowed, instead say “You can’t do that.”[/code]

1 Like

Thanks, Felix. That works perfectly. I don’t know why I didn’t think of using “current action”.


Instead of doing something when not kindofaction:

One thing that might help you work out the syntax here is to name your kinds of action participial phrases like “behaving irresponsibly” and “committing a crime” rather than noun phrases like “irresponsible behavior” or “criminal acts.” (The examples in the documentation have noun phrases, though.) That can help make sense of some of the formulations that work:

[code]Instead of behaving irresponsibly:

After committing a crime:

Instead of doing something when not behaving permissibly:

After an actor misbehaving:[/code]

(That last one got me here; “After an actor prohibited behavior” doesn’t sound like it makes sense, but “After an actor misbehaving” would.)

This isn’t a failsafe guide – it doesn’t explain why “Instead of doing something other than behaving permissibly” doesn’t compile – but it does look to me as though it makes your code look more natural when it does compile.

Thanks for the tip, matt. I can see how that would help a lot with fitting kinds of action into the accepted syntax. I’ll do that. :slight_smile:

That’s awesome, matt! I hadn’t found a really satisfactory way to name these things before.