Butoane cu functii in partea de sus a clientului

Totalitatea subiectelor care nu respectă regulamentul impus in sectiunea "Probleme şi Întrebări" vor fi stocate aici.
Închis
Avatar utilizator
Emirates
Nivel 1

Nivel 1
Mesaje: 52
Membru din: 15 Mar 2018, 10:07
Server: Palilula
Regat: Shinsoo
Aprecieri: 189  
Mulţumiri: 7  
Medalii

*Problemă/Întrebare: Pot sa pun butoane si functii in partea de sus a clientului?
Tipologie server: PVM - PvP
*Resursă folosită: -
*ServerFiles utilizat: Propriu
*Syserr: -
Poză: Imagine *Detalii suplimentare: Salutare! As putea pune butoane si functii gen switchbot, pagina bonusuri, inel, etc.. in partea de sus a clientului exact ca schema din poza? Daca da, cam la ce ar trebui sa umblu?
Pentru acest mesaj, Emirates for the post:
Pylos2Global
Avatar utilizator
[HF]White
Metin Master

Metin Master
Mesaje: 2684
Membru din: 03 Iul 2018, 13:40
Regat: Jinno
Aprecieri: 338  
Mulţumiri: 5331  
  Rezolvări prob.: 13
Discord: Copiază ID
 Contact:
Medalii

in game.py, de acolo le bagi.

Open game.py(root) and search:

Cod: Selectaţi tot

self.playerGauge = None
Under this add:

Cod: Selectaţi tot

		## Z ##############################################################################
		self.GiftBox = ui.Button()
		self.GiftBox.SetUpVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetOverVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetDownVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetText("?")
		self.GiftBox.SetToolTipText("Open the box!")
		self.GiftBox.SetPosition(10, int(wndMgr.GetScreenHeight())-126)
		self.GiftBox.SetEvent(self.ZetsuGiftSystem__deff__)
		self.GiftBox.Show()
		## Z ##############################################################################
=================================================================================================
Search:

Cod: Selectaţi tot

def OnUpdate(self):
Under this, add:

Cod: Selectaţi tot

## Z ##############################################################################
		if app.IsPressed(app.DIK_P) and app.IsPressed(app.DIK_LSHIFT):
			if self.GiftBox.IsShow():
				self.GiftBox.Hide()
			else:
				self.GiftBox.Show()
		## Z ##############################################################################

Now search

Cod: Selectaţi tot

	def __ServerCommand_Build(self):
		serverCommandList={
And add:

Cod: Selectaţi tot

			## Begin LuckyBoxes system by Zetsu
			"zetsugfsys"                            : self.ZetsuGiftSystem__init__,
            "giftsysshow" : self.ZetsuGiftSystem__show__,
            "giftsyshide" : self.ZetsuGiftSystem__hide__,
			## End LuckyBoxes
Now, the last thing it's to add the function at the end:

Cod: Selectaţi tot

## Begin LuckyBoxes system by Zetsu
	def ZetsuGiftSystem__init__(self, index):	
		constInfo.GIFTSYS = index # if doesn't work replace with:   constInfo.GIFTSYS = int(index) # But it's impossible...
	def ZetsuGiftSystem__deff__(self):
		import event
		event.QuestButtonClick(int(constInfo.GIFTSYS))
	## End LuckyBoxes
	# Warning!! Let the last row empty!! ##
    def ZetsuGiftSystem__show__(self):
        self.GiftBox.Show()
    def ZetsuGiftSystem__hide__(self):
        self.GiftBox.Hide()
si questul pe care l bagi pe buton trebuie sa inceapa cu

Cod: Selectaţi tot

quest thsgiftdev begin
    state start begin
        when login begin
            cmdchat("zetsugfsys "..q.getcurrentquestindex())
        end
Avatar utilizator
Emirates
Nivel 1

Nivel 1
Mesaje: 52
Membru din: 15 Mar 2018, 10:07
Server: Palilula
Regat: Shinsoo
Aprecieri: 189  
Mulţumiri: 7  
Medalii

[HF]White scrie: ↑12 Iun 2021, 11:48 in game.py, de acolo le bagi.

Open game.py(root) and search:

Cod: Selectaţi tot

self.playerGauge = None
Under this add:

Cod: Selectaţi tot

		## Z ##############################################################################
		self.GiftBox = ui.Button()
		self.GiftBox.SetUpVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetOverVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetDownVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetText("?")
		self.GiftBox.SetToolTipText("Open the box!")
		self.GiftBox.SetPosition(10, int(wndMgr.GetScreenHeight())-126)
		self.GiftBox.SetEvent(self.ZetsuGiftSystem__deff__)
		self.GiftBox.Show()
		## Z ##############################################################################
=================================================================================================
Search:

Cod: Selectaţi tot

def OnUpdate(self):
Under this, add:

Cod: Selectaţi tot

## Z ##############################################################################
		if app.IsPressed(app.DIK_P) and app.IsPressed(app.DIK_LSHIFT):
			if self.GiftBox.IsShow():
				self.GiftBox.Hide()
			else:
				self.GiftBox.Show()
		## Z ##############################################################################

Now search

Cod: Selectaţi tot

	def __ServerCommand_Build(self):
		serverCommandList={
And add:

Cod: Selectaţi tot

			## Begin LuckyBoxes system by Zetsu
			"zetsugfsys"                            : self.ZetsuGiftSystem__init__,
            "giftsysshow" : self.ZetsuGiftSystem__show__,
            "giftsyshide" : self.ZetsuGiftSystem__hide__,
			## End LuckyBoxes
Now, the last thing it's to add the function at the end:

Cod: Selectaţi tot

## Begin LuckyBoxes system by Zetsu
	def ZetsuGiftSystem__init__(self, index):	
		constInfo.GIFTSYS = index # if doesn't work replace with:   constInfo.GIFTSYS = int(index) # But it's impossible...
	def ZetsuGiftSystem__deff__(self):
		import event
		event.QuestButtonClick(int(constInfo.GIFTSYS))
	## End LuckyBoxes
	# Warning!! Let the last row empty!! ##
    def ZetsuGiftSystem__show__(self):
        self.GiftBox.Show()
    def ZetsuGiftSystem__hide__(self):
        self.GiftBox.Hide()
si questul pe care l bagi pe buton trebuie sa inceapa cu

Cod: Selectaţi tot

quest thsgiftdev begin
    state start begin
        when login begin
            cmdchat("zetsugfsys "..q.getcurrentquestindex())
        end
Incerc acum, revin. Multumesc!
Avatar utilizator
Emirates
Nivel 1

Nivel 1
Mesaje: 52
Membru din: 15 Mar 2018, 10:07
Server: Palilula
Regat: Shinsoo
Aprecieri: 189  
Mulţumiri: 7  
Medalii

[HF]White scrie: ↑12 Iun 2021, 11:48 in game.py, de acolo le bagi.

Open game.py(root) and search:

Cod: Selectaţi tot

self.playerGauge = None
Under this add:

Cod: Selectaţi tot

		## Z ##############################################################################
		self.GiftBox = ui.Button()
		self.GiftBox.SetUpVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetOverVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetDownVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetText("?")
		self.GiftBox.SetToolTipText("Open the box!")
		self.GiftBox.SetPosition(10, int(wndMgr.GetScreenHeight())-126)
		self.GiftBox.SetEvent(self.ZetsuGiftSystem__deff__)
		self.GiftBox.Show()
		## Z ##############################################################################
=================================================================================================
Search:

Cod: Selectaţi tot

def OnUpdate(self):
Under this, add:

Cod: Selectaţi tot

## Z ##############################################################################
		if app.IsPressed(app.DIK_P) and app.IsPressed(app.DIK_LSHIFT):
			if self.GiftBox.IsShow():
				self.GiftBox.Hide()
			else:
				self.GiftBox.Show()
		## Z ##############################################################################

Now search

Cod: Selectaţi tot

	def __ServerCommand_Build(self):
		serverCommandList={
And add:

Cod: Selectaţi tot

			## Begin LuckyBoxes system by Zetsu
			"zetsugfsys"                            : self.ZetsuGiftSystem__init__,
            "giftsysshow" : self.ZetsuGiftSystem__show__,
            "giftsyshide" : self.ZetsuGiftSystem__hide__,
			## End LuckyBoxes
Now, the last thing it's to add the function at the end:

Cod: Selectaţi tot

## Begin LuckyBoxes system by Zetsu
	def ZetsuGiftSystem__init__(self, index):	
		constInfo.GIFTSYS = index # if doesn't work replace with:   constInfo.GIFTSYS = int(index) # But it's impossible...
	def ZetsuGiftSystem__deff__(self):
		import event
		event.QuestButtonClick(int(constInfo.GIFTSYS))
	## End LuckyBoxes
	# Warning!! Let the last row empty!! ##
    def ZetsuGiftSystem__show__(self):
        self.GiftBox.Show()
    def ZetsuGiftSystem__hide__(self):
        self.GiftBox.Hide()
si questul pe care l bagi pe buton trebuie sa inceapa cu

Cod: Selectaţi tot

quest thsgiftdev begin
    state start begin
        when login begin
            cmdchat("zetsugfsys "..q.getcurrentquestindex())
        end
Am bagat, si trebuie sa iau butoanele care vin aici separat de undeva? sau unde gasesc present.tga ca in client am bagat dar nu apare nimic deocamdata..
self.GiftBox.SetUpVisual("d:/ymir work/ui/present.tga")
self.GiftBox.SetOverVisual("d:/ymir work/ui/present.tga")
self.GiftBox.SetDownVisual("d:/ymir work/ui/present.tga")
Avatar utilizator
[HF]White
Metin Master

Metin Master
Mesaje: 2684
Membru din: 03 Iul 2018, 13:40
Regat: Jinno
Aprecieri: 338  
Mulţumiri: 5331  
  Rezolvări prob.: 13
Discord: Copiază ID
 Contact:
Medalii

Emirates scrie: ↑12 Iun 2021, 16:21 Am bagat, si trebuie sa iau butoanele care vin aici separat de undeva? sau unde gasesc present.tga ca in client am bagat dar nu apare nimic deocamdata..
self.GiftBox.SetUpVisual("d:/ymir work/ui/present.tga")
self.GiftBox.SetOverVisual("d:/ymir work/ui/present.tga")
self.GiftBox.SetDownVisual("d:/ymir work/ui/present.tga")
eu ti-am dat un exemplu de implementare buton.

Ce e mai sus e system de gift pe buton.

Daca vrei tutorial complet:

pe langa ce ai facut mai sus mai adauga in constinfo.py:

Cod: Selectaţi tot

GIFTSYS = 1 
in etc/ui

pui poza asta

https://we.tl/t-FL9KmtX4hJ

si bagi questul asta:

Cod: Selectaţi tot

quest thsgiftdev begin
    state start begin
        when login begin
            cmdchat("zetsugfsys "..q.getcurrentquestindex())
			if pc.getqf("giftsystemuse") > get_time() then
				cmdchat("giftsyshide")
			end
        end
         
        function giverandomitem()
            local random_nr = number(1,5)
            chat("I: The box it's opening...") -- Opening 
            random_items = { 45009, 28013, 30044, 27105, 30029,} -- Items list
			
            pc.give_item2(tonumber(random_items[random_nr]))
			
            pc.setqf("giftsystemuse", get_time()+60*60*12) -- 12 hours (60*minutes*hrs, 30 minutes example: 60*30, 10 minutes example: 60*10)
            cmdchat("giftsyshide")
        end
 
        when button or info begin
            if pc.getqf("giftsystemuse") <= get_time() then
                thsgiftdev.giverandomitem()
            else
                chat("W: You have no gift. Try after 12 hours...") -- Played 
            end
        end
    end
end
Acum trebuie sa te joci cu coordonatele si sa muti unde vrei icon-ul si sa schimbi icon-ul cu altul daca vrei.

Cod: Selectaţi tot

self.GiftBox.SetPosition(10, int(wndMgr.GetScreenHeight())-126)
Daca nu vrei system de gift pe buton pui altceva

Exemplu quest teleport:

Cod: Selectaţi tot

quest NEWTP begin
   state start begin
        when login begin
            cmdchat("zetsugfsys "..q.getcurrentquestindex())
        end
      when button or info begin
         local x
         local y
         local t
         local e = pc.get_empire()
say_title ( "Metin2-Online" )
say_title ( "Teleport:" )
say ( "Salut," )
say ( "Unde vrei sa te duci?" )
local main_set = select ("PvP MAP (MOMENTAN)","DESERTUL","GROTA (V3) INCEPUT","Urmatoarea Pagina")
if main_set == 1 then
pc.warp ( 972800 , 153600 )
elseif main_set == 2 then
pc.warp ( 344000 , 502500 )
elseif main_set == 3 then
pc.warp ( 0 , 1203200 )
elseif main_set == 4 then

local main_set2 =select ("MAP 1 ALBASTRI","MAP 2 ALBASTRI","MAP 1 GALBENI","MAP 2 GALBENI","MAP 1 ROSI","MAP 2 ROSI","Nu mai vreau, multumesc.")
if main_set2 == 1 then
pc.warp ( 959600 , 269700 )
elseif main_set2 == 2 then
pc.warp ( 863800 , 246000 )
elseif main_set2 == 3 then
pc.warp ( 63200 , 166700 )
elseif main_set2 == 4 then
pc.warp ( 145700 , 239800 )
elseif main_set2 == 5 then
pc.warp ( 473900 , 954600 )
elseif main_set2 == 6 then
pc.warp ( 352300 , 882700 )
elseif main_set2 == 7 then
return
end
end
end
end
end
poti pune orice quest, dar trebuie sa ai asta in el ca sa se actioneze de pe butonul pus mai sus

Cod: Selectaţi tot

        when login begin
            cmdchat("zetsugfsys "..q.getcurrentquestindex())
        end
Pentru acest mesaj, [HF]White for the post:
Emirates
Avatar utilizator
Fubuki.Atsuya
Nivel 9

Nivel 9
Mesaje: 1968
Membru din: 22 Iun 2015, 21:13
Server: OldLegion2
Regat: Shinsoo
Aprecieri: 455  
Mulţumiri: 815  
  Rezolvări prob.: 2
Discord: Copiază ID
Medalii

Autorul nu a mai dat niciun răspuns.
Arhivat
Închis
Răspunsuri
4
Vizualizări
877
Răspunsuri
1
Vizualizări
540

Înapoi la “Arhivă Probleme şi Întrebări”

  • Informaţie
  • Cine este conectat

    Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 73 vizitatori