PoA_PRC8/module/nss/setplotcolor.nss
Jaysyn904 128e7e59a4 Initial upload
Initial upload
2022-10-07 14:20:31 -04:00

117 lines
2.6 KiB
Plaintext

//Script Name: setplotcolor
//////////////////////////////////////////
//Created by: Genisys / Guile
//ON: 6/17/08
/////////////////////////////////////////
/* **Notes**
This script goes in the Action Taken
of a Converstion Line ONLY! It will
colorize ALL Of the items in a PCs
inventory a random color.
*/
////////////////////////////////////////
//Main Script//
void main()
{
//Define Major Variables
object oPC = GetPCSpeaker() ;
object oItem;
string sColor;
int nRandom = d10(1);
//Randomize the Color
if(nRandom ==1)
{sColor = "<cþ >";}
if(nRandom ==2)
{sColor = "<c þ >";}
if(nRandom ==3)
{sColor = "<c þ>";}
if(nRandom ==4)
{sColor = "<c þþ>";}
if(nRandom ==5)
{sColor = "<cþþ >";}
if(nRandom ==6)
{sColor = "<cþŒ >";}
if(nRandom ==7)
{sColor = "<cªkþ>";}
if(nRandom ==8)
{sColor = "<c ð >";}
if(nRandom ==9)
{sColor = "<c ‚ð>";}
if(nRandom ==10)
{sColor = "<c¥ ¥>";}
oItem = GetFirstItemInInventory(oPC);
//Loop through all the items in the PC's inventory..
while(GetIsObjectValid(oItem)==TRUE)
{
//Be careful with items with a color string already on them!!!
if(GetSubString(GetName(oItem), 0, 2)=="<c")
{
if(GetPlotFlag(oItem)==TRUE)
{
//Get the actual name of the item minus the color code..
string sName = GetSubString(GetName(oItem), 6, 40);
//Set the color to the item's name
SetName(oItem, "<c¥ >" + sName);
}
else
{
//Get the actual name of the item minus the color code..
string sName = GetSubString(GetName(oItem), 6, 40);
//Set the color to the item's name
SetName(oItem, sColor + sName);
}
//end if statement
}
//Since there is no color tag on the item's name give it one..
else
{
if(GetPlotFlag(oItem)==TRUE)
{
//Set the random color to the item's name..
SetName(oItem, "<c¥ >" + GetName(oItem));
}
else
{
//Set the random color to the item's name..
SetName(oItem, sColor + GetName(oItem));
}
}
//Get all of the items!
oItem = GetNextItemInInventory(oPC);
}
//Next cycle through all items equipped by the PC///
int nSlot;
for (nSlot=0; nSlot<NUM_INVENTORY_SLOTS; nSlot++)
{
oItem=GetItemInSlot(nSlot, oPC);
//Be careful with items with a color string already on them!!!
if(GetSubString(GetName(oItem), 0, 2)=="<c")
{
//Get the actual name of the item minus the color code..
string sName2 = GetSubString(GetName(oItem), 6, 40);
//Set the color to the item's name
SetName(oItem, sColor + sName2);
}
//Since there is no color tag on the item's name give it one..
else
{
//Set the random color to the item's name..
SetName(oItem, sColor + GetName(oItem));
}
//end loop
}
//End Script
}