I would suggest using a Array of Types. I would also suggest using a integer for Id instead of a string for speed. Run the code below its very fast!
;truck object Const TRUCK_MAX%=24 Type truck Field id% Field typeid% ;big=1, small=2, long=3, etc Field x# End Type Dim truckID.truck(TRUCK_MAX%) ;<-- truck Type Array ;New truck Function truckCreate.truck(id%,typeid%,x#) this.truck=New truck this\id%=id% this\typeid%=typeid% this\x#=x# truckID.truck(this\id%)=this.truck ;<-- assign truck to array Return this End Function ;create a dozen various trucks with random x# For loop = 1 To 12 truckType=Rnd(3)+1 truckX#=Rnd(-100,100) truckCreate(loop,truckType,truckX#) Print "Truck #"+Str(loop)+", Type="+Str(truckType)+", X#="+Str(truckX#) Next ;find truck truck.truck=truckID(5) x# = truck\x# Print Print "You Selected Truck #"+Str(truck\id%)+", Type="+Str(truck\typeid%)+", X#="+Str(truck\x#) Print "X#="+Str(x#) WaitKey()