The code......
turf/Click()
var/lag = 3 //how fast you do it
if(src.density)
walk_to(usr,src,1,lag)
return
else
var/O
for(O in src)
if(o.density)
walk_to(usr,src,1,lag)
return
walk_to(usr,src,0,lag)
I get error.....
Code.dm:100:error:o.density:bad var
help me plwwweees
ID:151202
![]() Feb 19 2001, 5:09 pm
|
|
turf/Click() "o.density" should be "O:density". |
Ok with your code, the character goes wacky when you click an object with a density so try these snippets. They wrok well together.
obj/Click() var/lag = 3 //how fast you do it if(src.density) walk_to(usr,src,1,lag) return else var/obj/T for(T in src) if(T.density) walk_to(usr,src,1,lag) return walk_to(usr,src,0,lag) turf/Click() var/lag = 3 //how fast you do it if(src.density) walk_to(usr,src,1,lag) return else var/turf/O for(O in src) if(O.density) walk_to(usr,src,1,lag) return var/obj/T for(T in src) if(T.density) walk_to(usr,src,1,lag) return walk_to(usr,src,0,lag) |
I tried this code but I got Inconsistent Indentation errors on 3 lines. They are labeled.
primary.dm:290: Inconsistent indentation. primary.dm:291: Inconsistent indentation. primary.dm:292: Inconsistent indentation. turf/Click() var/lag = 3 //how fast you do it if(src.density) walk_to(usr,src,1,lag) return else var/turf/O for(O in src) if(O.density)// *** 290 |
You've only declared O as var/O, so the compiler has no idea what type of object O will be--therefore it can't guarantee that O will have a var called density. Depending on what O is supposed to be, you might want to declare it as var/mob/O or var/obj/O. But remember that then, the "for" loop will only find items of that type (and derived types... for example, var/obj/O would find /obj, /obj/briefcase, /obj/bla/bla/bla/bla/bla, etc.).