ID:267326
 
unit
var
destx = 0 as num
desty = 0 as num
proc
check()
ASSERT(destx > 0 && desty > 0)
while(!block(locate(destx-1,desty-1,src.z),locate(destx+1,desty+1,src.z)).Find(src.loc)) // this is line 12, the error line
step(src,get_dir(src,locate(destx,desty,src.z)))
destx = 1; desty = 1
return 1
icon = 'test.dmi'
infantry
icon_state = "troop"

dm.dm:12:error: .: missing comma ',' or right-paren ')'

Anyone see my problem? Thanks...
in the while line add another )
In response to Koolguy900095
Where do I put it? All the )s match up, which is why I can't just fix it myself.
In response to Lord of Water
<font size = 6>Derrrr!</font size = 6>

He said on the while line.
I think the problem is that you're trying to use the . operator directly on the output from block(). Doesn't work. You'll find that . and : both don't work there.

What you need to do instead is rewrite this to use the in operator:
while(!(loc in block(locate(destx-1,desty-1,src.z),
locate(destx+1,desty+1,src.z)) ))
The extra set of parentheses around the operands is crucial because "in" has a lower precedence than ! so otherwise it'd be (!loc) in block(...).

Lummox JR
In response to Lummox JR
Aha, I remember messing with the in operator awhile back. I prefer Find, but your solution hit it on the head. I'll have to add that to my Pitfalls lookup-list. :-D

-LoW
In response to Bischoff
LOL have u looked at the while line? all the () line up!! I looked myself....

the only thing i see odd in there is the Find proc, which is used to find an element of a list.... im not sure if hes using it properly or not tho....
In response to Lummox JR
Lummox JR wrote:
The extra set of parentheses around the operands is crucial because "in" has a lower precedence than ! so otherwise it'd be (!loc) in block(...).

That tripped me up many a time before I learnt about it. Surely it would be better to reverse that precedence? Seems more logical to me, anyway.