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

[SZUKAM]Jak dodać nowy button w ekwipunku ?


Rekomendowane odpowiedzi

Opublikowano

Jak temat mówi szukam pomocy w zrobieniu nowego buttonu w ekwipunku. Wiem że trzeba mallbutton ale nie wiem dokładnie jak. Prosiłbym o pomoc pythonmasterów w sprawie tego, oraz jak ustawić jego "przeznaczenie". Za pomoc Full like itp.

[√]100 postów

[√]200 postów

[√]300 postów

[x]400 postów

[x]500 postów

Opublikowano

Tu masz przykładowy tut z epvp. Wklejam całość, a nie link gdyż nie można reklamować innych for.

Mam nadzieje że ang jest dla ciebie zrozumiały, pozdrawiam i licze na +

 

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

        {
            "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.
        {
            "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
        "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
"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
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
toggleButtonDict[TaskBar.BUTTON_CHARACTER]=self.GetChild("CharacterButton")
and under it add this
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
BUTTON_CHAT = 4
and under it add this code.
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
import os
find this
self.wndTaskBar.SetToggleButtonEvent(uiTaskBar.TaskBar.BUTTON_CHAT, ui.__mem_func__(self.ToggleChat))
now under it add this
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
self.OtevritWeb
You can add it where you want. So, here is code you have to add.
[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
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 :D
Sorry for my bad english..
mfg LovecKrys

3npr.png

Odwiedź naszego fanpage oraz na profil na facebooku.

Zarchiwizowany

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

×
×
  • Dodaj nową pozycję...