Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Feature/Documentation: Neat pattern for skill resumption #213

@pavja2

Description

@pavja2

Issue Details

In the documentation, there is the following paragraph:

You can service return paths and future branching using global variables and conditionals. This pattern shows up in "aside" flows, e.g. asking for help where you may transition to a series of help states, then want to "come back" to what you were doing. You could maintain a @currentActivity variable at all times, and then write a returnToCurrentActivity state that knows how to switch routing based on it. This would let you "interrupt" a current activity at any time, and then "blindly" return to the current activity from anywhere.

Is there an easy way to do this without adding logic to every state to store/update the @currentActivity global? Ideally, it would be great to be able to do something similar to the skill-flow-builder's @global append functionality to add this logic to all states.

Current Litexa Version

0.7.4

Desired Behavior

My hope is to be able to let the user resume a skill where they left off, like the skill-flow-builders @resume scene. Something along the lines of

launch
  if @currentActivity
     say "Welcome back! Would you like to pick up where you left off?"
     
    when "yes" 
      or "resume"
        ->@currentActivity
    when "no"
        ->startNewGame
    otherwise
        ->launch
  else
     ->startNewGame

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