ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: nordby21 on January 11, 2013, 07:37:17 AM

Title: Movement Help?
Post by: nordby21 on January 11, 2013, 07:37:17 AM
ok so im making a stealth script..or atleast tryin but im having a semi basic issue i hope

im trying to make the character move north 5 tiles then south 5 tiles

event macro 5 1 mixed with event macro 5 5...well just doesnt cut it as im sure are there any tutorials on movement and how to use your xpos ypos to make movement more fluent and simplified for me

ive also tried move..not sure what the parameters mean there but it seems to just have a constant loop of walking northwest


any advice would help this is what i have so far...please dont crucify me :/

Code: [Select]
go sub setupmove


;***************Hiding Sub***************
;----------------------------------------
sub hide
      If H notIn #charStatus
      {
      event macro 13 21
      go sub stealth
}

;----------------------------------------
;****************Movement****************
sub setupmove

    set %x1 #charposx
    set %x2 #charposy
    wait 5s
    event macro 5 1
    event macro 5 1
    event macro 5 1
    event macro 5 1
    event macro 5 1
    event macro 5 1
    wait 5s
    set %x2 #charposx
    set %y2 #charposy
    event macro 5 5
    event macro 5 5
    event macro 5 5
    event macro 5 5
    event macro 5 5
    event macro 5 5
    go sub hide
}
;----------------------------------------

i know its messed up im just trying to get movement down before i input for skill checks and a cleaner nicer looking code
Title: Re: Movement Help?
Post by: Cerveza on January 11, 2013, 08:10:40 AM
Have you considered using event pathfind instead?

Code: [Select]
set %startX 1044 ; starting #charPosX position
set %startY 944 ; starting #charPosY position
set %endX 1048 ; ending x position
set %endY 944 ; Y position doesn't change cause I'm staying on the same plane

repeat
event pathfind %startX %startY
wait 20
event pathfind %endX %endY
wait 20
until #false

Will walk you (if your mouse is near your character) or run you (mouse away from char) from one spot to another.
Title: Re: Movement Help?
Post by: Endless Night on January 11, 2013, 08:56:23 AM
Your using subs wrong .. a sub should exit via the return command.  You call a sub via gosub not 'go sub'  ... let fix that in your code for you as an example

Code: [Select]
repeat
  gosub hide      ; first hide
  gosub stealth   ; initiailze stealthing
  gosub setupmove ; do movement
until #clilogged <> 1 ; reapeat until not logged in.
halt

;***************Hiding Sub***************
;----------------------------------------
sub hide
  If H notIn #charStatus
     {
     event macro 13 21
     }
return

sub stealth
   ; code
return

;----------------------------------------
;****************Movement****************
sub setupmove
;    set %x1 #charposx   <-- this does nothing for you
;    set %x2 #charposy
    wait 5s
    event macro 5 1
    event macro 5 1
    event macro 5 1
    event macro 5 1
    event macro 5 1
    event macro 5 1
    wait 5s
;    set %x2 #charposx
;    set %y2 #charposy
    event macro 5 5
    event macro 5 5
    event macro 5 5
    event macro 5 5
    event macro 5 5
    event macro 5 5
return
;----------------------------------------

Title: Re: Movement Help?
Post by: manwinc on January 11, 2013, 02:35:17 PM
Also, Use cheffes move command when stealthing