Page 1 of 1

backpack/onInsert.src

Posted: Mon May 23, 2011 9:34 am
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

Re: backpack/onInsert.src

Posted: Mon May 23, 2011 11:10 pm
by xeon
AddInjectionCounter(who, 2);

What is it?

Re: backpack/onInsert.src

Posted: Tue May 24, 2011 2:58 am
by RusseL
xeon wrote:AddInjectionCounter(who, 2);

What is it?
0xF021 - mount type
AddInjectionCounter(who, 2) - used for prevent ,mount injection command

Re: backpack/onInsert.src

Posted: Tue May 24, 2011 6:23 am
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.

Re: backpack/onInsert.src

Posted: Thu May 26, 2011 2:46 am
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.