Skip to content

Using Action in Event #296

@lanhoang712

Description

@lanhoang712

Hi, how do you define an action such as to create an action-based event?
I am trying this https://textworld.readthedocs.io/en/stable/textworld.generator.game.html?highlight=event#textworld.generator.game.Event but could not quite figure out how to define an action
For example:
apple = M.new(type='f', name='apple')
eat = Action(name='eat', preconditions=[], postconditions=[M.new_fact("eaten", apple)])
event_1 = Event(actions=[eat], commands='eat the apple')
q1 = Quest(win_events=[event_1]
but this produces an error of AttributeError: 'NoneType' object has no attribute 'items'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions