How to count items by part of their name?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Rickster
Posts: 291
Joined: Sun Oct 24, 2010 4:23 pm

How to count items by part of their name?

#1 Post by Rickster »

I want to count all the fusion stones in my bags and when there are enough, send them with UMM.

There are only Fusion Stones in my bags, but there exist many different kinds, from NPC, mini games, shop e.g.
Have a look over here for them.

They all have different IDs, but I want to count them all and get one result.

They all have in common "Fusion" as part of their names. This refers to the us and de clients, do not no about others.

Sending them can be done by

Code: Select all

UMM_SendByNameOrId(_recipient, _itemTable[, _amount])
coz you can find a placeholder for all Fusion Stones in the file \micromacro\scripts\rom\cache\itemtypestable.lua. So

Code: Select all

UMM_SendByNameOrId(_recipient, "Fusion Stones", _amount])
should do the job and send all or an amount of items belonging to the _itemTable entry "Fusion Stones". (I do not know how to make this independent from localization)

But how to count them before sending?

Ric
Last edited by Rickster on Sun Dec 04, 2011 11:13 am, edited 1 time in total.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: How to count items by part of their name?

#2 Post by rock5 »

First of all "UMM_SendByNameOrId" does not send by 'type' as you suggest, it sends by the name or id, as the name of the function implies.

To send by type you could use ...... hm looks like I don't have a 'send by type' function but you could use the advanced function.

Code: Select all

UMM_SendAdvanced(_recipient, _nil, nil, nil, nil, _objtype, nil, nil, _amount)
Although if all the stones have the words "Fusion Stone" it's probably easier to just send by name. "UMM_SendByNameOrId" sends by partial name so any item with the words "Fusion Stone" will be sent.

As to counting the stones, the easiest way would be to just count them separately. Even though there are a lot of ids, there are only a few names.

Code: Select all

count = inventory:itemTotalCount("Fusion Stone") + inventory:itemTotalCount("Random Fusion Stone") + inventory:itemTotalCount("Honor Fusion Stone")
'itemTotalCount' does not count partial names, only the full names, so they need to be counted separately.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
Rickster
Posts: 291
Joined: Sun Oct 24, 2010 4:23 pm

Re: How to count items by part of their name?

#3 Post by Rickster »

Ok, so counting should not be a big prob.
And by counting each stone type I can use IDs to be independant from localisation.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: How to count items by part of their name?

#4 Post by rock5 »

Not so easy. There are a lot of "Fusion Stone" ids. I believe there is only 1 "Random Fusion Stone" id and 1 "Honor Fusion Stone" id so it would be easy to use ids for them. It might be easier to get the localized name and use that.
eg.

Code: Select all

FusionStoneName = RoMScript("TEXT('Sys202880_name')"); 
count = inventory:itemTotalCount(FusionStoneName) + inventory:itemTotalCount(202999) + inventory:itemTotalCount(206694)
That should work.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
Post Reply