Script 6.2. Check the Script to add Blocks Automatically

The following script will add 10 blocks automatically.

Since this is basic for CIMPLICITY, it is recommended that you attempt to write it first and then check what you wrote.

Sub OnMouseUp(x As Long, y As Long, flags As Long)

Dim itemid As String Dim model As String Dim item As New prtItem Randomize For i = 1 To 10   'Prompt user for item ID and model   'itemid=InputBox$("Enter BLOCK item ID, please","Item ID Entry","")   'model=InputBox$("Enter BLOCK model type, please (valid entries: 25,36,60,99)","Model Type Entry","") 'Random generate item ID and model type     Number = Random(1,5000)       itemid="B" & Number     If(number Mod 4)=0 Then        model="25"     ElseIf(number Mod 4)=1 Then       model="36"     ElseIf(number Mod 4)=2 Then       model="60"     Else       model="99"     End If     'Set the item properties      Item.regionid="SCHEDULE"      item.itemid=itemid      item.itemtypeid=model      item.regionloc=-1      item.exthold 0      item.groupid="MAIN"      item.inthold 0      'Add the item to PRT item.Add Next i

End Sub

Note: If necessary, review the randomize statement in the Basic Control Engine documentation.