👨‍💻 dev shorni splash

development

owly

闇の伝説
Staff member
戦闘 コーダー
Python:
import requests
import threading

from LivinGrimoire23 import DiSkillV2


class ShorniSplash(DiSkillV2):
    pass
 

owly

闇の伝説
Staff member
戦闘 コーダー
Python:
import requests
import threading

from LivinGrimoire23 import DiSkillV2


class ShorniSplash(DiSkillV2):
    def __init__(self):
        super().__init__()
        self._result: str = ""
        self._waiting: bool = False

    def trigger(self, ear, skin, eye) -> bool:
        if ear == "shorni":
            self._waiting = True
        # override me
        return self._waiting

    @staticmethod
    def _async_func(this_cls):
        this_cls._result = "result"

    def input(self, ear: str, skin: str, eye: str):
        if self.trigger(ear, skin, eye):
            my_thread = threading.Thread(target=self._async_func, args=(self,))
            my_thread.daemon = True
            my_thread.start()
            print("thread summoned")

        if self._waiting:
            print("thread result:")
            self._waiting = False
            self.output_result()

    def output_result(self):
        self.setSimpleAlg(self._result)
        self._result = ""
 

owly

闇の伝説
Staff member
戦闘 コーダー
Python:
class ShorniSplash(DiSkillV2):
    def __init__(self):
        super().__init__()
        self._result: str = ""

    def trigger(self, ear, skin, eye) -> bool:
        if ear == "shorni":
            return True
        # override me
        return False

    @staticmethod
    def _async_func(this_cls):
        this_cls._result = "result"

    def input(self, ear: str, skin: str, eye: str):
        if self.trigger(ear, skin, eye):
            my_thread = threading.Thread(target=self._async_func, args=(self,))
            my_thread.daemon = True
            my_thread.start()
            print("thread summoned")

        if len(self._result) > 0:
            print("thread result:")
            self.output_result()
            self._result = ""

    def output_result(self):
        self.setSimpleAlg(self._result)
 
Top