Insert Scripts

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
mr bubbles
Grandmaster Poster
Posts: 120
Joined: Thu Jan 18, 2007 2:34 am

Insert Scripts

Post 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.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post 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?
Post Reply