Honorable Member Mali 41874 Posted May 5, 2020 Honorable Member Share Posted May 5, 2020 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) This is the hidden content, please Sign In or Sign Up ( GitHub ) Just add \n example: Spoiler Quote this is test message\ntest heree\ntestttt 150 2 1 1 1 1 26 6 80 Link to comment Share on other sites More sharing options...
Sherer 481 Posted May 6, 2020 Share Posted May 6, 2020 You can make SplitMultiLine as static to save a bit of memory (since this function will be called plenty of times). 1 Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19679 Posted May 6, 2020 Honorable Member Share Posted May 6, 2020 Also if you are smart enough as the webzen developers weren't, you will put an exception where the render of the textline class will skip the splitting on special places like whisper nameinput . Doesn't matter if they have added the DisableEnterToken if they didn't apply everywhere where they supposed to. And when you report this problem on their forum(gayforge obv..), they delete the topic, and giving a single piece of nothing about it. 2 Link to comment Share on other sites More sharing options...
Honorable Member Mali 41874 Posted May 6, 2020 Author Honorable Member Share Posted May 6, 2020 1 hour ago, xP3NG3Rx said: Also if you are smart enough as the webzen developers weren't, you will put an exception where the render of the textline class will skip the splitting on special places like whisper nameinput . Doesn't matter if they have added the DisableEnterToken if they didn't apply everywhere where they supposed to. And when you report this problem on their forum(gayforge obv..), they delete the topic, and giving a single piece of nothing about it. thanks for reply I was just thinking about this, and I added an option SetEnterToken(bool) Default setting(m_EnterToken) is false, you can change at GrpTextInstance.cpp, or simply add code at ui/TextLine constructor For Enable Example: Testt = ui.TextLine() Testt.SetParent(self) Testt.SetEnterToken(True) ### this Testt.SetText("this is test message\ntest here\ntesttt") 2 Link to comment Share on other sites More sharing options...
Forum Moderator Gurgarath 2514 Posted May 6, 2020 Forum Moderator Share Posted May 6, 2020 (edited) The idea behind it is really cool and way cleaner than the official way of doing it. However, here are a few inconsistensies that you can see with this function. Of course it needs to be enhanced with further checks (as xP3NG3Rx said above) and your function is neat. For example, with the official (not fully) reversed WJ_MULTI_TEXTLINE and a few checks I came up with this : Good idea and method however, thank you! Edit : Well you answered two minutes before my post and updated your repo, this message may be unrelevant now Edited May 6, 2020 by Gurgarath 1 Gurgarath coming soon Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19679 Posted May 6, 2020 Honorable Member Share Posted May 6, 2020 Yeah, lets say they implemented this feature properly, but unfortunately they forgot to use it properly . Link to comment Share on other sites More sharing options...
Johnny69 366 Posted May 6, 2020 Share Posted May 6, 2020 (edited) If you split only by "\n" and not "\\n" you won't need to add that check for editline. Also I know default open file function from python 2.7 escape \n automaticaly but you can fix the \n in two ways: (I'm talking about locale_game / locale_interface) 1. replace all "\\n" in line with "\n" 2. open the file with codecs.open and encoding "string_escape" One ideea though for your code: split the code where the text is initialized and after this save only the positions where \n was in a vector, after that in Render function you can use the position vector to rearange the text y position. Something like this (https://metin2.download/picture/f9LxxwZljyoXvU1nuSq3rwgoHx7xQYov/.png) PS: I don't know how official did it but they seem stupid Good job Edited August 26, 2022 by Metin2 Dev Core X - External 2 Internal 1 1 2 2 Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8175 Posted May 7, 2020 Honorable Member Share Posted May 7, 2020 (edited) Especially their guild comment window, you can spam \n and the text will look so buggy. This is how it looks like rofl. Obs: This "system" was implemented some time ago and this print is from today rofl... still the same and like penger said, you report the problem and they ignore your report. For the chat window I had to disable the token from the input and even from text tail, since it's a good ideia. By looking through the official python root they cleary forgot to add the DisableEnterToken() on some scripts.... # Simply disabling the token in the functions did the trick. # @ PythonChat.cpp # @ void CWhisper::AppendChat #ifdef WJ_MULTI_TEXTLINE pChatLine->Instance.DisableEnterToken(); #endif # @ void CPythonChat::AppendChat #ifdef WJ_MULTI_TEXTLINE pChatLine->Instance.DisableEnterToken(); #endif # @ PythonTextTail.cpp # @ void CPythonTextTail::RegisterInfoTail #ifdef WJ_MULTI_TEXTLINE pTextTail->pTextInstance->DisableEnterToken(); #endif # @ CPythonTextTail::TTextTail * CPythonTextTail::RegisterTextTail #ifdef WJ_MULTI_TEXTLINE pTextTail->pTextInstance->DisableEnterToken(); #endif # @ void CPythonTextTail::RegisterChatTail #ifdef WJ_MULTI_TEXTLINE pTextTail->pTextInstance->DisableEnterToken(); #endif Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 2 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
Management AZICKO 7347 Posted March 24, 2021 Management Share Posted March 24, 2021 Archive Updated. Scamming ? Reselling ? metin2.download | metin2.dev | fr.metin2.dev | metin2dev.org | metin2.top | top-metin2.org Link to comment Share on other sites More sharing options...
Active Member nazox 213 Posted October 11, 2021 Active Member Share Posted October 11, 2021 (edited) Thanks, Work Great would there be any way to add color? for curiosity Edited August 17, 2022 by Metin2 Dev Core X - External 2 Internal Nicks: Nazox™ Krone™ Nagato™ Yahiko™ Yakiro™ Proyecto: Trabajando en el. Compañeros & firma: DreamHQ - 2009-2015 [Nostalgia] Link to comment Share on other sites More sharing options...
EAkar 8 Posted October 18, 2021 Share Posted October 18, 2021 How can I use \n in locale_game.txt file. Link to comment Share on other sites More sharing options...
Honorable Member Owsap 8175 Posted February 23, 2023 Honorable Member Share Posted February 23, 2023 Here is a little update for the tooltips and a small correction for horizontal & vertical positions. EterLib/GrpTextInstance.cpp Spoiler /// 1. // Search @ WORD CGraphicTextInstance::GetTextLineCount return wLineCount; // Add above #if defined(WJ_MULTI_TEXTLINE) wLineCount += multi_text.size(); #endif /// 4. // Search void CGraphicTextInstance::SetPosition // Replace entire function with void CGraphicTextInstance::SetPosition(float fx, float fy, float fz) { m_v3Position.x = fx; m_v3Position.y = fy; m_v3Position.z = fz; #if defined(WJ_MULTI_TEXTLINE) for (std::size_t i = 0; i < multi_text.size(); i++) { const auto& it = multi_text.at(i); it->SetPosition(fx, fy + (i + 1) * m_textHeight, fz); it->SetHorizonalAlign(m_hAlign); it->SetVerticalAlign(m_vAlign); it->SetOutline(m_isOutline); it->SetFeather(m_fFontFeather); } #endif } EterLib/GrpTextInstance.h Spoiler /// 1. // Search WORD GetTextLineCount(); // Add below WORD GetLineHeight() { return m_textHeight; } void SetLineHeight(const int c_iLineHeight) { m_textHeight = c_iLineHeight; } EterLib/PythonWindow.cpp Spoiler /// 1. // Search void CTextLine::SetMultiLine(BOOL bFlag) { m_TextInstance.SetMultiLine(bFlag ? true : false); } // Add below WORD CTextLine::GetTextLineCount() { return m_TextInstance.GetTextLineCount(); } WORD CTextLine::GetLineHeight() { return m_TextInstance.GetLineHeight(); } void CTextLine::SetLineHeight(int iHeight) { m_TextInstance.SetLineHeight(iHeight); } EterLib/PythonWindow.h Spoiler /// 1. // Search void GetTextSize(int* pnWidth, int* pnHeight); // Add below WORD GetTextLineCount(); WORD GetLineHeight(); void SetLineHeight(int iHeight); Root/uiToolTip.py Spoiler """ 1. """ # Search def SplitDescription(desc, limit): # Replace the entire method with def SplitDescription(desc, limit): total_tokens = desc.split() line_tokens = [] line_len = 0 lines = [] for token in total_tokens: if "|" in token: sep_pos = token.find("|") line_tokens.append(token[:sep_pos]) lines.append(" ".join(line_tokens)) line_len = len(token) - (sep_pos + 1) line_tokens = [token[sep_pos+1:]] elif app.WJ_MULTI_TEXTLINE and "\\n" in token: sep_pos = token.find("\\n") line_tokens.append(token[:sep_pos]) lines.append(" ".join(line_tokens)) line_len = len(token) - (sep_pos + 2) line_tokens = [token[sep_pos+2:]] else: line_len += len(token) if len(line_tokens) + line_len > limit: lines.append(" ".join(line_tokens)) line_len = len(token) line_tokens = [token] else: line_tokens.append(token) if line_tokens: lines.append(" ".join(line_tokens)) return lines """ 2. """ # Search def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = True): # Replace the entire method with def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = True): textLine = ui.TextLine() textLine.SetParent(self) textLine.SetFontName(self.defFontName) textLine.SetPackedFontColor(color) textLine.SetText(text) textLine.SetOutline() textLine.SetFeather(False) if app.WJ_MULTI_TEXTLINE: textLine.SetLineHeight(self.TEXT_LINE_HEIGHT) if centerAlign: textLine.SetPosition(self.toolTipWidth / 2, self.toolTipHeight) textLine.SetHorizontalAlignCenter() else: textLine.SetPosition(10, self.toolTipHeight) textLine.Show() self.childrenList.append(textLine) if app.WJ_MULTI_TEXTLINE: lineCount = textLine.GetTextLineCount() self.toolTipHeight += self.TEXT_LINE_HEIGHT * lineCount else: self.toolTipHeight += self.TEXT_LINE_HEIGHT self.ResizeToolTip() return textLine 1 1 3 https://owsap.dev/ / https://osf.owsap.dev/ Link to comment Share on other sites More sharing options...
Premium filipw1 1931 Posted October 14, 2023 Premium Share Posted October 14, 2023 (edited) Vertical align broken First line is aligned correctly but next ones are off. Fixed This is the hidden content, please Sign In or Sign Up Edited October 14, 2023 by Metin2 Dev International Core X - External 2 Internal 33 1 6 Link to comment Share on other sites More sharing options...
nosacz26 1 Posted November 23, 2023 Share Posted November 23, 2023 is this compatibile with owsap's set_item system? Link to comment Share on other sites More sharing options...
Filachilla 29 Posted May 22 Share Posted May 22 On 2/23/2023 at 1:59 AM, Owsap said: Here is a little update for the tooltips and a small correction for horizontal & vertical positions. EterLib/GrpTextInstance.cpp Reveal hidden contents /// 1. // Search @ WORD CGraphicTextInstance::GetTextLineCount return wLineCount; // Add above #if defined(WJ_MULTI_TEXTLINE) wLineCount += multi_text.size(); #endif /// 4. // Search void CGraphicTextInstance::SetPosition // Replace entire function with void CGraphicTextInstance::SetPosition(float fx, float fy, float fz) { m_v3Position.x = fx; m_v3Position.y = fy; m_v3Position.z = fz; #if defined(WJ_MULTI_TEXTLINE) for (std::size_t i = 0; i < multi_text.size(); i++) { const auto& it = multi_text.at(i); it->SetPosition(fx, fy + (i + 1) * m_textHeight, fz); it->SetHorizonalAlign(m_hAlign); it->SetVerticalAlign(m_vAlign); it->SetOutline(m_isOutline); it->SetFeather(m_fFontFeather); } #endif } EterLib/GrpTextInstance.h Reveal hidden contents /// 1. // Search WORD GetTextLineCount(); // Add below WORD GetLineHeight() { return m_textHeight; } void SetLineHeight(const int c_iLineHeight) { m_textHeight = c_iLineHeight; } EterLib/PythonWindow.cpp Reveal hidden contents /// 1. // Search void CTextLine::SetMultiLine(BOOL bFlag) { m_TextInstance.SetMultiLine(bFlag ? true : false); } // Add below WORD CTextLine::GetTextLineCount() { return m_TextInstance.GetTextLineCount(); } WORD CTextLine::GetLineHeight() { return m_TextInstance.GetLineHeight(); } void CTextLine::SetLineHeight(int iHeight) { m_TextInstance.SetLineHeight(iHeight); } EterLib/PythonWindow.h Reveal hidden contents /// 1. // Search void GetTextSize(int* pnWidth, int* pnHeight); // Add below WORD GetTextLineCount(); WORD GetLineHeight(); void SetLineHeight(int iHeight); Root/uiToolTip.py Reveal hidden contents """ 1. """ # Search def SplitDescription(desc, limit): # Replace the entire method with def SplitDescription(desc, limit): total_tokens = desc.split() line_tokens = [] line_len = 0 lines = [] for token in total_tokens: if "|" in token: sep_pos = token.find("|") line_tokens.append(token[:sep_pos]) lines.append(" ".join(line_tokens)) line_len = len(token) - (sep_pos + 1) line_tokens = [token[sep_pos+1:]] elif app.WJ_MULTI_TEXTLINE and "\\n" in token: sep_pos = token.find("\\n") line_tokens.append(token[:sep_pos]) lines.append(" ".join(line_tokens)) line_len = len(token) - (sep_pos + 2) line_tokens = [token[sep_pos+2:]] else: line_len += len(token) if len(line_tokens) + line_len > limit: lines.append(" ".join(line_tokens)) line_len = len(token) line_tokens = [token] else: line_tokens.append(token) if line_tokens: lines.append(" ".join(line_tokens)) return lines """ 2. """ # Search def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = True): # Replace the entire method with def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = True): textLine = ui.TextLine() textLine.SetParent(self) textLine.SetFontName(self.defFontName) textLine.SetPackedFontColor(color) textLine.SetText(text) textLine.SetOutline() textLine.SetFeather(False) if app.WJ_MULTI_TEXTLINE: textLine.SetLineHeight(self.TEXT_LINE_HEIGHT) if centerAlign: textLine.SetPosition(self.toolTipWidth / 2, self.toolTipHeight) textLine.SetHorizontalAlignCenter() else: textLine.SetPosition(10, self.toolTipHeight) textLine.Show() self.childrenList.append(textLine) if app.WJ_MULTI_TEXTLINE: lineCount = textLine.GetTextLineCount() self.toolTipHeight += self.TEXT_LINE_HEIGHT * lineCount else: self.toolTipHeight += self.TEXT_LINE_HEIGHT self.ResizeToolTip() return textLine ui.py? Link to comment Share on other sites More sharing options...
Recommended Posts