Jump to content

Preview item by pressing key, in real time? (render target)


Go to solution Solved by HFWhite,

Recommended Posts

Hello! ? I would like if someone knows how to help me make the render target appear in real-time when I press LSHIFT. Currently, I have it set to the Shift key, but it only works if I press Shift first and then hover over the item. If I am already hovering over the item and press the "Shift" key, it doesn't work.

 

I have render target volvox: https://metin2.dev/topic/21680-render-target-remastered/

 

This is what I have now:

https://metin2.download/video/DuFjqM4Od23TNo6509GKsOdd2a2vu2uA/.mp4

 

The solution would be in "uitooltip," in the "def OnUpdate(self)" function, but I don't have the necessary knowledge in Python to solve it. I've tried...

 

An example of how I would like it to be is in the compare function that I have added, where if I am already hovering over the item and press CTRL, it works regardless of whether I hover over it before or not:

https://metin2.download/video/HjefzH05yOb7fOvh67l8qaM72lI9q0Ou/.mp4

 

I solved the compare issue after following a tutorial from a member on Dev, which says:

Quote

 

> I have improved the code about show/hide the compare tooltip because you need to press the button alt before moving the mouse over the item. My English isn't good, but here you can see the fix: [Link to the fix](https://metin2.download/picture/Mjw4S503geClPBngGrip5FPFRJM8U59F/.gif)

Open "uitooltip.py" and find:

 

if app.__COMPARE_TOOLTIP__ and app.IsPressed(app.DIK_LALT) and not slotIndex >= player.EQUIPMENT_SLOT_START and CompareItem:
    self.SetCompareItem(itemVnum)


 

Remove or comment out that code.

Now go to "def OnUpdate(self):" and over this code:

 

if app.__COMPARE_TOOLTIP__:
    if self.IsCompare:
        return


 

Add:

if app.IsPressed(app.DIK_G):
    if self.IsCompare:
        return
    if not self.CompareTooltip:
        self.SetCompareItem(self.itemVnum)
else:
    if self.CompareTooltip:
        self.CompareTooltip.Hide()
        self.IsCompare = False
        self.CompareTooltip = None

It should look like this: https://metin2.download/picture/23J65uMbQ9S6Wod7I1JJU52X4asyBN5f/.png

PD: I changed the key to G because the ALT key is used for the Rendertarget system, and two systems caused a bug in the same key. However, you can change the key to any you want.

 

Compare system: https://metin2.dev/topic/23623-compare-item-tooltip-system/

Edited by Metin2 Dev International
Core X - External 2 Internal
  • 2 weeks later...
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

HI, first u need to check if the key u want to press is in the right file
For example if u want to use alt to make the render target show make sure that u have the def for that key in the part u want to open

Lets say u want to open it from inventory
U need to have something like this
 

			elif app.IsPressed(app.DIK_LALT):
				link = player.GetItemLink(itemSlotIndex)
				ime.PasteString(link)

In uiinventory.py and then in uitooltip.py before you call it for the rendertarget

If u need to make it to idk lets say offlineshop, go in idk offlineshopwindow.py and make sure u have the code about that key for example alt, it does not need to be the same as i posted above but you need to have it implemented so the rendertarget know . Otherwise u need to prerender that by presing alt and moving mouse in and out
make sure u have the rest of code if that file dont suport app.ispressed

Hope you solve it ?

Edited by lTz
  • Solution
On 1/7/2024 at 2:38 PM, lTz said:

HI, first u need to check if the key u want to press is in the right file
For example if u want to use alt to make the render target show make sure that u have the def for that key in the part u want to open

Lets say u want to open it from inventory
U need to have something like this
 

			elif app.IsPressed(app.DIK_LALT):
				link = player.GetItemLink(itemSlotIndex)
				ime.PasteString(link)

In uiinventory.py and then in uitooltip.py before you call it for the rendertarget

If u need to make it to idk lets say offlineshop, go in idk offlineshopwindow.py and make sure u have the code about that key for example alt, it does not need to be the same as i posted above but you need to have it implemented so the rendertarget know . Otherwise u need to prerender that by presing alt and moving mouse in and out
make sure u have the rest of code if that file dont suport app.ispressed

Hope you solve it ?

Thank you, but it was more complicated than that.

 

I solved it myself after 4 hours of trial and error:

 

https://metin2.download/video/Z1L6qJxxv4IoKU3A1nA4bEiUSJ4iTf3A/.mp4

Edited by Metin2 Dev International
Core X - External 2 Internal
  • 10 months later...

Sorry for ref old topic, but would be fine next time share solution for others (prevent spam)

Solution is easy just add:

uiToolTip.py

# search:

class ToolTip(ui.ThinBoard):
[..]

# in this class search:

def OnUpdate(self):
[...]

# end of this function add:

		if app.ENABLE_RENDER_TARGET:
			try:
				if app.IsPressed(app.DIK_LCONTROL):
					if not self.ModelPreviewBoard.IsShow():
						self.ModelPreviewBoard.Show()
					if not self.ModelPreview.IsShow():
						self.ModelPreview.Show()
				else:
					if self.ModelPreviewBoard.IsShow():
						self.ModelPreviewBoard.Hide()
					if self.ModelPreview.IsShow():
						self.ModelPreview.Hide()
			except:
				pass




###########################################
# Should looks like:

	def OnUpdate(self):
		if not self.followFlag:
			return

		x = 0
		y = 0

		width = self.GetWidth()
		height = self.toolTipHeight

		if -1 == self.xPos and -1 == self.yPos:

			(mouseX, mouseY) = wndMgr.GetMousePosition()

			if mouseY < wndMgr.GetScreenHeight() - 300:
				y = mouseY + 40
			else:
				y = mouseY - height - 30

			x = mouseX - width/2
		else:
			x = self.xPos - width/2
			y = self.yPos - height

		x = max(x, 0)
		y = max(y, 0)
		x = min(x + width/2, wndMgr.GetScreenWidth() - width/2) - width/2
		y = min(y + self.GetHeight(), wndMgr.GetScreenHeight()) - self.GetHeight()

		parentWindow = self.GetParentProxy()
		if parentWindow:
			(gx, gy) = parentWindow.GetGlobalPosition()
			x -= gx
			y -= gy

		self.SetPosition(x, y)

		if app.ENABLE_RENDER_TARGET:
			try:
				if app.IsPressed(app.DIK_LCONTROL):
					if not self.ModelPreviewBoard.IsShow():
						self.ModelPreviewBoard.Show()
					if not self.ModelPreview.IsShow():
						self.ModelPreview.Show()
				else:
					if self.ModelPreviewBoard.IsShow():
						self.ModelPreviewBoard.Hide()
					if self.ModelPreview.IsShow():
						self.ModelPreview.Hide()
			except:
				pass

Be carefully about macro (ENABLE_RENDER_TARGET and code because I dont have ModelPreviewText - so missing)

Edited by Filachilla

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.