All pastes #149038 Raw Edit

Someone

public text v1 · immutable
#149038 ·published 2006-08-25 14:26 UTC
rendered paste body
set %pointx . 1 2911   ;;START HERE X
set %pointy . 1 680    ;;START HERE Y
set %pointx . 2 2911
set %pointy . 2 702
set %pointx . 3 2888
set %pointy . 3 702
set %pointx . 4 2888
set %pointy . 4 680

set %cnt 2

set %targetX %pointx . %cnt
set %targetY %pointy . %cnt

initevents

loop:
 gosub walkAround
 wait 70
 goto loop


sub walkAround
 if #charposx < %targetX
 {
  set %goX ( #charposx + 1 )
  set %goY #charposy
  _wait:
   event pathfind %goX %goY
   if #charposx <> %goX
   {
    wait 1
    goto _wait
   }
 }

 if #charposx > %targetX
 {
  set %goX ( #charposx - 1 )
  set %goY #charposy
  _wait:
   event pathfind %goX %goY
   if #charposx <> %goX
   {
    wait 1
    goto _wait
   }
 }

 if #charposy > %targety
 {
  set %goX #charposx
  set %goY ( #charposy - 1 )
  _wait:
   event pathfind %goX %goY
   if #charposx <> %goX
   {
    wait 1
    goto _wait
   }
 }

 if #charposy < %targety
 {
  set %goX #charposx
  set %goY ( #charposy + 1 )
  _wait:
   event pathfind %goX %goY
   if #charposx <> %goX
   {
    wait 1
    goto _wait
   }
 }

 if #charposx = %targetX && #charposy = %targetY
 {
  if %cnt < 4
   set %cnt %cnt + 1
  else
   set %cnt 1

  set %targetX %pointx . %cnt
  set %targetY %pointy . %cnt
 }
return