ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Gemviper on November 06, 2015, 11:44:45 PM

Title: Those darned EM items, desireable but hard to spot!
Post by: Gemviper on November 06, 2015, 11:44:45 PM
How would you set a simple list of specific EM items in a script, for several items with names like "Helm Made With Scales From A Crimson Dragon"?

- Cannot go by itemtype since it shares the same item type as a normal helm
- Cannot shorten it much since words like scales and crimson pull up other items

If I have a small(ish, 50 items) list of EM items that I want to set as priority to loot what's the most efficient way to find them when using finditem that will find them but not pick up non EM items of the same item type?
Title: Re: Those darned EM items, desireable but hard to spot!
Post by: manwinc on November 07, 2015, 04:40:08 AM
set %N_Titles 1
set %title1 Helm , #Spc , Mage , #Spc , With , #Spc , Scales , #Spc , From , #Spc , A , #Spc , Crimson , #Spc , Dragon

Finditem * C
For #Findindex 1 #Findcnt
{
Event Property #Findid
for %Title 1 %N_Titles
{
if %Title . %Title in #Property
Display Yayy found it $ #Property
}
}
Halt


You could write a sub to make the parsing much easier on you.
Title: Re: Those darned EM items, desireable but hard to spot!
Post by: Gemviper on November 07, 2015, 09:52:28 AM
so with 50 items to look for there would be title2, title3, title4 etc? Could get to be quite a lengthy script, what would the slowdown be like?
Title: Re: Those darned EM items, desireable but hard to spot!
Post by: manwinc on November 08, 2015, 08:39:50 PM
Not as bad as you would think, Usually the event property Command itself takes longer than Actually Looking for a specific Text. Your best bet would be to also add the Type, so it would only be scanning the property of items with the right types.

Snippet will show you the time required to scan for a specific text on your character 50x
Code: [Select]
set #lpc 9999
set %Start_Time #Systime
Event Property #Charid
for %Number 1 50
{
If I_Like_Big_Butts in #property
Display Why did you name your character that....
}
set %End_Time #Systime - %Start_Time
Display Scanning 1 item for 50 String Texts took ~ %End_Time ms
Halt

Would take about 20-30ms for each item on my comp with other scripts running.
Title: Re: Those darned EM items, desireable but hard to spot!
Post by: Gemviper on November 09, 2015, 02:09:44 AM
Wow, very cool, thanks manwinc
Title: Re: Those darned EM items, desireable but hard to spot!
Post by: Endless Night on November 10, 2015, 07:31:46 AM
You could write a sub to make the parsing much easier on you.


I always use subs like this to aviod having to type spaces as  ", #spc ," ..

Code: [Select]
gosub Addtitle Helm Mage With  Scales From A Crimson Dragon
gosub Addtitle Helm Mage With  Scales From A Purple Mushroom


sub Addtitle
  if %N_titles = N/A
     set %N_Titles 0
  set %N_Titles  %N_Titles + 1  ; increment the number of titles
  set %Title . %N_titles %1
  if %0 > 1
    {
    for !c 2 %0
       set %Title . %N_titles %Title . %N_titles , #spc , % . !c
    }
return