Is there another way to use the conditional event to monitor parking spots? The end goal is to see on the events output log, when a car has parked and where. I made an event, that calls a function, that runs a loop through each parking space and returns true on a spot that is taken. I wanted to trigger this event whenever a car has parked but the looping is causing the simulation to freeze.
Function(){
for(int i = 0; i<29; i++) //29 = number of parking spaces
{
if(parkingLot2.getCarOnSpace(i) != null) //if spot i taken
{
return true;
//true sent back to event, is then triggered
}
}
return false;
}
Event
condition: Function();
Action: event.restart();