From d39631665209cf905165fc25ba8d224086578297 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sat, 19 Jan 2008 08:58:18 -0800 Subject: [PATCH] Add a help command to lg-set --- lg-set.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lg-set.c b/lg-set.c index fa0e5dd..3a1a853 100644 --- a/lg-set.c +++ b/lg-set.c @@ -439,6 +439,25 @@ set_game_handle_set (set_game_t *game, deal (&game->deck, &game->board); } +static void +set_game_handle_help (set_game_t *game, + const char *peer) +{ + loudgame_sendf (&game->lg, peer, + "I'm a bot that allows you to play the game of SET.\n" + "Here are some commands I understand:\n" + "\tshow \tShow the current cards on the board\n" + "\thint \tIndicate how many sets are currently possible\n" + "\tshuffle \tReturn the cards to the deck, shuffle and deal\n" + "\t \t(this is only allowed if no sets are possible)\n" + "\tset X Y Z\tClaim three cards as a set. The cards are numbered\n" + "\t \tleft-to-right, and top-to-bottom from 0 to 12.\n" + "\n" + "For more information about SET, or to purchase your own deck, visit\n" + "http://setgame.com . Please note that this server is unaffiliated\n" + "with Set Enterprises, Inc., who publish the SET card game."); +} + static void set_game_handle_message (loudgame_t *lg, const char *peer, @@ -448,6 +467,8 @@ set_game_handle_message (loudgame_t *lg, if (strcmp (message, "show") == 0) set_game_handle_show (game, peer); + else if (strcmp (message, "help") == 0) + set_game_handle_help (game, peer); else if (strcmp (message, "hint") == 0) set_game_handle_hint (game, peer); else if (strcmp (message, "shuffle") == 0) @@ -455,7 +476,7 @@ set_game_handle_message (loudgame_t *lg, else if (strncmp (message, "set", 3) == 0) set_game_handle_set (game, peer, message + 3); else - loudgame_sendf (lg, peer, "Unknown command: '%s'", message); + loudgame_sendf (lg, peer, "Unknown command: '%s'. Use 'help' to get a list of valid commands.", message); } /* Begin a new game */ -- 2.43.0