Send items on arrival to decision point

PHOTO EMBED

Tue Jan 23 2024 14:34:57 GMT+0000 (Coordinated Universal Time)

Saved by @FlexSimGeek #flexscript #dp #conveyor

Conveyor.DecisionPoint current = ownerobject(c);
Object item = param(1);
Conveyor conveyor = param(2);
Conveyor.Item conveyorItem = conveyor.itemData[item];
/**send Item*/

// 1. send item by percentage
if(bernoulli(30, 1, 0)){
	Conveyor.sendItem(item, current.outObjects[1]);
}


// 2. send item by item type (label)
Array dpArray = current.outObjects.toArray();
//int itemType = item.Type;
for (int index = 1; index <= dpArray.length; index++){
	if(item.Type == index){
		Conveyor.sendItem(item, current.outObjects[index]);
	}
}

// 3. same as previous but shorter

Conveyor.sendItem(item, current.outObjects[item.Type]);
content_copyCOPY

3 different ways to send item/ send item by case/ by percentage from decision point to outObjects