359 lines
14 KiB
Plaintext
359 lines
14 KiB
Plaintext
///////////////////////////////////////////////////////////////////////////////
|
|
// DEEP DEBUG DUMP - By Deva Bryson Winblood
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// this will dump a huge amount of information to the logs
|
|
// related to this module at the time the deep debug was called
|
|
// it will space out many of the parts with delays to prevent TMI errors
|
|
// and hopefully cause less of an impact on the module.
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// Make sure a waypoint with the tag AREA_DEBUG is dropped into each area of
|
|
// the module. Drop only one per area or the stats for that area will be
|
|
// counted twice.
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
const string sBanner="//////////////////////////////////////////////////////////";
|
|
const string sSeparater="----------------------------------------------------------";
|
|
const string sDumpPre="DEEPDUMPPREFIX";
|
|
|
|
void fnBeginDump(); // main dump routine
|
|
void fnStatsByArea(int nMainC,int nC,object oArea=OBJECT_INVALID);
|
|
|
|
//////////////////////////////////////////////////////////////////////// MAIN
|
|
void main()
|
|
{
|
|
string sMsg;
|
|
object oOb;
|
|
int nC;
|
|
sMsg="DEEP DEBUG DUMP for Module '"+GetName(GetModule())+"'";
|
|
PrintString(" ");
|
|
PrintString(sBanner);
|
|
PrintString(sMsg);
|
|
PrintString(sSeparater);
|
|
sMsg="TIME DUMP BEGAN: "+IntToString(GetTimeHour())+":"+IntToString(GetTimeMinute());
|
|
sMsg=sMsg+" Day:"+IntToString(GetCalendarDay())+" Year:"+IntToString(GetCalendarYear());
|
|
PrintString(sMsg);
|
|
PrintString(sBanner);
|
|
DelayCommand(1.0,fnBeginDump());
|
|
}
|
|
//////////////////////////////////////////////////////////////////////// MAIN
|
|
|
|
////////////////////////////////
|
|
// FUNCTIONS
|
|
////////////////////////////////
|
|
|
|
|
|
void fnCleanupVariables()
|
|
{ // delete locals used by this script
|
|
object oMod=GetModule();
|
|
DeleteLocalInt(oMod,sDumpPre+"creatures");
|
|
DeleteLocalInt(oMod,sDumpPre+"placeables");
|
|
DeleteLocalInt(oMod,sDumpPre+"useables");
|
|
DeleteLocalInt(oMod,sDumpPre+"plots");
|
|
DeleteLocalInt(oMod,sDumpPre+"containers");
|
|
DeleteLocalInt(oMod,sDumpPre+"items");
|
|
DeleteLocalInt(oMod,sDumpPre+"triggers");
|
|
DeleteLocalInt(oMod,sDumpPre+"ttrans");
|
|
DeleteLocalInt(oMod,sDumpPre+"dtrans");
|
|
DeleteLocalInt(oMod,sDumpPre+"doors");
|
|
DeleteLocalInt(oMod,sDumpPre+"players");
|
|
DeleteLocalInt(oMod,sDumpPre+"dms");
|
|
DeleteLocalInt(oMod,sDumpPre+"waypoints");
|
|
DeleteLocalInt(oMod,sDumpPre+"stores");
|
|
DeleteLocalInt(oMod,sDumpPre+"other");
|
|
DeleteLocalInt(oMod,sDumpPre+"areas");
|
|
} // fnCleanupVariables()
|
|
|
|
void fnCleanupVariablesA()
|
|
{ // delete locals used by this script
|
|
object oMod=GetModule();
|
|
DeleteLocalInt(oMod,sDumpPre+"Acreatures");
|
|
DeleteLocalInt(oMod,sDumpPre+"Aplaceables");
|
|
DeleteLocalInt(oMod,sDumpPre+"Auseables");
|
|
DeleteLocalInt(oMod,sDumpPre+"Aplots");
|
|
DeleteLocalInt(oMod,sDumpPre+"Acontainers");
|
|
DeleteLocalInt(oMod,sDumpPre+"Aitems");
|
|
DeleteLocalInt(oMod,sDumpPre+"Atriggers");
|
|
DeleteLocalInt(oMod,sDumpPre+"Adoors");
|
|
DeleteLocalInt(oMod,sDumpPre+"Attrans");
|
|
DeleteLocalInt(oMod,sDumpPre+"Adtrans");
|
|
DeleteLocalInt(oMod,sDumpPre+"Aplayers");
|
|
DeleteLocalInt(oMod,sDumpPre+"Adms");
|
|
DeleteLocalInt(oMod,sDumpPre+"Awaypoints");
|
|
DeleteLocalInt(oMod,sDumpPre+"Astores");
|
|
DeleteLocalInt(oMod,sDumpPre+"Aother");
|
|
} // fnCleanupVariables()
|
|
|
|
void fnModuleStats()
|
|
{
|
|
object oMod=GetModule();
|
|
int nC;
|
|
string sMsg;
|
|
PrintString(sSeparater);
|
|
PrintString("[=====================[ MODULE WIDE TOTAL ]=================]");
|
|
PrintString(sSeparater);
|
|
nC=GetLocalInt(oMod,sDumpPre+"creatures");
|
|
PrintString("CREATURES :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"players");
|
|
PrintString("CREATURES Players :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"dms");
|
|
PrintString("CREATURES Players/DMs :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"placeables");
|
|
PrintString("PLACEABLES :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"plots");
|
|
PrintString("PLACEABLES Plot :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"useables");
|
|
PrintString("PLACEABLES Useable :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"containers");
|
|
PrintString("PLACEABLES Containers :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"items");
|
|
PrintString("ITEMS :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"triggers");
|
|
PrintString("TRIGGERS :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"ttrans");
|
|
PrintString("TRIGGERS Transitions :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"doors");
|
|
PrintString("DOORS :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"dtrans");
|
|
PrintString("DOORS Transitions :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"waypoints");
|
|
PrintString("WAYPOINTS :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"stores");
|
|
PrintString("STORES :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"other");
|
|
PrintString("OTHER [unclassified] :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"areas");
|
|
PrintString("AREAS :"+IntToString(nC));
|
|
PrintString(sBanner);
|
|
sMsg="TIME DUMP COMPLETED: "+IntToString(GetTimeHour())+":"+IntToString(GetTimeMinute());
|
|
sMsg=sMsg+" Day:"+IntToString(GetCalendarDay())+" Year:"+IntToString(GetCalendarYear());
|
|
PrintString(sMsg);
|
|
PrintString(sBanner);
|
|
fnCleanupVariables();
|
|
oMod=GetLocalObject(oMod,"oRTSVoteInitiate");
|
|
if (oMod!=OBJECT_INVALID) SendMessageToPC(oMod,"The DEEP DEBUG DUMP that was voted on is COMPLETE!");
|
|
} // fnModuleStats()
|
|
|
|
|
|
void fnOutputAreaStats()
|
|
{ // print the area stats
|
|
object oMod=GetModule();
|
|
int nC;
|
|
nC=GetLocalInt(oMod,sDumpPre+"Acreatures");
|
|
PrintString("CREATURES :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Aplayers");
|
|
PrintString("CREATURES Players :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Adms");
|
|
PrintString("CREATURES Players/DMs :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Aplaceables");
|
|
PrintString("PLACEABLES :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Aplots");
|
|
PrintString("PLACEABLES Plot :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Auseables");
|
|
PrintString("PLACEABLES Useable :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Acontainers");
|
|
PrintString("PLACEABLES Containers :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Aitems");
|
|
PrintString("ITEMS :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Atriggers");
|
|
PrintString("TRIGGERS :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Attrans");
|
|
PrintString("TRIGGERS Transitions :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Adoors");
|
|
PrintString("DOORS :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Adtrans");
|
|
PrintString("DOORS Transitions :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Awaypoints");
|
|
PrintString("WAYPOINTS :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Astores");
|
|
PrintString("STORES :"+IntToString(nC));
|
|
nC=GetLocalInt(oMod,sDumpPre+"Aother");
|
|
PrintString("OTHER [unclassified] :"+IntToString(nC));
|
|
fnCleanupVariablesA();
|
|
} // fnOutputAreaStats()
|
|
|
|
void fnStatsByArea(int nMainC,int nC,object oArea=OBJECT_INVALID)
|
|
{ // fnStatsByArea
|
|
object oOb;
|
|
object oWP;
|
|
object oMod=GetModule();
|
|
int nCount;
|
|
int nOT;
|
|
if (oArea==OBJECT_INVALID&&nMainC!=-1)
|
|
{ // new area
|
|
oWP=GetObjectByTag("AREA_DEBUG",nMainC);
|
|
if (oWP!=OBJECT_INVALID)
|
|
{ // new area
|
|
PrintString(sSeparater);
|
|
PrintString("[ Area statistics for area '"+GetName(GetArea(oWP))+"' TAG:"+GetTag(GetArea(oWP))+" RESREF:"+GetResRef(GetArea(oWP))+" ]");
|
|
PrintString(sSeparater);
|
|
fnCleanupVariablesA();
|
|
DelayCommand(1.0,fnStatsByArea(nMainC,0,GetArea(oWP)));
|
|
} // new area
|
|
else
|
|
{ // done with area stats
|
|
DelayCommand(1.0,fnModuleStats());
|
|
} // done with area stats
|
|
} // new area
|
|
else
|
|
{ // count items
|
|
oOb=GetFirstObjectInArea(oArea);
|
|
nCount=0;
|
|
while(oOb!=OBJECT_INVALID)
|
|
{ // count objects
|
|
nOT=GetObjectType(oOb);
|
|
if (nOT==OBJECT_TYPE_CREATURE)
|
|
{ // creature
|
|
nCount=GetLocalInt(oMod,sDumpPre+"creatures");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"creatures",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Acreatures");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Acreatures",nCount);
|
|
if (GetIsPC(oOb)==TRUE)
|
|
{ // PC
|
|
nCount=GetLocalInt(oMod,sDumpPre+"players");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"players",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Aplayers");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Aplayers",nCount);
|
|
} // PC
|
|
if (GetIsDM(oOb)==TRUE)
|
|
{ // DM
|
|
nCount=GetLocalInt(oMod,sDumpPre+"dms");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"dms",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Adms");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Adms",nCount);
|
|
} // DM
|
|
} // creature
|
|
else if (nOT==OBJECT_TYPE_ITEM)
|
|
{ // item
|
|
nCount=GetLocalInt(oMod,sDumpPre+"items");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"items",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Aitems");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Aitems",nCount);
|
|
} // item
|
|
else if (nOT==OBJECT_TYPE_PLACEABLE)
|
|
{ // placeable
|
|
nCount=GetLocalInt(oMod,sDumpPre+"placeables");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"placeables",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Aplaceables");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Aplaceables",nCount);
|
|
if (GetPlotFlag(oOb)==TRUE)
|
|
{ // plot
|
|
nCount=GetLocalInt(oMod,sDumpPre+"plots");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"plots",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Aplots");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Aplots",nCount);
|
|
} // plot
|
|
if (GetHasInventory(oOb)==TRUE)
|
|
{ // container
|
|
nCount=GetLocalInt(oMod,sDumpPre+"containers");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"containers",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Acontainers");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Acontainers",nCount);
|
|
} // container
|
|
if (GetUseableFlag(oOb)==TRUE)
|
|
{ // useable
|
|
nCount=GetLocalInt(oMod,sDumpPre+"usables");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"usables",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Ausables");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Ausables",nCount);
|
|
} // useable
|
|
} // placeable
|
|
else if (nOT==OBJECT_TYPE_STORE)
|
|
{ // store
|
|
nCount=GetLocalInt(oMod,sDumpPre+"stores");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"stores",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Astores");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Astores",nCount);
|
|
} // store
|
|
else if (nOT==OBJECT_TYPE_TRIGGER)
|
|
{ // trigger
|
|
nCount=GetLocalInt(oMod,sDumpPre+"triggers");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"triggers",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Atriggers");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Atriggers",nCount);
|
|
if (GetTransitionTarget(oOb)!=OBJECT_INVALID)
|
|
{ // transition
|
|
nCount=GetLocalInt(oMod,sDumpPre+"ttrans");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"ttrans",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Attrans");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Attrans",nCount);
|
|
} // transition
|
|
} // trigger
|
|
else if (nOT==OBJECT_TYPE_DOOR)
|
|
{ // door
|
|
nCount=GetLocalInt(oMod,sDumpPre+"doors");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"doors",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Adoors");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Adoors",nCount);
|
|
if (GetTransitionTarget(oOb)!=OBJECT_INVALID)
|
|
{ // transition
|
|
nCount=GetLocalInt(oMod,sDumpPre+"dtrans");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"dtrans",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Adtrans");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Adtrans",nCount);
|
|
} // transition
|
|
} // door
|
|
else if (nOT==OBJECT_TYPE_WAYPOINT)
|
|
{ // waypoints
|
|
nCount=GetLocalInt(oMod,sDumpPre+"waypoints");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"waypoints",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Awaypoints");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Awaypoints",nCount);
|
|
} // waypoints
|
|
else
|
|
{ // other
|
|
nCount=GetLocalInt(oMod,sDumpPre+"other");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"other",nCount);
|
|
nCount=GetLocalInt(oMod,sDumpPre+"Aother");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"Aother",nCount);
|
|
} // other
|
|
oOb=GetNextObjectInArea(oArea);
|
|
} // count objects
|
|
nCount=GetLocalInt(oMod,sDumpPre+"areas");
|
|
nCount++;
|
|
SetLocalInt(oMod,sDumpPre+"areas",nCount);
|
|
DelayCommand(1.0,fnOutputAreaStats());
|
|
DelayCommand(1.5,fnStatsByArea(nMainC+1,0,OBJECT_INVALID)); // next area
|
|
} // count items
|
|
} // fnStatsByArea
|
|
|
|
|
|
|
|
void fnBeginDump()
|
|
{ // initiate the dump
|
|
object oMod=GetModule();
|
|
SendMessageToPC(GetLocalObject(oMod,"oRTSVoteInitiate"),"The DEEP DEBUG DUMP has begun. You will be notified when it is complete.");
|
|
fnCleanupVariables();
|
|
PrintString("[--- STATISTICS BROKEN DOWN BY AREA ---]");
|
|
fnStatsByArea(0,0,OBJECT_INVALID);
|
|
} // initiate the dump
|
|
|