CZEboy 29 Posted September 13, 2015 Share Posted September 13, 2015 Hi there, I would like to know where/how to do this things: 1) Change quest button(e.g. "Next", "Ok", "Cancel"...) to load the image as background 2) Change basic say color 3) Make say_title as bolt and bigger text then common say 4) Center the whole text I'm hoping to get some help from you Kind regards, Link to comment Share on other sites More sharing options...
CloseSource 14 Posted September 13, 2015 Share Posted September 13, 2015 2) like say_yellow,red etc.. Link to comment Share on other sites More sharing options...
CZEboy 29 Posted September 14, 2015 Author Share Posted September 14, 2015 2) like say_yellow,red etc.. I had looked in questlib and there was the only say_title, say_reward,... not the common say Link to comment Share on other sites More sharing options...
Frozen 189 Posted September 14, 2015 Share Posted September 14, 2015 1) I didnt understand what you whant to do.. if you want to change the look of the button you need to go to root>uiquest.py and search for the class BarButton(), and you need to change it. 2)https://metin2dev.org/board/index.php?/topic/4295-color-chat-text/ 3 and 4)I think the best way to do it is in c++ Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19656 Posted September 14, 2015 Honorable Member Share Posted September 14, 2015 You can align the lines to center with this script from 2008(bin_r23166 I have no prior bin :3): raw_script("[TEXT_HORIZONTAL_ALIGN_CENTER]") Just the reset function is unimplemented in the original src.I'm thinking for this: raw_script("[/TEXT_HORIZONTAL_ALIGN_CENTER]") UserInterface/PythonEventManger.cpp > void CPythonEventManager::ProcessEventSet(TEventSet * pEventSet) case EVENT_TYPE_TEXT_HORIZONTAL_ALIGN_CENTER: { if (EVENT_POSITION_START == pEventPosition) { pEventSet->isTextCenterMode = true; if (pEventSet->pCurrentTextLine) pEventSet->pCurrentTextLine->SetHorizonalAlign(CGraphicTextInstance::HORIZONTAL_ALIGN_CENTER); } else pEventSet->isTextCenterMode = false; break; 2 Link to comment Share on other sites More sharing options...
CZEboy 29 Posted September 15, 2015 Author Share Posted September 15, 2015 (edited) 1) I didnt understand what you whant to do.. if you want to change the look of the button you need to go to root>uiquest.py and search for the class BarButton(), and you need to change it. 2)https://metin2dev.org/board/index.php?/topic/4295-color-chat-text/ 3 and 4)I think the best way to do it is in c++ 2) Yes i know there is this way to do this, however, with this i would have to change every quest, so i'd like to change te basic say color EDIT: 1) I had saw this function before i've writen this topic. I think that this class is the right one, however I'm not quite good in python so i dob't know what to change to load it image not the only some colors You can align the lines to center with this script from 2008(bin_r23166 I have no prior bin :3): raw_script("[TEXT_HORIZONTAL_ALIGN_CENTER]") Just the reset function is unimplemented in the original src.I'm thinking for this: raw_script("[/TEXT_HORIZONTAL_ALIGN_CENTER]") Hidden Content Thanks I haven't tried it yet, i'll when i find time. Is there also solution to size of font please ? EDIT: So i tried, i did new "say_title" and this one should be automaticaly centered: function secret_title(name) raw_script("[TEXT_HORIZONTAL_ALIGN_CENTER]") say(color256(255, 188, 134)..name..color256(196, 196, 196)) raw_script("[/TEXT_HORIZONTAL_ALIGN_CENTER]") end Sadlly, if i use this that centered is the "secret_title" text and also the line below. Edited September 15, 2015 by CZEboy Link to comment Share on other sites More sharing options...
Frozen 189 Posted September 16, 2015 Share Posted September 16, 2015 int _say(lua_State* L) { ostringstream s; combine_lua_string(L, s); CQuestManager::Instance().AddScript("[COLOR r;{numberofcolorred}|g;{numberofcolorgreen}|b;{numberofcolorblue}]" + s.str() + "[/COLOR][ENTER]"); return 0; } and replace the {numeberofcolorred},{numeberofcolorblue} and {numeberofcolorgreen} for the number you want. I dont know if this is correct i dont know anything about c++.. but try it.. maybe it works 1 Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19656 Posted September 16, 2015 Honorable Member Share Posted September 16, 2015 With this will work properly. function say_title_center(msg,r,g,b) local _color if (r and g and b) == nil then _color = color256(255, 230, 186) else _color = color256(r, g, b) end raw_script(string.format("[TEXT_HORIZONTAL_ALIGN_CENTER]%s%s%s[/TEXT_HORIZONTAL_ALIGN_CENTER][ENTER]", _color, msg, color256(196, 196, 196))) end 3 Link to comment Share on other sites More sharing options...
CZEboy 29 Posted September 17, 2015 Author Share Posted September 17, 2015 (edited) With this will work properly. function say_title_center(msg,r,g,b) local _color if (r and g and b) == nil then _color = color256(255, 230, 186) else _color = color256(r, g, b) end raw_script(string.format("[TEXT_HORIZONTAL_ALIGN_CENTER]%s%s%s[/TEXT_HORIZONTAL_ALIGN_CENTER][ENTER]", _color, msg, color256(196, 196, 196))) end Works great thank you a lot Could you help also with size and style of the font for say title please ? int _say(lua_State* L) { ostringstream s; combine_lua_string(L, s); CQuestManager::Instance().AddScript("[COLOR r;{numberofcolorred}|g;{numberofcolorgreen}|b;{numberofcolorblue}]" + s.str() + "[ENTER]"); return 0; } and replace the {numeberofcolorred},{numeberofcolorblue} and {numeberofcolorgreen} for the number you want. I dont know if this is correct i dont know anything about c++.. but try it.. maybe it works Thanks i was looking for this, i couldn't find it. Thanks a lot Can you help me also with the python for that button please ? Edited September 17, 2015 by CZEboy 1 Link to comment Share on other sites More sharing options...
Frozen 189 Posted September 17, 2015 Share Posted September 17, 2015 sure, but i cant test it, so i will work blind.. i will try Link to comment Share on other sites More sharing options...
CZEboy 29 Posted September 17, 2015 Author Share Posted September 17, 2015 (edited) OK thanks until now i tried this(for this example we can work with "close_button image": class BarButton(ui.Button): UP=0 DOWN=1 OVER=2 def __init__(self, layer = "UI"): ui.Button.__init__(self,layer) self.SetUpVisual("d:/ymir work/ui/public/close_button_01.sub") self.SetOverVisual("d:/ymir work/ui/public/close_button_02.sub") self.SetDownVisual("d:/ymir work/ui/public/close_button_03.sub") def OnRender(self): x,y = self.GetGlobalPosition() grp.RenderBar(x,y,self.GetWidth(),self.GetHeight()) def CallEvent(self): self.state = self.UP ui.Button.CallEvent(self) def DownEvent(self): self.state = self.DOWN def ShowToolTip(self): self.state = self.OVER def HideToolTip(self): self.state = self.UP But still there is black blackground Edited September 17, 2015 by CZEboy Link to comment Share on other sites More sharing options...
Frozen 189 Posted September 17, 2015 Share Posted September 17, 2015 Try this: class BarButton(ui.Button): btpath = "d:/ymir work/ui/public/" # HERE THE PATH btnormal = btpath + "/btnnormal.tga" # HERE THE BUTTON NAME btover = btpath + "/btnnormal.tga" # HERE THE BUTTON NAME btdisable = btpath + "/btnnormal.tga" # HERE THE BUTTON NAME def __init__(self, layer = "UI", aButtonUp = btnormal, aButtonDown = btdisable, aButtonOver = btover): ui.Button.__init__(self,layer) self.SetUpVisual(aButtonUp) self.SetOverVisual(aButtonOver) self.SetDownVisual(aButtonDown) def CallEvent(self): ui.Button.CallEvent(self) and replace the MakeEachButtonFunction for this: def MakeEachButton(self, i): if self.skin == 3: button = BarButton("TOP_MOST") button.SetParent(self.board) button.SetSize(106,26) button.SetPosition(self.sx + self.board.GetWidth()/2+((i*2)-1)*56-56, self.sy+(event.GetLineCount(self.descIndex))*16+20+5) button.SetText("a") button.SetTextColor(0xff000000) else: i = i % 8 button = BarButton("TOP_MOST") button.SetParent(self.board) button.SetSize(200,26) button.SetPosition(self.sx + self.board.GetWidth()/2-100,self.sy+(event.GetLineCount(self.descIndex)+i*2)*16+20+5) button.SetText("a") button.SetTextColor(0xffffffff) return button dont forget to put the buttons path Link to comment Share on other sites More sharing options...
CZEboy 29 Posted September 17, 2015 Author Share Posted September 17, 2015 (edited) Should i remove this ? CallEvent(self): def DownEvent(self): def ShowToolTip(self): def HideToolTip(self): Edited September 17, 2015 by CZEboy Link to comment Share on other sites More sharing options...
Frozen 189 Posted September 17, 2015 Share Posted September 17, 2015 (edited) Should i remove this ? CallEvent(self): def DownEvent(self): def ShowToolTip(self): def HideToolTip(self): Yes, but not the callEvent Edited September 17, 2015 by Frozen Link to comment Share on other sites More sharing options...
CZEboy 29 Posted September 18, 2015 Author Share Posted September 18, 2015 (edited) So after edit i can't do anything when in the quest there are more buttons than one. I don't see these buttons :/ I can see the only one button and only when there should be just one button Edited September 18, 2015 by CZEboy Link to comment Share on other sites More sharing options...
Frozen 189 Posted September 18, 2015 Share Posted September 18, 2015 did you replace this? def MakeEachButton(self, i): if self.skin == 3: button = BarButton("TOP_MOST") button.SetParent(self.board) button.SetSize(106,26) button.SetPosition(self.sx + self.board.GetWidth()/2+((i*2)-1)*56-56, self.sy+(event.GetLineCount(self.descIndex))*16+20+5) button.SetText("a") button.SetTextColor(0xff000000) else: i = i % 8 button = BarButton("TOP_MOST") button.SetParent(self.board) button.SetSize(200,26) button.SetPosition(self.sx + self.board.GetWidth()/2-100,self.sy+(event.GetLineCount(self.descIndex)+i*2)*16+20+5) button.SetText("a") button.SetTextColor(0xffffffff) return button if yes, show the syssr of the client pls Link to comment Share on other sites More sharing options...
CZEboy 29 Posted September 18, 2015 Author Share Posted September 18, 2015 I've solved your header of MakeEachButton has 2 arguments and mine should have just one (the i) Link to comment Share on other sites More sharing options...
Frozen 189 Posted September 18, 2015 Share Posted September 18, 2015 it worked? Link to comment Share on other sites More sharing options...
CZEboy 29 Posted September 18, 2015 Author Share Posted September 18, 2015 Yeah it works points 1 and 4 are solved just need the C++ part for make font larger and bold for title in quest. And i need to test the say color which i haven't already tested. Link to comment Share on other sites More sharing options...
Tasho 243 Posted October 8, 2015 Share Posted October 8, 2015 (edited) With this will work properly. function say_title_center(msg,r,g,b) local _color if (r and g and b) == nil then _color = color256(255, 230, 186) else _color = color256(r, g, b) end raw_script(string.format("[TEXT_HORIZONTAL_ALIGN_CENTER]%s%s%s[/TEXT_HORIZONTAL_ALIGN_CENTER][ENTER]", _color, msg, color256(196, 196, 196))) end do you have something for notice_all or notice? Edited October 8, 2015 by Tasho Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now