Page 1 of 1

Items name format

Posted: Wed Jun 24, 2015 5:28 am
by Stionowl1943
How to format name o LinkItem?
I receive
|Hitem:3185c|h|cffffffff[Mana Stone Tier 5]|r|h
but i want receive only 'Mana Stone Tier 5'
print(string.format( "|Hitem:%x|h|c%x[%s]|r|h", self.Id, self.Color or 0, self.Name ))
doesnt work because i receive errors.

Re: Items name format

Posted: Wed Jun 24, 2015 6:21 am
by lisa
Rock will no doubt explain this better than I can.

Code: Select all

print(string.format( "|Hitem:%x|h|c%x[%s]|r|h", self.Id, self.Color or 0, self.Name ))
That code puts the bots information that it retrieved from memory into a link format, so no it won't remove the item name from a link, it does the entire opposite.

I am just going to assume from the little information you gave that you have the "link" from a log file or such that got it from the text in game.
If so then you will need to use some string.find and string.sub to be able to do what you want.
Some info on string stuff here http://lua-users.org/wiki/StringLibraryTutorial

If on the other hand you are just trying to print info from the bot then use item.Name instead of item.ItemLink

Re: Items name format

Posted: Wed Jun 24, 2015 9:14 am
by Stionowl1943
Ok, i found soultion!

Code: Select all

local type, data, text = RoMScript('ParseHyperlink("'..itemLink..'")')
http://runesofmagic.gamepedia.com/API:ParseHyperlink