backpack/onInsert.src

Here you can post threads specific to the current release of the core (099)

Moderator: POL Developer

Post Reply
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

backpack/onInsert.src

Post by RusseL »

little script makes so much laggs? why?? highest percentage...

Script Path/Name
pkg/items/containers/backpack/onInsert.ecl
Instructions
4.27951e+06
Invocations
8358
Instr/Invoc
512
Percent
34.9738

Code: Select all

const BANK_WEIGHT := 10000;

use uo;
use unicode;

include ":attributes:attributes";
include ":injectioncheck:counter";

program on_insert (who, container, movetype, inserttype, item, amtadded)

if(item.objtype == 0xF021 && !GetObjProperty(who, "#pvp_town_dress"))
   AddInjectionCounter(who, 2);
   DestroyItem(item);
   return 0;
endif

if (!who.cmdlevel)
   if (who.backpack.serial == container.serial)
      if(!who.isa(POLCLASS_NPC))
	    setobjproperty(item, "#is_in_pack", who.serial);
      endif
   endif
endif
eraseobjproperty(container, "#inserting");
endprogram
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: backpack/onInsert.src

Post by xeon »

AddInjectionCounter(who, 2);

What is it?
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: backpack/onInsert.src

Post by RusseL »

xeon wrote:AddInjectionCounter(who, 2);

What is it?
0xF021 - mount type
AddInjectionCounter(who, 2) - used for prevent ,mount injection command
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: backpack/onInsert.src

Post by Turley »

I would say the players and your scriptset often move/create items in the backpacks :)

Maybe adding checks for movetype MOVETYPE_PLAYER would result in less instructions, since your script seems mainly for hack protection.
User avatar
CWO
POL Expert
Posts: 1159
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: backpack/onInsert.src

Post by CWO »

Well, 8358 invocations... that means 8358 times people inserted or moved things within a backpack. I'm guessing you possibly got this number from the script I posted. But when was the last time the script counters were cleared? If you have maybe, about 100 players online and the script counters were reset about 12 hours ago, that means on average, each person inserted or moved an item in a backpack about 83 times, or, about 7 times per hour. So this script being triggered 7 times per hour per person shouldn't be a problem.
Post Reply