Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Pytanie]Nowy button. Jak zmienić jego przeznaczenie ?


Rekomendowane odpowiedzi

Opublikowano

Siemka. Zastanawiałem się, jak dodać nowy button. Wpisałem w wujku Google definicję New Button Metin2 i wyskoczył mi tut z epvp.

Tutorial ten polega na dodaniu koło buttonu ekwipunku nowy button. Chciałbym tam zamieścić statystyki postaci.

Niezbyt ogarnaim takie rzeczy, i dlatego chciałbym poprosić o pomoc z tym. Dam treść tutoriala, bo nie chcę dostać warna:

 

 

 

 

 

Hi epvp, i want to show you how to make new button on taskbar with function.
Ok so firt unpack locale_xx where xx is your locale language (de, cz, sg, etc) go to xx/ui/ and open taskbar.py. Here is position, button design etc..so find this
Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 226px;
text-align: left;
overflow: auto"> {
"name" : "InventoryButton",
"type" : "button",

"x" : SCREEN_WIDTH - 110,
"y" : 3 + Y_ADD_POSITION,

"tooltip_text" : uiScriptLocale.TASKBAR_INVENTORY,

"default_image" : ROOT + "TaskBar/Inventory_Button_01.sub",
"over_image" : ROOT + "TaskBar/Inventory_Button_02.sub",
"down_image" : ROOT + "TaskBar/Inventory_Button_03.sub",
},

and add this under the inventory button.

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 226px;
text-align: left;
overflow: auto"> {
"name" : "Webove_stranky",
"type" : "button",

"x" : SCREEN_WIDTH - 178,
"y" : 3 + Y_ADD_POSITION,

"tooltip_text" : "Webové stránky",

"default_image" : ROOT + "TaskBar/Inventory_Button_01.sub",
"over_image" : ROOT + "TaskBar/Inventory_Button_02.sub",
"down_image" : ROOT + "TaskBar/Inventory_Button_03.sub",
},

This is the design of button, the root path is defined in the top of taskbar.py

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 66px;
text-align: left;
overflow: auto"> "default_image" : ROOT + "TaskBar/Inventory_Button_01.sub",
"over_image" : ROOT + "TaskBar/Inventory_Button_02.sub",
"down_image" : ROOT + "TaskBar/Inventory_Button_03.sub",

ok, next..this is tooltip text. It means text which you can see while you have your mouse cursor over the button

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">"tooltip_text" : "Webové stránky",

ok, we finish_xx locale. Save taskbar.py and pack your locale. After you add new locale to client and start game, wuala we have new button

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">http://i.epvpimg.com/N0m8c.png

Ok, now the harder part of this :-D unpack root and find uitaskbar.py
Okkkkk ladies :-D find this

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">toggleButtonDict[TaskBar.BUTTON_CHARACTER]=self.GetChild("CharacterButton")

and under it add this

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">toggleButtonDict[TaskBar.BUTTON_WEBOVE_STRANKY]=self.GetChild("Webove_stranky")

Warning!! if you change the ("Webove_stranky") to something other, you have to change it also in taskbar.py in locale!! because this determines what button has the function which we can make with this tutorial. Ok, next find this

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">BUTTON_CHAT = 4

and under it add this code.

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">BUTTON_WEBOVE_STRANKY = 5

Ok now we finished the uitaskbar.py part..open interfacemodule.py First and necessary part of this! you must write on the top or betwen the other imports this

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">import os

find this

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">self.wndTaskBar.SetToggleButtonEvent(uiTaskBar.TaskBar.BUTTON_CHAT, ui.__mem_func__(self.ToggleChat))

now under it add this

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">self.wndTaskBar.SetToggleButtonEvent(uiTaskBar.TaskBar.BUTTON_WEBOVE_STRANKY, ui.__mem_func__(self.OtevritWeb))

ooookkkk and the last part of this you have to add the definition of this

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">self.OtevritWeb

You can add it where you want. So, here is code you have to add.

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 66px;
text-align: left;
overflow: auto">[TAB]def OtevritWeb(self):
[TAB][TAB]chat.AppendChat(CHAT_TYPE_INFO, "Otevírání webových stránek..")
[TAB][TAB]os.startfile("www.website.cz")

you have to replace the "[TAB]" )with the tabulator xD..)
Ok now pack root, put in your client and start game. Now if you click on the new button you open the website which you can define in this

Code:
margin: 0px;
padding: 6px;
border: 1px inset;
width: 640px;
height: 34px;
text-align: left;
overflow: auto">os.startfile("www.website.cz")

Finaly we have the button with function. N0m8c.png
Ok that's all. If this help you press thanks button, and if not press it too biggrin.gif
Sorry for my bad english..
mfg LovecKrys

 

 

 

 

 

 

 

Liczę na szybką pomoc i dziękuję :)

call of duty zombies GIF by Omaze

Opublikowano
self.wndTaskBar.SetToggleButtonEvent(uiTaskBar.TaskBar.BUTTON_WEBOVE_STRANKY,ui.__mem_func__(self.OtevritWeb))

Ta linijka mówi, że przycisk, którego nazwę określiłeś jako

self.wndTaskBar

ma po nienaciśnięciu na niego wywołać akcję zawartą w

OtevritWeb

Teraz musisz szukać

def OtevritWeb (self):

i wszystko co będzie się tyczyło tego "defa" będzie akcją jaka się wywołuje po nienaciśnięciu na button

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...