UW2_PRC8/_module/nss/rr_debug.nss
Jaysyn904 2bb2c470e0 Updated to PRC8
Updated to PRC8.  Further function integration.  Fixed NPC onDeath script.   Full compile.  Updated release archive.
2024-02-20 22:24:11 -05:00

171 lines
5.8 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "prc_inc_spells"
// * colors are: "darkred", "darkblue", "darkgreen",
// "lightred", "lightblue", "lightgreen",
// "white", "random"
const string DEBUGCOLOR = "white";
void Debug(string sData, string sLabel = "String");
void Debugi(int iData, string sLabel = "Int ");
void Debugf(float fData, string sLabel = "Float ");
void Debugo(object oData, string sLabel = "Object");
void ToAll(string s);
void ObjectRoleCall();
void ItemRoleCall();
string GetAllIPs(object oItem);
string IPType(int i);
void ObjectAquisitionLastRoleCall();
void ObjectAquisitionTagBasedRoleCall();
// 0-255: !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz~<7E>굛꼨냷닀뒎뙉몤뱮븭뿕솞썫옝、ⅶŁかЛ<E3818B>갚껙뉘떱만본섹씩읒쩠컵판훔墾勁卦今錄桐虜妹膊覆泗褻栒鴨鉛僥幽日全增彩充坂沆樺詰
string Colorfy(string s, string color = "random");
// returns a three digit string usable by other textblitz functions
string RandomColor();
void Debug(string sData, string sLabel = "String")
{
ToAll(sLabel + ": " + sData);
}
void Debugi(int iData, string sLabel = "Int")
{
ToAll(sLabel + ": " + IntToString(iData));
}
void Debugf(float fData, string sLabel = "Float")
{
ToAll(sLabel + ": " + FloatToString(fData));
}
void ToAll(string s)
{
object oPC = GetFirstPC();
while(GetIsObjectValid(oPC))
{
FloatingTextStringOnCreature(Colorfy(s, DEBUGCOLOR), oPC, FALSE);
oPC = GetNextPC();
}
}
// returns a three digit string usable by other textblitz functions
string RandomColor()
{
string x = "!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz~<7E>굛꼨냷닀뒎뙉몤뱮븭뿕솞썫옝、ⅶŁかЛ<E3818B>갚껙뉘떱만본섹씩읒쩠컵판훔墾勁卦今錄桐虜妹膊覆泗褻栒鴨鉛僥幽日全增彩充坂沆樺詰";
string c1 = "";
string c2 = "";
string c3 = "";
while (c1 == "") c1 = GetSubString(x, Random(251), 1);
while (c2 == "") c2 = GetSubString(x, Random(251), 1);
while (c3 == "") c3 = GetSubString(x, Random(251), 1);
return c1 + c2 + c3;
}
string Colorfy(string s, string color = "random")
{
if (color == "darkred") color = "~ ";
if (color == "lightred") color = "<22> ";
if (color == "darkblue") color = " ~";
if (color == "lightblue") color = " <20>";
if (color == "darkgreen") color = " ~ ";
if (color == "lightgreen") color = " <20> ";
if (color == "white") color = "<22><>";
if (color == "random") color = RandomColor();
return "<c" + color + ">" + s + "</c>";
}
void ObjectRoleCall()
{
ToAll("*** *** *** OBJECT ROLE CALL *** *** ***");
object oArea = GetArea(GetFirstPC());
object o = GetFirstObjectInArea(oArea);
while(GetIsObjectValid(o))
{
Debug("Here", GetName(o));
o = GetNextObjectInArea(oArea);
}
}
void ItemRoleCall()
{
ToAll("*** *** *** ITEM ROLE CALL *** *** ***");
object oPC = GetFirstPC();
object oItem = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oItem))
{
Debug(GetAllIPs(oItem), GetName(oItem));
oItem = GetNextItemInInventory(oPC);
}
int i = 0;
for(i=0;i<14;i++)
{
oItem = GetItemInSlot(i, oPC);
if (GetIsObjectValid(oItem)) Debug(GetAllIPs(oItem), GetName(oItem));
}
}
string GetAllIPs(object oItem)
{
string s = "IPs are: ";
itemproperty ip = GetFirstItemProperty(oItem);
while(GetIsItemPropertyValid(ip))
{
s += " > " + IntToString(GetItemPropertyType(ip)) + " " + IntToString(GetItemPropertySubType(ip)) + " " + IntToString(GetItemPropertyDurationType(ip)) + " < ";
ip = GetNextItemProperty(oItem);
}
return s;
}
void Debugo(object oData, string sLabel = "Object")
{
ToAll(sLabel + ": " + GetName(oData));
}
void ObjectAquisitionLastRoleCall()
{
ToAll("*** *** *** AQUISITION LAST ROLE CALL *** *** ***");
Debugo(GetLastAttacker(), "GetLastAttacker");
Debugo(GetLastClosedBy(), "GetLastClosedBy");
Debugo(GetLastDamager(), "GetLastDamager");
Debugo(GetLastDisarmed(), "GetLastDisarmed");
Debugo(GetLastDisturbed(), "GetLastDisturbed");
Debugo(GetLastHostileActor(), "GetLastHostileActor");
Debugo(GetLastKiller(), "GetLastKiller");
Debugo(GetLastLocked(), "GetLastLocked");
Debugo(GetLastOpenedBy(), "GetLastOpenedBy");
Debugo(GetLastPCRested(), "GetLastPCRested");
Debugo(GetLastPCToCancelCutscene(), "GetLastPCToCancelCutscene");
Debugo(GetLastPerceived(), "GetLastPerceived");
Debugo(GetLastPlayerDied(), "GetLastPlayerDied");
Debugo(GetLastPlayerDying(), "GetLastPlayerDying");
Debugo(GetLastRespawnButtonPresser(), "GetLastRespawnButtonPresser");
Debugo(GetLastSpeaker(), "GetLastSpeaker");
Debugo(GetLastSpellCaster(), "GetLastSpellCaster");
Debugo(GetLastTrapDetected(), "GetLastTrapDetected");
Debugo(GetLastUnlocked(), "GetLastUnlocked");
Debugo(GetLastUsedBy(), "GetLastUsedBy");
Debugo(GetPCItemLastEquipped(), "GetPCItemLastEquipped");
Debugo(GetPCItemLastEquippedBy(), "GetPCItemLastEquippedBy");
Debugo(GetPCItemLastUnequipped(), "GetPCItemLastUnequipped");
Debugo(GetPCItemLastUnequippedBy(), "GetPCItemLastUnequippedBy");
Debugo(GetPlaceableLastClickedBy(), "GetPlaceableLastClickedBy");
}
void ObjectAquisitionTagBasedRoleCall()
{
ToAll("*** *** *** AQUISITION TAGBASED ROLE CALL *** *** ***");
Debugo(PRCGetSpellCastItem(), "PRCGetSpellCastItem");
Debugo(PRCGetSpellTargetObject(), "PRCGetSpellTargetObject");
Debugo(GetItemActivator(), "GetItemActivator");
Debugo(GetItemActivated(), "GetItemActivated");
Debugo(GetPCItemLastEquippedBy(), "GetPCItemLastEquippedBy");
Debugo(GetPCItemLastEquipped(), "GetPCItemLastEquipped");
Debugo(GetPCItemLastUnequippedBy(), "GetPCItemLastUnequippedBy");
Debugo(GetPCItemLastUnequipped(), "GetPCItemLastUnequipped");
Debugo(GetModuleItemAcquiredBy(), "GetModuleItemAcquiredBy");
Debugo(GetModuleItemAcquired(), "GetModuleItemAcquired");
Debugo(GetModuleItemLostBy(), "GetModuleItemLostBy");
Debugo(GetModuleItemLost(), "GetModuleItemLost");
Debugo(PRCGetSpellTargetObject(), "PRCGetSpellTargetObject");
}