play

package
v0.24.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2024 License: BSD-3-Clause Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeGrammar

func MakeGrammar(db *sql.DB) (ret parser.Scanner, err error)

fix: domains: rebuild on domain changes, or: add a special "AllOf" that does a db query / cache implicitly? add scanners which check the database domain?

Types

type Noun

type Noun struct {
	// contains filtered or unexported fields
}

these are created by the survey

func MakeNoun

func MakeNoun(run rt.Runtime, name string) *Noun

func (*Noun) HasAttribute

func (n *Noun) HasAttribute(s string) (ret bool)

does the noun have the passed trait?

func (*Noun) HasClass

func (n *Noun) HasClass(s string) (ret bool)

func (*Noun) HasName

func (n *Noun) HasName(name string) (okay bool)

func (*Noun) HasPlural

func (n *Noun) HasPlural(s string) bool

func (*Noun) String

func (n *Noun) String() string

Id for the noun. Returned via ResultList.Objects() on a successful match.

type Playtime

type Playtime struct {
	rt.Runtime
	// contains filtered or unexported fields
}

Playtime - adapts the qna.Runner rt.Runtime to the parser this is VERY rudimentary.

func NewPlaytime

func NewPlaytime(run rt.Runtime, survey Survey, grammar parser.Scanner) *Playtime

func (*Playtime) Step

func (pt *Playtime) Step(words string) (ret *Result, err error)

advance time

func (*Playtime) Survey

func (p *Playtime) Survey() *Survey

type Result

type Result struct {
	Action string
	Nouns  []string
}

type Survey

type Survey struct {
	// contains filtered or unexported fields
}

the survey creates bounds: areas of the world containing sets of nouns.

func MakeDefaultSurveyor

func MakeDefaultSurveyor(run rt.Runtime) Survey

func MakeSurveyor

func MakeSurveyor(run rt.Runtime, player, pattern, relation string) Survey

todo: the "patter" refers to bounds for the player ideally all of the bounds functions would be in script and neither "player" nor "relation" would live here.

func (*Survey) GetBounds

func (s *Survey) GetBounds(who, where string) (ret parser.Bounds, err error)

fix: PlayerBounds, PlayerLocale and ObjectBounds might be better delegated to scripts. it would use the same bits as "locationBounded", only all the bounds requests would use it. the scripts would switch on the passed string similar to this -- ( one string and assume that the parser always refers to whatever actor in the global player variable ) that would probably narrow the dependency on rt -- maybe just to a "call" that could be configured with rt externally. ( the "Scope" command could request the named pattern to ensure it exists. )

func (*Survey) GetFocalObject

func (s *Survey) GetFocalObject() (ret rt.Value)

return the id of the focal object; returns nil on error; ex. self

func (*Survey) GetFocus

func (s *Survey) GetFocus() string

return the common name of the focal object ex. player

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL