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.3 (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 Distribution

pytale-0.1.3.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

Details for the file pytale-0.1.3.tar.gz.

File metadata

  • Download URL: pytale-0.1.3.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pytale-0.1.3.tar.gz
Algorithm Hash digest
SHA256 bd8a735ccab21964393f9addb818302bf7e02e9768bd9c117646fc518bce9fd8
MD5 8b9c2fa1b4da736344001e51763fa9bf
BLAKE2b-256 1263eedd5c4fd0c48b0adb1ec3f40779ab6f24c83525ddd26ae79b6431568336

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytale-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 694a4a4fa7f5b8751f9bfb1ba4c2b5fc92a90e4aaafa2cbbab70f56dd4984bb0
MD5 ca52a75f96cc6127abbd7e9221956bcc
BLAKE2b-256 4a2b8b168c437de8fa75b1dc4f4cd36aef7577aa2ebd47b8253c339e6f130dfc

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