play

package
v0.24.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	RequestingPlayerInput = "requesting player input"
	StartGame             = "start game"
	PassTime              = "pass time"
	RunningAnAction       = "running an action"
)

expected play time patterns

View Source
const (
	Actor      = "actor"
	Action     = "action"
	FirstNoun  = "first noun"
	SecondNoun = "second noun"
)

expected parameter names

View Source
const OutOfWorldPrefix = "request "

convention for actions which don't advance time

Variables

This section is empty.

Functions

func CaptureInput added in v0.24.7

func CaptureInput(pt *Playtime)

used for letting the unit tests fabricate input as if typed by the player.

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) HandleTurn added in v0.24.8

func (pt *Playtime) HandleTurn(words string) (okay bool, err error)

advance time

func (*Playtime) RunPlayerAction added in v0.24.8

func (pt *Playtime) RunPlayerAction(name string) (err error)

func (*Playtime) Survey

func (pt *Playtime) Survey() *Survey

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