Premium Kraaz 622 Posted March 28, 2023 Premium Share Posted March 28, 2023 (edited) Hello, comm! Here is a tutorial of how to display the level of character and the time in pm. Spoiler root/uiwhisper.py: Spoiler ## Add if you don't have import time import player ## Search for: chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING) return ## Add Below: hour = time.strftime("%H:%M:%S") level = player.GetStatus(player.LEVEL) lv_whisper = "{} {}".format(localeInfo.LV_WHISPER, level) time_whisper = "{} {}".format(localeInfo.TIME_WHISPER, hour) whisper_message = "[" + lv_whisper + "] (" + time_whisper + "): " + text ## Search for: net.SendWhisperPacket(self.targetName, text) ## Replace with: net.SendWhisperPacket(self.targetName, whisper_message) ## Search for: chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, self.targetName, player.GetName() + " : " + text) ## Replace with: chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, self.targetName, player.GetName()+ " : " + whisper_message) locale/en/locale_game.txt Spoiler # Add: LV_WHISPER Lv. TIME_WHISPER Hour: Edited March 28, 2023 by Metin2 Dev International Core X - External 2 Internal 10 6 4 Link to comment Share on other sites More sharing options...
dssda 2 Posted March 29, 2023 Share Posted March 29, 2023 Great Link to comment Share on other sites More sharing options...
Pseudabo 32 Posted April 1, 2023 Share Posted April 1, 2023 def SendWhisper(self): text = self.chatLine.GetText() textLength = len(text) if textLength > 0: if net.IsInsultIn(text): chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHAT_INSULT_STRING) return hour = time.strftime("%H:%M:%S") # If you wanna time without text #level = str(player.GetStatus(player.LEVEL)) # If you wanna level without text #hour = "{} {}".format(localeInfo.WHISPER_TIME, time.strftime("%H:%M:%S")) # If you wanna time with text level = "{} {}".format(localeInfo.WHISPER_LEVEL, player.GetStatus(player.LEVEL)) # If you wanna level with text string = "[" + level + "]" + " " + "[" + hour + "]" + " : " + text net.SendWhisperPacket(self.targetName, string) self.chatLine.SetText("") chat.AppendWhisper(chat.WHISPER_TYPE_CHAT, self.targetName, player.GetName() + " : " + string) 1 Link to comment Share on other sites More sharing options...
Kenyer 0 Posted April 30, 2023 Share Posted April 30, 2023 0430 22:01:47203 :: Traceback (most recent call last): 0430 22:01:47203 :: File "ui.py", line 1060, in CallEvent 0430 22:01:47203 :: File "ui.py", line 87, in __call__ 0430 22:01:47204 :: File "ui.py", line 69, in __call__ 0430 22:01:47204 :: File "uiWhisper.py", line 297, in SendWhisper 0430 22:01:47205 :: UnboundLocalError 0430 22:01:47205 :: : 0430 22:01:47205 :: local variable 'whisper_message' referenced before assignment 0430 22:01:47205 :: when I try to send the message I get this error.. Is there anything that you left from the tutorial? I checked twice that everything is correct, that i inserted Link to comment Share on other sites More sharing options...
Active+ Member HFWhite 509 Posted October 14, 2023 Active+ Member Share Posted October 14, 2023 (edited) With some source changes you can achieve this Edited October 14, 2023 by Metin2 Dev International Core X - External 2 Internal 1 Link to comment Share on other sites More sharing options...
Recommended Posts