ID:138434
 
var/mob/car/C
var/mob/listofcars[0]
for (C in oview(usr,3)){
if(C.speed > 4) listofcars.Add(C)
}

gives
cw_mob.dm:193:error:listofcars.Add:bad proc
at compile time.

I just wanted a list of cars (mobs) to use later, I don't understand why I get the bad proc message.
This is not a valid list:

var/mob/listofcars[0]

In Byond you don't declare what will be in the list, since unlike C++, a Byond list can hold anything.

So it should be:

var/list/listofcars[0]



In response to Deadron
On 8/22/00 9:43 am Deadron wrote:
This is not a valid list:

var/mob/listofcars[0]

In Byond you don't declare what will be in the list, since unlike C++, a Byond list can hold anything.

So it should be:

var/list/listofcars[0]
I knew this should work as I've used it before, but I was getting this runtime error (which was a little deceptive), I thought the list was causing the error - so I started trying to mess around with the list declaration, but I've just found the error in another proc(). Thanks for straightening my mind though!

Note to Tom: I was getting an error message for adding to an undeclared list in one proc, when the actual error was in a proc called by it, I hope it's not supposed to work that way.