Sha256: b2c6af1073dc3bfa99a8e21bc701274d221f690f45ccedfaf2824da6be4be1d9

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

Gamefic.script do
  meta nil, Gamefic::Query::Text.new do |actor, string|
    words = string.split_words
    list = verbs
    if list.include?(words[0])
      if words.length > 1
        found = Gamefic::Query::Available.new.resolve(actor, words[1..-1].join(' ')).objects
        if found.empty?
          actor.tell %(I recognize "#{words[0]}" as a verb but could not understand the rest of your sentence.)
        elsif found.one?
          actor.tell %(I recognize "#{words[0]}" and "#{found.first.name}" but could not understand them together.)
        else
          actor.tell %(I'm not sure if "#{words[1..-1].join(' ')}" means #{found.map(&:definitely).join_or}.)
        end
      else
        actor.tell %(I recognize "#{words[0]}" as a verb but could not understand it in this context.)
      end
    else
      actor.tell %(I don't recognize "#{words[0]}" as a verb.)
    end
  end

  meta nil, Gamefic::Query::Text.new(/^it$/) do |actor, string|
    words = string.split_words
    if verbs(to_s: true).include?(words[0])
      actor.tell "I'm not sure what you mean by \"it.\""
    else
      actor.proceed
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamefic-standard-2.1.0 lib/gamefic-standard/actions/nil.rb