Page 1 of 1

Insert Scripts

Posted: Tue Jun 19, 2007 5:51 am
by mr bubbles
Hi, just a question for container insert scripts. If a script tries creating an object in a full container it won't succeed, so apart from making the check in the createitem script (which should be done anyway) is there a way to check if an item was succesfully inserted into a container via the insert script?

Obviously you return 1 to allow an item to be inserted etc, I just want to know if theres a way i can do something like (if iteminsert doesn't succeed move it to containers xyz or the mobile its running for xyz).

Sorry if this is a stupid question.

Posted: Wed Jun 20, 2007 7:31 am
by Yukiko
In my OnInsert script I have this check to prevent more than one item being added at once.

Code: Select all

  if(GetObjProperty(container, "Hold"))
    SendSysMessage(who, "You can only add one item at a time.");
    if(!MoveItemToContainer(item, who.backpack))
      MoveObjectToLocation(item, who.x, who.y, who.z, who.realm, MOVEOBJECT_FORCELOCATION);
    endif
    return;
  endif
Is that what you are looking for?