117 lines
2.6 KiB
Plaintext
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 <20> >";}
|
|||
|
if(nRandom ==3)
|
|||
|
{sColor = "<c <20>>";}
|
|||
|
if(nRandom ==4)
|
|||
|
{sColor = "<c <20><>>";}
|
|||
|
if(nRandom ==5)
|
|||
|
{sColor = "<c<><63> >";}
|
|||
|
if(nRandom ==6)
|
|||
|
{sColor = "<c<><63> >";}
|
|||
|
if(nRandom ==7)
|
|||
|
{sColor = "<c<>k<EFBFBD>>";}
|
|||
|
if(nRandom ==8)
|
|||
|
{sColor = "<c <20> >";}
|
|||
|
if(nRandom ==9)
|
|||
|
{sColor = "<c <20><>>";}
|
|||
|
if(nRandom ==10)
|
|||
|
{sColor = "<c<> <20>>";}
|
|||
|
|
|||
|
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
|
|||
|
}
|