ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Cerveza on August 22, 2011, 06:13:20 AM
-
Whats a good way of looking through a bunch of items that have the same TYPE but are different colors?
I'm trying this but it always chooses the first one found:
finditem %thingy G_3
if #findCOl <> %1
return
set #lobjectID #findID
event macro 17
wait 20
set #menubutton N/A
return
I guess I'll have to ignore any that aren't right... would something like this work?
sub find_use
finditem %thingy G_3
for %i 1 #findCnt
{
if #findCol <> %1
ignoreitem #findID
}
event macro 17
wait 20
ignoreitem reset
return
-
Try:
Sub FindUseful
set %Types %1
set %Color %2
Finditem %Type G_3
for #findindex 1 #findcnt
{
if %Color in #findid
{
;YourCode here
}
}
}
;More Code here
return
Hope its what u are Looking fore;)
Crome
-
That's probably what I'll need to do. I was looking at it from a "find item THEN see if it's the right color" instead of your "find the right color in the items" example.
-
Well do you only want to find ONE item with the right color are all items with the right color (use above for multi-items .. add the break as below for single item)
Sub FindFirstITemByColor ; Type Color
Finditem %1 G_3
if #findcnt > 0
{
for #findindex 1 #findcnt
{
if %2 in #findid
{
;YourCode here
break ; exit loop
}
}
}
;More Code here
return
-
There will be multiple colored items available, but I have to use just ONE of the colors.
So lets say there are Red, White and Blue hammers on the ground. I *only* want to click the White hammer and not the Red or the Blue. They are all the same item TYPE and have the same PROPERTY, so can't use that. The only difference is the items color.
-
2 methods for your consideration.. both should perform the same function
gosub find_use %thingy 5566_5567
gosub find_use %thingy 101
Sub find_use ; 1=Type 2=Color
Finditem %1 G_3
set #findindex 1
while #findindex <= #Findcnt
{
if %2 in #findid
{
event macro 17
wait 20
set #Findindex #findcnt + 20 ; exit loop
}
set #findindex #findindex + 1
}
return
Sub find_use ; 1=Type 2=Color
Finditem %1 G_3
if #findcnt > 0
{
for #findindex 1 #findcnt
{
if %2 in #findid
{
event macro 17
wait 20
break ; exit loop
}
}
}
return
-
Cool, I'll play with that tonight *if* I get some time. Thanks!
-
Or if you want to add more securehandler:
Sub GetItem
Finditem %1 G_3
if #findcnt > 0
{
for #findcnt 1 #findindex
{
if #fincol in %2
{
return #findid
}
}
}
return #false
Then u could do GoSub GetItem %Type %Color
if #result <> #false
{
;Your Code here
}