Finding more than one type.

Ask for help

Moderators: Murderator+, Murderator

Post Reply
Boydon
Posts: 56
Joined: 2004-06-16 00:44:18

Finding more than one type.

Post by Boydon »

Is is possible to find two or more type at the same time?

I mean somethig like "finditem ABC_DEF_GHI" in easyuo.

If yes, how? :)
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

i started work on this but it was disabled when some strange bugs found. i havent finished this work til last published version.
Boydon
Posts: 56
Joined: 2004-06-16 00:44:18

Post by Boydon »

Do you plan to finish this? :)

Anyway: an alternative solution?

I though i can put all the types in an a arry and then loop trought it: better ideas? :)
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

no, this is a general way.
only one exception in case of type numbers are continuous (0x1234, 0x1235, 0x1236...) In this case possible to use cycle with uo.Hex2Int conversion
Boydon
Posts: 56
Joined: 2004-06-16 00:44:18

Post by Boydon »

Yes they are continous from 0xECA to 0xED2.

I can't figoure out a way to loop with Uo.Hex2Int(), can you help me or just make an example? :)

Maybe somethin like:

Code: Select all

FOR i=Uo.Hex2Int(0xECA) TO Uo.Hex2Int(0xED2) 
   Uo.findtype("i" , "-1" , "ground") ;<- I assume findtype accepts decimal, or i have to convert them back with Int2Hex?
   //Some Other code here
NEXT
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

Boydon wrote:Yes they are continous from 0xECA to 0xED2.

I can't figoure out a way to loop with Uo.Hex2Int(), can you help me or just make an example? :)

Maybe somethin like:

Code: Select all

FOR i=Uo.Hex2Int(0xECA) TO Uo.Hex2Int(0xED2) 
   Uo.findtype("i" , "-1" , "ground") ;<- I assume findtype accepts decimal, or i have to convert them back with Int2Hex?
   //Some Other code here
NEXT

"i" is not a decimal, it is a string consists of letter 'i'.
do not mix name of variable and it's value

this will surely work

Code: Select all

FOR i=Uo.Hex2Int("0xECA") TO Uo.Hex2Int("0xED2") 
   Uo.findtype(uo.Int2Hex(i) , "-1" , "ground")
   //Some Other code here
NEXT

also you may try

Code: Select all

FOR i=0xECA TO 0xED2
   Uo.findtype(str(i) , "-1" , "ground")
   //Some Other code here
NEXT
Boydon
Posts: 56
Joined: 2004-06-16 00:44:18

Post by Boydon »

Yoko wrote:"i" is not a decimal, it is a string consists of letter 'i'.
do not mix name of variable and it's value

this will surely work

Code: Select all

FOR i=Uo.Hex2Int("0xECA") TO Uo.Hex2Int("0xED2") 
   Uo.findtype(uo.Int2Hex(i) , "-1" , "ground")
   //Some Other code here
NEXT

also you may try

Code: Select all

FOR i=0xECA TO 0xED2
   Uo.findtype(str(i) , "-1" , "ground")
   //Some Other code here
NEXT


While waiting for a reply I made some tries and used the simplest one:

Code: Select all

FOR i=3786 TO 3794
      Uo.findtype(i,"-1","ground")
      //some other code here
NEXT

And yes it does: findtype supports decimals. :D

What I want to point out is another thing; I used the previous for loop because while doing tests i found that code like this:

Code: Select all

FOR i=Uo.Hex2Int("0xECA") TO Uo.Hex2Int("0xED2")
   uo.msg(i)
   wait(1000)
NEXT

does not give any output: is this supposed to happen or it is a bug?
I've also tried with str() and int() and with uo.msg() instead of uo.print(), but notthing to do: no monitor output.
Yoko
Site Admin
Posts: 1964
Joined: 2004-04-03 16:49:38
Contact:

Post by Yoko »

msg want string as argument, i is a number
uo.msg(str(i))
Post Reply