question

j08j avatar image
0 Likes"
j08j asked j08j commented

The issue related to the assigned item

I want each slot to store only one item. I referenced this question. Here's my code. How can I modify it to achieve this?

  1. source2.setProperty("Triggers.OnCreation", "Object current = ownerobject(c);\n\
  2. Object item = param(1);\n\
  3. \n\
  4. Map dimensions = current.outObjects[1].getProperty(\"Dimensions\");\n\
  5. int Bay = dimensions.NumBays;\n\
  6. int Level = dimensions.NumLevels;\n\
  7. int Slot = dimensions.SlotsPerBay;\n\
  8. \n\
  9. int i = duniform(1, Bay, 1);\n\
  10. int j = duniform(1, Level, 1);\n\
  11. int k = duniform(1, Slot, 1);\n\
  12. \n\
  13. Storage.Slot slot = current.outObjects[1].as(Storage.Object).getSlot(i, j, k);\n\
  14. if(slot.as(Storage.Slot).slotItems.length < 1) Storage.Item(item).as(Storage.Item).assignedSlot = current.outObjects[1].as(Storage.Object).getSlot(i, j, k);\n\
  15. ");

model.fsm

Thanks.

FlexSim 24.0.2
flexscriptcodeslot
model.fsm (42.4 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered j08j commented
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.