Jump to content

Chat Stack


Recommended Posts

  • Active+ Member
# Search
ENABLE_CHAT_COMMAND = True

# Add below 
chatStack = []
LAST_SENTENCE_STACK_SIZE = 32

# Search
def __PrevLastSentenceStack(self):

# Change whole function

    def __PrevLastSentenceStack(self):
        if self.lastSentencePos < len(chatStack):
            self.lastSentencePos += 1
            lastSentence = chatStack[-self.lastSentencePos]
            self.SetText(lastSentence)
            self.SetEndPosition()


# Search
def __NextLastSentenceStack(self):

# Change whole function
    def __NextLastSentenceStack(self):
        if self.lastSentencePos > 1:
            self.lastSentencePos -= 1
            lastSentence = chatStack[-self.lastSentencePos]
            self.SetText(lastSentence)
            self.SetEndPosition()

# Search
def __PushLastSentenceStack(self, text):

# Change whole function.
    def __PushLastSentenceStack(self, text):
        global ENABLE_LAST_SENTENCE_STACK
        if not ENABLE_LAST_SENTENCE_STACK:
            return
        if len(text) <= 0:
            return
        if len(chatStack) > LAST_SENTENCE_STACK_SIZE:
            chatStack.pop(0)
        chatStack.append(text)

It ensures that the saved message in the chat is not lost after teleporting.

  • Metin2 Dev 5
  • Good 2
  • Love 1
  • Love 2
Link to comment
Share on other sites

  • Honorable Member

Another annoying issue is the repeated commands. This solves that issue:

	def __PushLastSentenceStack(self, text):
		global ENABLE_LAST_SENTENCE_STACK
		if not ENABLE_LAST_SENTENCE_STACK:
			return
		if len(text) <= 0:
			return
		if text in chatStack: #remove duplicated elements and push the new one on top
			chatStack.remove(text)
		if len(chatStack) > LAST_SENTENCE_STACK_SIZE:
			chatStack.pop(0)
		chatStack.append(text)

 

Edited by martysama0134
  • Metin2 Dev 2
  • Love 5
Link to comment
Share on other sites

  • Active Member
4 minutes ago, martysama0134 said:

Another annoying issue is the repeated commands. This solves that issue:

	def __PushLastSentenceStack(self, text):
		global ENABLE_LAST_SENTENCE_STACK
		if not ENABLE_LAST_SENTENCE_STACK:
			return
		if len(text) <= 0:
			return
		if text in chatStack: #remove duplicated elements and push the new one on top
			chatStack.remove(text)
		if len(chatStack) > LAST_SENTENCE_STACK_SIZE:
			chatStack.pop(0)
		chatStack.append(text)

 

and for create button for on/off this system from  systemoptiondialog.py ?

Link to comment
Share on other sites

  • Premium
1 hour ago, Draveniou1 said:

nemám čas xD jestli si najdu čas udělám to a dám to do tohoto příspěvku věřím že do týdne to budu mít hotové prostě pracuju a nemám čas

don't have time but check metin2dev every thread what's new is posted and troll and rewrite every code with your troll code BUT YOU DONT HAVE TIME WEURD

1 hour ago, Draveniou1 said:

i don't have time xD if i find time i will make it and post it in this post I believe within the week I have it ready I just work and don't have time

don't have time but check metin2dev every thread what's new is posted and troll and rewrite every code with your troll code

WTF, why metin2dev so fucked up?

  • Confused 1
  • Good 1


 

Link to comment
Share on other sites

  • Active+ Member
6 hours ago, martysama0134 said:

Another annoying issue is the repeated commands. This solves that issue:

	def __PushLastSentenceStack(self, text):
		global ENABLE_LAST_SENTENCE_STACK
		if not ENABLE_LAST_SENTENCE_STACK:
			return
		if len(text) <= 0:
			return
		if text in chatStack: #remove duplicated elements and push the new one on top
			chatStack.remove(text)
		if len(chatStack) > LAST_SENTENCE_STACK_SIZE:
			chatStack.pop(0)
		chatStack.append(text)

 

Thank you for your contribution.

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.