Page 1 of 1

Move in specific directions with the number of tiles

Posted: 2007-02-20 12:57:46
by shadowgreg
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)

Posted: 2007-02-20 15:47:31
by I'm
You can use uo.drop

Posted: 2007-02-20 19:15:36
by Nmy

Code: Select all

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

you can drop in anywhere

Posted: 2007-02-21 03:37:43
by shadowgreg
im not quiet sure how to implement that?

Posted: 2007-02-21 08:19:35
by Nmy

Code: Select all

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


for example your char is standing on 2514 x in script you can write to drop finditem

Code: Select all

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

Posted: 2007-02-21 09:35:12
by shadowgreg
when i use

Code: Select all

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


it says
Invalid serial or object


if i replace 'finditem' with my serial,

Code: Select all

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


it says
Can't pickup item


Code: Select all

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


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


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

Posted: 2007-02-21 11:40:32
by Nmy

Code: Select all

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


Code: Select all

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

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

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

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


it's like

Code: Select all

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

uo.findtype('0xtype')
if uo.findcount() then
uo.moveitem( "finditem" , "all" , "ground" , STR(uo.getX()) , STR(uo.getY()) , 0 )

Posted: 2007-02-21 13:50:20
by shadowgreg
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.

Posted: 2007-02-21 14:20:33
by Nmy
like?

Code: Select all

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

Posted: 2007-02-21 23:15:31
by shadowgreg
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.

Posted: 2007-02-22 00:01:55
by Nmy
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

Posted: 2007-02-22 09:13:50
by Nmy
O'k give me brackets type

Got it working another way.

Posted: 2007-02-22 11:27:45
by shadowgreg
I cant read the language of the writer of this code, but thanks for the send_step function

# 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: Select all


#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


Posted: 2007-02-22 14:53:33
by Nmy
ok now I get it...
i think all you need is send_step(keycode,dir,count)
and then make this function like

Code: Select all

for n = 0 to count

like how many steps
or you can just use code

Code: Select all

for n = 1 to 5
send_step()
next

or you need me to do it ?