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

105 lines
3.0 KiB
Plaintext
Raw 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.

//Script Name: setrandomcolor
//////////////////////////////////////////
//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, each item a
different color!
*/
////////////////////////////////////////
//WARNING: DON'T TOUCH THE STRINGS BELOW!!!!!!////
const string COLORTOKEN = " ##################$%&'()*+,-./0123456789:;;==?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[[]^_`abcdefghijklmnopqrstuvwxyz{|}~~€<>ƒ„…†‡ˆ‰ŠŒ<E280B9>Ž<EFBFBD><C5BD>“”•˜™šœ<E280BA>žŸ¡¡¢£¤¥¦§¨©ª«¬¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþþ";
// returns a properly color-coded string based on specified RGB values
string ColorString(int nRed=255, int nGreen=255, int nBlue=255)
{
return "<c" + GetSubString(COLORTOKEN, nRed, 1) + GetSubString(COLORTOKEN, nGreen, 1) + GetSubString(COLORTOKEN, nBlue, 1) + ">";
}
//Main Script//
void main()
{
//Define Major Variables
object oPC = GetPCSpeaker() ;
object oItem;
string sColor;
int a;
int b;
int 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")
{
a = Random(255); b = Random(255); c = Random(255);
//This color value will change EVERY time an item is selected.
sColor = ColorString(a,b,c);
//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);
}
//Since there is no color tag on the item's name give it one..
else
{
a = Random(255); b = Random(255); c = Random(255);
//This color value will change EVERY time an item is selected.
sColor = ColorString(a,b,c);
//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")
{
a = Random(255); b = Random(255); c = Random(255);
//This color value will change EVERY time an item is selected.
sColor = ColorString(a,b,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
{
a = Random(255); b = Random(255); c = Random(255);
//This color value will change EVERY time an item is selected.
sColor = ColorString(a,b,c);
//Set the random color to the item's name..
SetName(oItem, sColor + GetName(oItem));
}
//end loop
}
//End Script
}