Yoko
http://forum.yoko.com.ua/

Finding more than one type.
http://forum.yoko.com.ua/viewtopic.php?f=3&t=768
Page 1 of 1

Author:  Boydon [ 2004-07-04 18:41:58 ]
Post subject:  Finding more than one type.

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? :)

Author:  Yoko [ 2004-07-04 21:59:09 ]
Post subject: 

i started work on this but it was disabled when some strange bugs found. i havent finished this work til last published version.

Author:  Boydon [ 2004-07-04 23:04:57 ]
Post subject: 

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? :)

Author:  Yoko [ 2004-07-04 23:48:20 ]
Post subject: 

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

Author:  Boydon [ 2004-07-05 10:56:07 ]
Post subject: 

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:
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

Author:  Yoko [ 2004-07-05 16:28:33 ]
Post subject: 

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:
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:
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:
FOR i=0xECA TO 0xED2
   Uo.findtype(str(i) , "-1" , "ground")
   //Some Other code here
NEXT

Author:  Boydon [ 2004-07-05 19:55:13 ]
Post subject: 

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:
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:
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:
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:
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.

Author:  Yoko [ 2004-07-05 21:45:16 ]
Post subject: 

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

Page 1 of 1 All times are UTC+02:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/