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

Move in specific directions with the number of tiles
http://forum.yoko.com.ua/viewtopic.php?f=3&t=11467
Page 1 of 1

Author:  shadowgreg [ 2007-02-20 12:57:46 ]
Post subject:  Move in specific directions with the number of tiles

would you guys be able to make a function such as:
UO.Move([Direction], [SpaceCount]))

a few examples would be

UO.Move(N, 5)
UO.Move(NE, 4)
UO.Move(E, 4)

Author:  I'm [ 2007-02-20 15:47:31 ]
Post subject: 

You can use uo.drop

Author:  Nmy [ 2007-02-20 19:15:36 ]
Post subject: 

Code:
UO.Drop('5',STR(UO.GetX('self')+?),STR(UO.GetY('self')-?),STR(UO.GetZ('self')),'finditem')

you can drop in anywhere

Author:  shadowgreg [ 2007-02-21 03:37:43 ]
Post subject: 

im not quiet sure how to implement that?

Author:  Nmy [ 2007-02-21 08:19:35 ]
Post subject: 

Code:
STR(UO.GetX('self')+?)


for example your char is standing on 2514 x in script you can write to drop finditem
Code:
STR(UO.GetX('self')-2)


script will drop finditem in 2512 x and you'r "y"

you can write UO.GetX('self')-2 or +2 or +7 it doesn't metter

Author:  shadowgreg [ 2007-02-21 09:35:12 ]
Post subject: 

when i use

Code:
UO.Drop('5',STR(UO.GetX('self')+2),STR(UO.GetY('self')-7),STR(UO.GetZ('self')),'finditem')


it says
Quote:
Invalid serial or object


if i replace 'finditem' with my serial,

Code:
UO.Drop('5',STR(UO.GetX('self')+2),STR(UO.GetY('self')-7),STR(UO.GetZ('self')),0x000ea976)


it says
Quote:
Can't pickup item


Code:
UO.Drop('5',STR.UO.GetX('self')+0, STR(UO.GetY('self)-5), STR(UO.GetZ('self'),'self')


it gives me the error
Quote:
(CHARACTER NAME)
Can't pickup item.


if anyone can give me a working example of the code, i would appreciate it.

Author:  Nmy [ 2007-02-21 11:40:32 ]
Post subject: 

Code:
uo.drop([quantity],[X,Y,Z],[object])


Code:
sub seno()
   var x, y
     x=uo.getX('laststatus')
     y=uo.getY('laststatus')
   var i,Exit
      DIM seno[3]
       seno[0]=0x0F36 ; #Bse 3 tipa sena
       seno[1]=0x100C ;#-\\-\\-\\-\\-\\-
       seno[2]=0x100D ;#-\\-\\-\\-\\-\\-
      For i=0 to 2
       Exit=0
     uo.FindType(seno[i],'-1','backpack')
     uo.Drop('1', x-1, y, 0, 'finditem')
      wait(3)
        next
     uo.FindType(seno[i],'-1','backpack')
     uo.Drop('1', x+1, y, 0, 'finditem')
endsub


Code:
   uo.findtype(musor,'-1','2')
   if uo.findcount() then
      uo.drop("1",str(uo.getx(x)),str(uo.gety(x)-1),0,"finditem")
   endif


Code:
UO.FindType(T,C,'backpack')
If C < 0 Then
C = UO.GetColor('finditem')
endif
Var b = UO.GetSerial('finditem')
UO.FindType(T,C,'ground')
Var g = UO.GetSerial('finditem')
UO.MoveItem(b, '0', g,str(uo.getx(g)),str(uo.gety(g)),'0')
Wait(500)


Code:
uo.moveitem(object,[quantity,containerobject/ground,[x,y,z]])


it's like
Code:
uo.moveitem('WhatToMove','how much','Where',you can setX,Y,Z)

'WhatToMove' - for example "finditem"
'how much' - "15"
'where' - "backpack" ; "0x1234567"(serial) ; "ground"
you can set X,Y,Z - remember if your setting X,Y,Z you must write all 3 parametrs, Z cordinate always is 0 so you can write just 0 or if you need to move something up or down you can set STR or direct number, they are always numbers and without "" but you can get numbers with STR and its no different
so for example x=458 you can write STR(uo.getx()) if you are standing on x=458 its like now x = STR(uo.getX())
if you have uo.getX() without anything - default its your character cordinates but you can get X from almoust anything like
uo.getX('serial')
uo.getX('self')
uo.getX('object')
Objects: lastobject ; lasttarget ; backpack ; lastcontainer ; laststatus ; lastattack ; lastequip ; lasthorse ; lastcorpse ; finditem ; self ;
maybe you will also need Track World Items
so the very simple example
uo.findtype('0xtype') - it will search for any item with this type in your characters backpack
Code:
uo.findtype('0xtype')
if uo.findcount() then
uo.moveitem( "finditem" , "all" , "ground" , STR(uo.getX()) , STR(uo.getY()) , 0 )

Author:  shadowgreg [ 2007-02-21 13:50:20 ]
Post subject: 

can you just show me the code to track ect. in a code bracket to move 5 spaces in any direction relative to where u r standing that will work? thanks in advance.

Author:  Nmy [ 2007-02-21 14:20:33 ]
Post subject: 

like?
Code:
if uo.getdir() == ? then
uo.moveitem( "finditem" , "5" , "ground" , STR(uo.getX()+5) , STR(uo.getY()) , 0 )
endif
if uo.getdir() == ? then
uo.moveitem( "finditem" , "5" , "ground" , STR(uo.getX()-5) , STR(uo.getY()) , 0 )
endif

etc etc you have 4 directions or 8

btw tiles not spaces

Author:  shadowgreg [ 2007-02-21 23:15:31 ]
Post subject: 

when i use that code it says object not found. and the if statement gives me an error.

Only the lines of code u need to move 5 tiles, which will work when i implement it.

Author:  Nmy [ 2007-02-22 00:01:55 ]
Post subject: 

t r y t o u n d e r s t a n d

I think you have enough information to write you'r own code - good luck

Author:  Nmy [ 2007-02-22 09:13:50 ]
Post subject: 

O'k give me brackets type

Author:  shadowgreg [ 2007-02-22 11:27:45 ]
Post subject:  Got it working another way.

I cant read the language of the writer of this code, but thanks for the send_step function

Quote:
# Direction Legend #
# For the move function. #
# ----------------------------
#north -- send_step(33,0)
#north east -- send_step(39,1)
#east -- send_step(34,2)
#south east -- send_step(40,3)
#south -- send_step(35,4)
#south west -- send_step(37,5)
#west -- send_step(36,6)
#north west -- send_step(38,7)


here is the code i wrote to move a certain amount of steps in a specific direction, besides the send_step function. Maybe this function can be implemented and enumerated to make programming easier? and have a small algorithm to make sure the client has moved to the correct tile.
Code:

#DONT CHANGE THIS FUNCTION.
sub send_step(keycode,dir)
   var x = UO.GetX()
   var y = UO.GetY()
   var timeout = 0
   if UO.GetDir()<>dir then
      UO.Press(keycode)
      Repeat
         wait(50)
      Until UO.GetDir()==dir
   endif
   UO.Press(keycode)
   Repeat
      timeout=timeout+50
      wait(50)
   Until x<>UO.GetX() || y<>UO.GetY() || timeout>2000
   if timeout>2000 then
      return 0
   endif
   return 1
end sub

#DONT CHANGE THIS FUNCTION
sub move(keycode,dir,numberOfTiles)
   var i = 0
   var x = UO.GetX()
   var y = UO.GetY()
   Repeat
      x = UO.GetX()
      y = UO.GetY()
      Repeat
         send_step(keycode,dir)
         CheckLag()
      Until x <> UO.GetX() || y <> UO.GetY()
      i = i + 1
   Until i == numberOfTiles
end sub


sub CheckLag()
   UO.Click('backpack')
   Repeat
      Wait(1000)
   Until UO.InJournal('backpack')
   UO.DeleteJournal()
end sub


Author:  Nmy [ 2007-02-22 14:53:33 ]
Post subject: 

ok now I get it...
i think all you need is send_step(keycode,dir,count)
and then make this function like
Code:
for n = 0 to count

like how many steps
or you can just use code
Code:
for n = 1 to 5
send_step()
next

or you need me to do it ?

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