Author Topic: Question: selecting the right finditem.  (Read 4428 times)

0 Members and 1 Guest are viewing this topic.

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +861
  • Referrals: 11
    • View Profile
Question: selecting the right finditem.
« on: August 22, 2011, 06:13:20 AM »
0
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:

Code: [Select]
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?

Code: [Select]
sub find_use
finditem %thingy G_3
for %i 1 #findCnt
{
if #findCol <> %1
  ignoreitem #findID
}
event macro 17
wait 20
ignoreitem reset
return
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +559
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Question: selecting the right finditem.
« Reply #1 on: August 22, 2011, 06:33:33 AM »
0
Try:

Code: [Select]
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

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +861
  • Referrals: 11
    • View Profile
Re: Question: selecting the right finditem.
« Reply #2 on: August 22, 2011, 06:38:05 AM »
0
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.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +786
  • Referrals: 1
    • View Profile
Re: Question: selecting the right finditem.
« Reply #3 on: August 22, 2011, 06:51:39 AM »
0
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)

Code: [Select]
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
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +861
  • Referrals: 11
    • View Profile
Re: Question: selecting the right finditem.
« Reply #4 on: August 22, 2011, 07:01:34 AM »
0
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.
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +786
  • Referrals: 1
    • View Profile
Re: Question: selecting the right finditem.
« Reply #5 on: August 22, 2011, 07:14:08 AM »
0
2 methods for your consideration.. both should perform the same function

Code: [Select]
gosub find_use %thingy 5566_5567
gosub find_use %thingy 101

Code: [Select]
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
Code: [Select]
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


« Last Edit: August 22, 2011, 07:15:57 AM by Endless Night »
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline CervezaTopic starter

  • Hacksimus Maximus
  • Scripthack
  • *
  • Posts: 5857
  • Activity:
    0%
  • Reputation Power: 80
  • Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!Cerveza is awe-inspiring!
  • Gender: Male
  • So... Hows that Hopey-Changey thing working out?
  • Respect: +861
  • Referrals: 11
    • View Profile
Re: Question: selecting the right finditem.
« Reply #6 on: August 22, 2011, 07:21:15 AM »
0
Cool, I'll play with that tonight *if* I get some time. Thanks!
XXXXXXXXXX________________________________________] 20%
I've forgotten more about this game then most people will ever know.
Thank you for controlling your children. Their manners reflect your love for them.
Give a man a fish and you feed him for a day. Don't teach a man to fish, and you feed yourself. He's a grown man. Fishing's not that hard.

Offline Crome969

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +559
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Question: selecting the right finditem.
« Reply #7 on: August 22, 2011, 07:47:51 AM »
0
Or if you want to add more securehandler:

Code: [Select]
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
Code: [Select]
GoSub GetItem %Type %Color
if #result <> #false
{
;Your Code here
}

Tags: