sysLoad

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 096.
Note: Core 096 is no longer officially supported.
Post Reply
Nosferatu
Journeyman Poster
Posts: 63
Joined: Fri Jul 21, 2006 9:58 pm

sysLoad

Post by Nosferatu »

how i can find which script are did a sysload 100%
thnx
pol 096.6
Justae
Expert Poster
Posts: 79
Joined: Thu May 24, 2007 2:12 pm

Post by Justae »

.scriptprof command for you.

This works fine with POL093 all the way up to latest POL097.

This was written by one of my developers, Talon, a few years ago. It's handy as it gives you a good picture ingame of which scripts are running the highest. Drop it into your textcmd\test directory and compile it. Just check that the "include/gumps" points to the correct location for your own files. You can of course also do this kind of thing via a web page.

You can optionally remove the GFCheckerTrans line if you do not want or cannot use transparent gumps.

Code: Select all

use uo;

include "include/gumps";


program view_script_profiles(who)
	
	GFInitGump();
	GFResizepic( 0, 40, 0x53, 800, 580 );
	GFCheckerTrans( 0, 40, 800, 580 );
	GFTextLine( 320,  70, 4, "- Script Profile -" );
	GFTextLine(  50, 100, 63, "Script Name" );
	GFTextLine( 350, 100, 63, "Instructions");
	GFTextLine( 450, 100, 63, "Instruction%" );
	GFTextLine( 550, 100, 63, "Invocations" );
	GFTextLine( 650, 100, 63, "Instruc/Invoc" );

	var cury := 120;

	foreach script in scripts_sorted()
		GFTextLine(  50, cury, 53, script.name );
		GFTextLine( 350, cury, 53, script.instr );
		GFTextLine( 450, cury, 53, script.instr_percent );
		GFTextLine( 550, cury, 53, script.invocations  );
		GFTextLine( 650, cury, 53, script.instr_per_invoc );
		cury := cury + 20;
	endforeach

	var reset := GFButtonID( 30, 60, 2117, 2118, 1 );
	GFTextLine( 50, 62, 32, "Reset" );

	var res := GFSendGump(who);
	if(res[0]==reset.keyid)
		polcore().clear_script_profile_counters();
	endif

	return;

endprogram


function scripts_sorted()

	var scriptarray := polcore().script_profiles;
	var the_scripts := {};

	foreach script in scriptarray
		if (script.instr_percent > 2)
			the_scripts.append(script);
		endif
	endforeach

	var a,b,temp;
	// never thought i'd be bubble sorting again ;P
	for(a:=1;a<the_scripts.size();a:=a+1)
		for(b:=a+1;b<=the_scripts.size();b:=b+1)
			if(the_scripts[a].instr_percent < the_scripts[b].instr_percent)
				temp := the_scripts[a];
				the_scripts[a] := the_scripts[b];
				the_scripts[b] := temp;
			endif
		endfor
	endfor

	return the_scripts;

endfunction


I hope this helps.

Regards
Justae
The Forgotten Realms - South Africa
Nosferatu
Journeyman Poster
Posts: 63
Joined: Fri Jul 21, 2006 9:58 pm

Post by Nosferatu »

BIG BIG THNX that is really helps me !
i'll find and fix runaway script :)
thnx once more .
Post Reply