Okay, so I fired up beta 12c and attempted to make a simple homing trap. W00t. :p
Code:
SETV xd,0 ; clear x speed
SETV yd,0 ; clear y speed
COMPARER ly,y ; check if link is above/below trap
GOTOTRUE 9 ; if link y = trap y, skip <> checks because no up/down speeds need to be set
GOTOMORE 8 ; if link y > trap y, skip next 2 lines
SETV yd,-0.5 ; link y < trap y, so trap moves up
GOTO 9 ; skip next line
SETV yd,0.5 ; link y > trap y, so trap moves down
COMPARER lx,x ; check if link is to left/right of trap
GOTOTRUE 15 ; if link x = trap x, skip <> checks because no left/right speeds need to be set
GOTOMORE 14 ; if link x > trap x, skip next 2 lines
SETV xd,-0.5 ; link x < trap x, so trap moves left
GOTO 15 ; skip next line
SETV xd,0.5 ; link x > trap x, so trap moves right
WAITFRAME ; to give the trap time to move :p
GOTO 1 ; reset the speeds to 0 and pick new direction
QUIT ; self-explanatory. :)
I'm having two weird problems with this, though:
1.
Although I didn't seem to break the comment syntax (as specified in jman's post in the beta 12 thread), the script won't work in ZQuest unless I remove the comments...if I try to load it with the comments intact, ZQuest hangs.
2.
The trap works perfectly with a speed of 1...unfortunately, this makes it near-impossible to outrun (as in...you can outrun it, but literally won't have time to do anything else ), and this is in a dungeon room with no solid blocks or anything (save for the walls themselves).
However, if I lower the speed to 0.5, it quits working correctly.
At that speed, it only goes down or right, or stands still if it's right on Link. Never moves up or left.
This has stumped me quite a bit, since I don't see any logic problems in the script. Although I wouldn't be surprised if I missed something completely obvious, considering the maze of GOTOs I had to use to do the "equal, greater than, or less than" checks...