module Gamefic::Scriptable::Queries

Scriptable methods related to creating action queries.

Public Instance Methods

abstract(*args, ambiguous: false) click to toggle source

Define a query that searches for abstract entities.

An abstract entity is a pseudo-entity that is describable but does not have a parent or children.

@param args [Array<Object>] Query arguments @return [Query::Abstract]

# File lib/gamefic/scriptable/queries.rb, line 25
def abstract *args, ambiguous: false
  Query::Abstract.new -> { entities }, *args, ambiguous: ambiguous
end
anywhere(*args, ambiguous: false) click to toggle source

Define a query that searches the entire plot’s entities.

@param args [Array<Object>] Query arguments @return [Query::General]

# File lib/gamefic/scriptable/queries.rb, line 14
def anywhere *args, ambiguous: false
  Query::General.new -> { entities }, *args, ambiguous: ambiguous, name: 'anywhere'
end
available(*args, ambiguous: false) click to toggle source

Define a query that searches an actor’s family of entities. The results include the parent, siblings, children, and accessible descendants of siblings and children.

@param args [Array<Object>] Query arguments @return [Query::Scoped]

# File lib/gamefic/scriptable/queries.rb, line 35
def available *args, ambiguous: false
  Query::Scoped.new Scope::Family, *args, ambiguous: ambiguous, name: 'available'
end
Also aliased as: family
children(*args, ambiguous: false) click to toggle source

Define a query that searches an actor’s children.

@param args [Array<Object>] Query arguments @return [Query::Scoped]

# File lib/gamefic/scriptable/queries.rb, line 52
def children *args, ambiguous: false
  Query::Scoped.new Scope::Children, *args, ambiguous: ambiguous, name: 'children'
end
descendants(*args, ambiguous: false) click to toggle source

Define a query that searches an actor’s descendants.

@param args [Array<Object>] Query arguments @return [Query::Scoped]

# File lib/gamefic/scriptable/queries.rb, line 60
def descendants *args, ambiguous: false
  Query::Scoped.new Scope::Descendants, *args, ambiguous: ambiguous
end
family(*args, ambiguous: false)
Alias for: available
myself(*args, ambiguous: false) click to toggle source

Define a query that returns the actor itself.

@param args [Array<Object>] Query arguments @return [Query::Scoped]

# File lib/gamefic/scriptable/queries.rb, line 76
def myself *args, ambiguous: false
  Query::Scoped.new Scope::Myself, *args, ambiguous: ambiguous, name: 'myself'
end
parent(*args, ambiguous: false) click to toggle source

Define a query that returns the actor’s parent.

@param args [Array<Object>] Query arguments @return [Query::Scoped]

# File lib/gamefic/scriptable/queries.rb, line 44
def parent *args, ambiguous: false
  Query::Scoped.new Scope::Parent, *args, ambiguous: ambiguous, name: 'parent'
end
plaintext(arg = /.*/) click to toggle source

Define a query that performs a plaintext search. It can take a String or a RegExp as an argument. If no argument is provided, it will match any text it finds in the command. A successful query returns the corresponding text instead of an entity.

@param arg [String, Regexp] The string or regular expression to match @return [Query::Text]

# File lib/gamefic/scriptable/queries.rb, line 87
def plaintext arg = /.*/
  Query::Text.new arg, name: 'plaintext'
end
siblings(*args, ambiguous: false) click to toggle source

Define a query that searches an actor’s siblings.

@param args [Array<Object>] Query arguments @return [Query::Scoped]

# File lib/gamefic/scriptable/queries.rb, line 68
def siblings *args, ambiguous: false
  Query::Scoped.new Scope::Siblings, *args, ambiguous: ambiguous, name: 'siblings'
end