Sha256: 02404a4374575c0764ccbae9761609d26c0f4399e87fac097a58ae41ce67d267

Contents?: true

Size: 804 Bytes

Versions: 1

Compression:

Stored size: 804 Bytes

Contents

respond nil, Query::Text.new() do |actor, string|
  words = string.split_words
  if commandwords.include?(words[0])
    if words.length > 1
      actor.tell "I recognize '#{words[0]}' as a verb but could not understand the rest of your sentence."
    else
      actor.tell "I recognize '#{words[0]}' as a verb but could not understand it in this context."
    end
  else
    found = []
    commandwords.each { |c|
      if c.length > words[0].length and c.start_with?(words[0])
        found.push c
      end
    }
    if found.length == 1
      words[0] = found[0]
      actor.perform words.join(' ')
    elsif found.length > 1
      actor.tell "I'm not sure if #{words[0]} means #{found.join_and(', ', ' or ')}."
    else
      actor.tell "I don't know what you mean by '#{string}.'"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamefic-0.2.0 lib/gamefic/import/basics/actions/nil.rb