# frozen_string_literal: true module Gamefic module Standard script do respond :verbs do |actor| list = rulebook.synonyms.reject { |syn| syn.to_s.start_with?('_') } .map { |syn| "#{syn}"} .join_and actor.tell "I understand the following commands: #{list}." actor.tell "Try using commands in plain sentences like go north or take the coin." actor.tell "For more information about a specific command, try help [command], e.g., help go." end interpret 'commands', 'verbs' interpret 'help', 'verbs' respond :help, plaintext do |actor, command| if rulebook.synonyms.include?(command.to_sym) && !command.start_with?('_') available = rulebook.syntaxes.select { |syntax| syntax.synonym == command.to_sym } .uniq(&:signature) examples = available.map(&:template) .map do |tmpl| tmpl.text .gsub(/:character/i, '[someone]') .gsub(/:var[0-9]?/i, '[something]') .gsub(/:([a-z0-9]+)/i, "[\\1]") end .reject { |tmpl| tmpl.include?('[something] [something]') } actor.tell 'Examples:' actor.stream '