Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Use no more than 2 words

A topic by auraes created Sep 15, 2019 Views: 118 Replies: 3
Viewing posts 1 to 3
Submitted

Is it possible to know the number of words the player has entered? For in game with only verb and noun, it may be interesting to send him a message like "Use no more than 2 words", if he enters more than two words.

Submitted

It's okay to use more than two words so long as the extra words are adjectives describing the noun. For example, I have a sharp knife, so it's okay to say GET SHARP KNIFE. What you really need to test for is the use of pronouns (such as GET IN BOAT) and a second noun (such as STAB TROLL WITH SHARP KNIFE). I've noticed that even if you enter a second noun, it gets ignored, so maybe it doesn't matter.

I'd also like to know how to use multi-word input for further down the track.

Host

"in" and "with" would be prepositions (I think).\

Host

inputs() will give you the number of words entered.

My approach to this is to introduce a word limit in the settings to prevent this kind of issue.

In the meantime, you have inputs() to play with.

on_command {
   : if (inputs() > 2) {
      : print "This game only accepts a maximum of maximum of two words for its commands";       : done; // Stop execution    } }

There is a caveat. The local (per location) on_command {} handlers run first, so this must be added to each local handler, or each local handler must reference a subroutine first.

I'll also add a settings to configure subroutines to call before executing on_commands sometime soon, to make interceptors compatible with local handlers.