Skip to main content

No project description provided

Project description

Pytale

Overview

This library makes it easy to create tales that are told on the console.

コンソール上で遊べるゲームを作る時に使える会話ライブラリです。

Usage 1

python only

import pytale

ps = pytale.Scenario()
ps.read("Hi.", sleep=1.5, speaker="King")
player_name = ps.input("What your name?")
hero_flag = ps.confirm(f"ok {player_name}, You wanna be a hero?")

if hero_flag:
    ps.read("Yes.", sleep=1.5, speaker=player_name)
    ps.read("\n-GAME CLEAR-")
else:
    ps.read("\n-GAME OVER-")

console

[King]
Hi.
What's your name?
: hoge

ok hoge, You wanna be a hero?
choices: ['y', 'n']
: y

[hoge]
Yes.

-GAME CLEAR-

Usage 2

with json

{
    "setting": {},
    "scenario": {
        "intro": [
            {
                "speaker": "King",
                "text": "Hi.",
                "sleep": 1.5
            },
            {
                "type": "input",
                "text": "What's your name?",
                "var_name": "player_name"
            },
            {
                "type": "select",
                "text": "ok {player_name}, You wanna be a hero?",
                "choices": ["y", "n"],
                "var_name": "hero_flag"
            },
            {
                "type": "link",
                "ref": "hero_flag",
                "to": {
                    "y": "yes",
                    "n": "no"
                }
            }
        ],
        "yes": [
            {
                "speaker": "{player_name}",
                "text": "Yes.",
                "sleep": 1.5
            },
            {
                "text": "\n-GAME CLEAR-"
            }
        ],
        "no": [
            {
                "text": "\n-GAME OVER-"
            }
        ]
    }
}
import pytale

ps = pytale.Scenario("path/to/xxxxx.json")

ps.read_chapter("intro")

console

[King]
Hi.
What's your name?
: hoge

ok hoge, You wanna be a hero?
choices: ['y', 'n']
: y

[hoge]
Yes.

-GAME CLEAR-

Methods

coming soon ...

version

0.1.1 (Beta)

Github

https://github.com/toripppppy/pytale

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytale-0.1.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file pytale-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pytale-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pytale-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 71154faafa4d8de68f07ee00c514a82912e02f3403a9ab108db89c67c888ea3c
MD5 ad8421b206a0cae3ecf5062ed7eefc2e
BLAKE2b-256 19ec2d86e3988b51007658669c1ce553f8395b5ca757126af61737d09a978095

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page