storage.txt - Datafile

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

storage.txt - Datafile

Post by RusseL »

storage.txt size = 142 MB!
there are so many items, which never be used anymore.

server with a long history that was 4 times wiped (characters, accounts, multis)
how can i clean this file?
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Re: storage.txt - Datafile

Post by CWO »

I forgot where I got this script from. I know I didn't write it but I think its from one of the official distros. This is www script that shows the contents of your storage and how it's organized. This won't modify or delete anything but at least you'll get an idea what is where.

Code: Select all

use uo;
use os;
use http;
use polsys;


program HTMLPage()
	DoHeader("Server Management Storage");

	TableHeader("Storage");
	var storage_area := QueryParam("Area");
	var container := QueryParam("Root");

	if ( storage_area && container )
		ShowContainer(storage_area, container);
	elseif ( storage_area )
		ShowStorageArea(storage_area);
	else
		ListStorageAreas();
	endif

	DoFooter();

	return 1;
endprogram

function ShowContainer(storage_area, container)
	container := SystemFindObjectBySerial(CInt(container));

	WriteHTML("<P>Storage Area - <A HREF='?Area="+storage_area+"'>"+storage_area+"</A><BR>");
	WriteHTML("Root Container - "+container.desc+"</P>");

	WriteHTML("<TABLE>");
	WriteHTML("<TR>");
	WriteHTML("<TD CLASS='header2'>Name</TD><TD CLASS='header2'>Serial</TD>");
	WriteHTML("</TR>");
	foreach item in ( EnumerateItemsInContainer(container) )
		WriteHTML("<TR>");
		WriteHTML("<TD>"+item.desc+"</TD>");
		WriteHTML("<TD>"+Hex(item.serial)+"</TD>");
		WriteHTML("</TR>");
		SleepMS(2);
	endforeach
	WriteHTML("</TABLE>");

	return 1;
endfunction

function ShowStorageArea(storage_area)
	var storage_areas := StorageAreas();
	var area := storage_areas[storage_area];

	WriteHTML("<P>Storage Area - "+storage_area+"</P>");
	WriteHTML("<P>Root Items: "+area.count+"<BR>");
	WriteHTML("Total Items: "+area.totalcount+"</P>");

	WriteHTML("<TABLE>");
	WriteHTML("<TR>");
	WriteHTML("<TD CLASS='header2'>Name</TD><TD CLASS='header2'>Item Count</TD>");
	WriteHTML("</TR>");
	foreach container in ( area )
		WriteHTML("<TR>");
		WriteHTML("<TD><A HREF='?Area="+storage_area+"&Root="+Hex(container.serial)+"'>"+container.desc+"</TD>");
		WriteHTML("<TD>"+container.item_count+"</TD>");
		WriteHTML("</TR>");
		SleepMS(2);
	endforeach

	WriteHTML("</TABLE>");

	return 1;
endfunction

function ListStorageAreas()
	WriteHTML("<P>Storage Areas</P>");

	WriteHTML("<TABLE>");
	WriteHTML("<TR>");
	WriteHTML("<TD CLASS='header2'>Area Name</TD>");
	WriteHTML("<TD CLASS='header2'>Root Item Count</TD>");
	WriteHTML("<TD CLASS='header2'>Total Items</TD>");
	foreach area in ( StorageAreas() )
		WriteHTML("<TR>");
		WriteHTML("<TD><A HREF='?Area="+area+"'>"+area+"</A></TD>");
		WriteHTML("<TD>"+area.count+"</TD>");
		WriteHTML("<TD>"+area.totalcount+"</TD>");
		WriteHTML("</TR>");
		SleepMS(2);
	endforeach

	WriteHTML("</TABLE>");

	return 1;
endfunction

function DoHeader(title:="")
	WriteHTML("<HEAD>");
	WriteHTML("<TITLE>"+title+"</TITLE>");
	WriteHTML("<LINK REL='stylesheet' TYPE='text/css' HREF='../../stylesheet.css'>");
	WriteHTML("</HEAD>");

	WriteHTML("<BODY>");
	return 1;
endfunction

function DoFooter()
	WriteHTML("</BODY>");

	return 1;
endfunction

function TableHeader(name:="")
	WriteHtmlRaw("<TABLE WIDTH='100%'>"
		+"<TR>"
		+"<TD VALIGN='TOP' WIDTH='100%' CLASS='header'><STRONG><BIG>"+name+"</BIG></STRONG></TD>"
		+"<TD WIDTH='100' VALIGN='TOP' ALIGN='CENTER' NOWRAP CLASS='header2'><A HREF='index.ecl'><FONT SIZE=1>ServMgmt Home</FONT></A></TD>"
		+"</TR>"
		+"</TABLE>");

	return 1;
endfunction
Likely if things have numbers in them, they are serial numbers. NPC storage or bankboxes are usually done this way. In that case, I would say to try and create something that searches through these storage names, gets the serial numbers, then finds the object tied to that serial. If it doesn't exist, delete the storage.
Post Reply