Obstruction code help

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

DekeFentle
a lesser mummy
a lesser mummy
Posts: 48
Joined: Wed Oct 22, 2003 1:41 pm

Obstruction code help

Post by DekeFentle » Tue Oct 28, 2003 5:31 pm

I’ve noticed that the obstruction checker in several of the macros I’ve gotten here can run you into a tree or move you back and forth in a very small area. Would this be an improvement?

Code: Select all

Sub CheckForObs
   /declare DistTraveledX local
   /declare DistTraveledY local
 
   /if n $char(x)==@LastPosX /if n $char(y)==@LastPosY { 
      /varadd ObstCount 1 
   } else {
      /varset ObstCount 0
   }
   /varset DistTraveledX $int($calc($char(x)-@LastPosx))
   /varset DistTraveledY $int($calc($char(y)-@LastPosx))
   /if n $calc(@DistTraveledX + @DistTraveledY)<8
      /varadd ObstCount 1   
     
   /varset LastPosX $char(x) 
   /varset LastPosY $char(y) 
    
   /if n @ObstCount>3 { 
      /call GoAroundObst 
   } 
/return
Should the check for ObstCount be >3?

Any input would be greatly appreciated.
Revelation 6:8