コード例 #1
0
    def start(self):
        def set_variable(var_value):
            player.game_variables[self.parameters.variable] = var_value
            self.session.client.pop_state()

        player = self.session.player

        # perform text substitutions
        choices = replace_text(self.session, self.parameters.choices)

        # make menu options for each string between the colons
        var_list = choices.split(":")
        var_menu = list()
        for val in var_list:
            var_menu.append((val, val, partial(set_variable, val)))

        self.open_choice_dialog(self.session, var_menu)
コード例 #2
0
    def start(self):
        # hack to allow unescaped commas in the dialog string
        text = ', '.join(self.raw_parameters)
        text = replace_text(self.session, text)

        # If text is "${{end}}, then close the current dialog
        if not text == "${{end}}":
            self.stop()

            # is a dialog already open?
            dialog = self.session.client.get_state_name("DialogState")

            if dialog:
                # yes, so just add text to it
                dialog.text_queue.append(text)
            else:
                # no, so create new dialog with this line
                avatar = get_avatar(self.session, self.parameters.avatar)
                self.open_dialog(text, avatar)
コード例 #3
0
 def start(self):
     text = replace_text(self.session, self.parameters.text)
     avatar = get_avatar(self.session, self.parameters.avatar)
     self.open_dialog(text, avatar)