这是那个超市模型的代码,由于本人代码知识欠缺,对这些代码不了解,想请位人士帮忙标注下,不胜感激!代码如下:
/**Make the shopping list and Task Sequence*/
treenode current = ownerobject(c);
treenode Shopper = msgsendingobject;
treenode ShoppingList = label(Shopper,"ShoppingList");
clearcontents(ShoppingList);
int TotalItems = duniform(1,15,1);
for( int i = 1; i<=TotalItems; i++)
{
int Type = duniform(1,gettablerows("FoodNames"),1);
nodeinsertinto(ShoppingList);
treenode ActiveNode = last(ShoppingList);
nodeadddata(ActiveNode,DATATYPE_NUMBER);
setnodenum(ActiveNode,Type);
setnodename(ActiveNode,gettablestr("FoodNames",Type,1));
}
// move the item into the model.
moveobject(Shopper, model(), 0);
// Now if there is a network node connected to me, then connect the flow item to that node.
treenode netnode = getnetnode(current, 1);
if(objectexists(netnode))
{
// connect the item to the network
contextdragconnection(netnode, Shopper, "A");
// set the location of the item.
setloc(Shopper, xloc(netnode), yloc(netnode), 0);
}