Why doesn't this parse?

meta53

Member
Joined
Jun 8, 2007
Messages
56
Reaction score
3
Points
8
Code:
Sub HitObstacle 
   /echo Obstacle hit, moving around it... 
   /varcalc RV_ObstacleHit ${RV_ObstacleHit}+1 
   /echo ------------------
   /echo ${RV_ObstacleHit}
   
  [COLOR="Red"] if (${RV_ObstacleHit} >= 5) {[/COLOR]
   		/varset RV_ObstacleHit 0 
   		/warp wp home
   		/return
   }
   
   /keypress forward 
   /keypress back hold 
   /delay 3 
   /keypress back 
   /if (${Math.Rand[2]}) { 
      /keypress strafe_right hold 
   } else { 
      /keypress strafe_left hold 
   } 
   /delay 1.5s 
   /keypress strafe_right 
   /keypress strafe_left 
   /keypress forward hold 
/return

That is the code. I can't figure out what can be wrong with my syntax. It works fine if I remove that little if statement... but thats my failsafe oh shit I'm irrecoverably stuck thing.

Here is the error:
Code:
Xirin - [2009/05/19 13:36:39] [MQ2] Obstacle hit, moving around it...
Xirin - [2009/05/19 13:36:39] [MQ2] ------------------
Xirin - [2009/05/19 13:36:39] [MQ2] 1
Xirin - [2009/05/19 13:36:39] DoCommand - Couldn't parse 'if (${RV_ObstacleHit} >= 5) {'
Xirin - [2009/05/19 13:36:39] afpull_xxx.mac@439 (HitObstacle): if (${RV_ObstacleHit} >= 5) {
Xirin - [2009/05/19 13:36:39] afpull_xxx.mac@399 (MoveToLoc(MoveToY, MoveToX)): /call HitObstacle
Xirin - [2009/05/19 13:36:39] afpull_xxx.mac@327 (Pull): /call MoveToLoc ${RT_MyyLOC} ${RT_MyXLOC}
Xirin - [2009/05/19 13:36:39] afpull_xxx.mac@159 (Main): /if (${RV_HasTarget}) /call Pull
 
Maybe try removing the spaces?

Code:
{RV_ObstacleHit} >= 5)

TO

Code:
{RV_ObstacleHit}>=5)
 
Man. Working on C++ all week and losing sleep over it has made me retarded. HTW caught it. I really did have if without the leading /

Wow.

Don't I feel retarded.