Beispiel #1
0
        If you return a string, it is used as an input prompt before continuing (a pause).
        """
        player.tell("<bright>Hello, <player>%s</><bright>!  Welcome to '%s'.</>" % (player.title, self.config.name), end=True)
        player.tell("--", end=True)

    def welcome_savegame(self, player):
        pass    # not used in MUD

    def goodbye(self, player):
        """goodbye text when player quits the game"""
        player.tell("Goodbye. Please come back again soon to finish the story.")
        player.tell("\n")

    def completion(self, player):
        """congratulation text / finale when player finished the game (story_complete event)"""
        # @TODO: determine fail/success
        self.display_text_file(player, "messages/completion_success.txt")
        # self.display_text_file(player, "messages/completion_failed.txt")

    def display_text_file(self, player, filename):
        text = self.driver.resources[filename].data
        for paragraph in text.split("\n\n"):
            if paragraph.startswith("\n"):
                player.tell("\n")
            player.tell(paragraph, end=True)


if __name__ == "__main__":
    # story is invoked as a script, start it in the Tale Driver.
    run_story(sys.path[0])
Beispiel #2
0
        player.tell("<bright>Welcome to '%s'.</>" % self.name, end=True)
        player.tell(
            "This is a tiny embedded story to check out a running Tale environment."
        )
        player.tell(
            "Try to communicate with your pet, and exit the house to win the game."
        )
        player.tell("\n")
        player.tell("\n")

    def welcome_savegame(self, player):
        pass  # not supported in demo

    def goodbye(self, player):
        player.tell("Thanks for trying out Tale!")

    def completion(self, player):
        """congratulation text / finale when player finished the game (story_complete event)"""
        player.tell(
            "Congratulations on escaping the house! Someone else has to look after Garfield now though..."
        )


if __name__ == "__main__":
    # story is invoked as a script, start it in the Tale Driver.
    gamedir = os.path.dirname(__file__)
    gui = len(sys.argv) > 1 and sys.argv[1] == "--gui"
    web = len(sys.argv) > 1 and sys.argv[1] == "--web"
    mud = len(sys.argv) > 1 and sys.argv[1] == "--mud"
    run_story(gamedir, gui, web, mud)
Beispiel #3
0
        self.driver = driver
        self.driver.load_zones(["house"])

    def init_player(self, player):
        player.money = 12.65

    def welcome(self, player):
        player.tell("<bright>Welcome to '%s'.</>" % self.config.name, end=True)
        player.tell("This is a tiny embedded story to check out a running Tale environment.")
        player.tell("Try to fool around with your pet, and exit the house to win the game.")
        player.tell("\n")

    def welcome_savegame(self, player):
        pass  # not supported in demo

    def goodbye(self, player):
        player.tell("Thanks for trying out Tale!")

    def completion(self, player):
        """congratulation text / finale when player finished the game (story_complete event)"""
        player.tell("Congratulations on finding the exit! Someone else has to look after Garfield now though...")


if __name__ == "__main__":
    # story is invoked as a script, start it in the Tale Driver.
    gamedir = os.path.dirname(__file__)
    gui = len(sys.argv) > 1 and sys.argv[1] == "--gui"
    web = len(sys.argv) > 1 and sys.argv[1] == "--web"
    mud = len(sys.argv) > 1 and sys.argv[1] == "--mud"
    run_story(gamedir, gui, web, mud)
Beispiel #4
0
    def init_player(self, player):
        """
        Called by the game driver when it has created the player object.
        You can set the hint texts on the player object, or change the state object, etc.
        """
        pass

    def welcome(self, player):
        """
        Welcome text when player enters a new game
        If you return a string, it is used as an input prompt before continuing (a pause).
        """
        player.tell(
            "<bright>Hello, <player>%s</><bright>!  Welcome to '%s'.</>" %
            (player.title, self.name),
            end=True)
        player.tell("--", end=True)

    def display_text_file(self, player, filename):
        text = self.driver.resources[filename].data
        for paragraph in text.split("\n\n"):
            if paragraph.startswith("\n"):
                player.tell("\n")
            player.tell(paragraph, end=True)


if __name__ == "__main__":
    # story is invoked as a script, start it in the Tale Driver.
    run_story(sys.path[0])