Jump to content

non-keyword arg after keyword arg


Recommended Posts

Hello,

I'm trying to install this system but I failed in uitooltip.py

Does anyone know how to make this work?

I get networkModule.SetSelectCharacterPhase - <type 'exceptions.SyntaxError'>:non-keyword arg after keyword arg (uiToolTip.py, line 1035) error and I don't know to fix it.

My uitooltip.py:

	def SetInventoryItem(self, slotIndex, window_type = player.INVENTORY):
		itemVnum = player.GetItemIndex(window_type, slotIndex)
		if 0 == itemVnum:
			return

		self.ClearToolTip()
		if shop.IsOpen():
			if not shop.IsPrivateShop():
				item.SelectItem(itemVnum)
				self.AppendSellingPrice(player.GetISellItemPrice(window_type, slotIndex))

		metinSlot = [player.GetItemMetinSocket(window_type, slotIndex, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
		attrSlot = [player.GetItemAttribute(window_type, slotIndex, i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)]

		if app.ENABLE_CHANGELOOK_SYSTEM:
			if app.ENABLE_REFINE_ELEMENT:
				refineElement = player.GetItemRefineElement(window_type, slotIndex)
#LINE 1035				self.AddItemData(itemVnum, metinSlot, attrSlot, slotIndex = slotIndex, refineElement = refineElement, 1)
			else:
				self.AddItemData(itemVnum, metinSlot, attrSlot, slotIndex = slotIndex)
		else:
			if app.ENABLE_REFINE_ELEMENT:
				refineElement = player.GetItemRefineElement(window_type, slotIndex)
				self.AddItemData(itemVnum, metinSlot, attrSlot, refineElement = refineElement)
			else:
				self.AddItemData(itemVnum, metinSlot, attrSlot)


		if shop.IsOpen() == TRUE:
			self.AppendSellableInformation()
	def AddItemData(self, itemVnum, metinSlot, attrSlot = 0, flags = 0, transmutation = -1, window_type = player.INVENTORY, slotIndex = -1, refineElement = 0, isShopItem = 0, window_open = 0):
		self.itemVnum = itemVnum
		self.metinSlot = metinSlot
		item.SelectItem(itemVnum)
		itemType = item.GetItemType()
		itemSubType = item.GetItemSubType()

Tutorial:

#search:
	def SetInventoryItem(self, slotIndex, window_type = player.INVENTORY):
		[...]
		
		self.AddItemData(itemVnum, metinSlot, attrSlot, 0, 0, window_type, slotIndex)

#replace:
		self.AddItemData(itemVnum, metinSlot, attrSlot, 0, 0, window_type, slotIndex, 1)

#search:
	def AddItemData(self, itemVnum, metinSlot, attrSlot = 0, flags = 0, unbindTime = 0, window_type = player.INVENTORY, slotIndex = -1):

#replace or adapt , window_open = 0:
	def AddItemData(self, itemVnum, metinSlot, attrSlot = 0, flags = 0, unbindTime = 0, window_type = player.INVENTORY, slotIndex = -1, window_open = 0):

 

Thank you!

Edited by Calypso2
Link to comment
Share on other sites

  • Contributor

https://www.pythondiscord.com/pages/guides/python-guides/parameters-and-arguments/

# your method
def AddItemData(self, itemVnum, metinSlot, attrSlot = 0, flags = 0, transmutation = -1, window_type = player.INVENTORY, slotIndex = -1, refineElement = 0, isShopItem = 0, window_open = 0):

# and your function call is this
#                  arg 1     arg2       arg3 , 
# then the dev wants to skip these keywords and use the default args for:[flags =0, transm = 0, wnd_t = p.Inv], then assign slotIndex, refineElement and the last argument, which is 1.
# 1 is not a keyword argument, so the correct call is with either iShopItem = 1, or window_open=1 to match the keyword asked by the method.
self.AddItemData(itemVnum, metinSlot, attrSlot, slotIndex = slotIndex, refineElement = refineElement, 1)

#So, one of these are valid calls:
self.AddItemData(itemVnum, metinSlot, attrSlot, slotIndex = slotIndex, refineElement = refineElement, isShopItem = 1)
#or
self.AddItemData(itemVnum, metinSlot, attrSlot, slotIndex = slotIndex, refineElement = refineElement, window_open = 1)

# I didn't look at the system, so I don't know which one it is. Figure it out from here.

If you didn't understand what I said there, the idea is that you can't use "non-keyword" arguments after "keyword" arguments in a function call.

These are your function's params(the keywords):

itemVnum, metinSlot, attrSlot, flags, transmutation, window_type, slotIndex, refineElement, isShopItem, window_open 

'1' is not a keyword.

 

Hope it helps

Edited by Amun
totally butchered the args/params deal, but that's ok
  • Metin2 Dev 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 3

      Crystal Metinstone

    2. 3

      Feeding game source to LLM

    3. 113

      Ulthar SF V2 (TMP4 Base)

    4. 3

      Feeding game source to LLM

    5. 0

      Target Information System

    6. 3

      Feeding game source to LLM

    7. 2

      anti exp explanation pls

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.