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

79 lines
2.2 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: coloritemrandom
////////////////////////////////////////////////
//Created by: Genisys / Guile
//ON: 6/17/08
////////////////////////////////////////////////
/* **Notes**
This script goes in the ActionTaken
event of the coloritemconv conversation
on the line which allow the player to
select a random color for their item.
*/
////////////////////////////////////////////////
//WARNING: DO NOT TOUCH THE STRINGS BELOW THIS LINE!!!
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();
string sName = GetLocalString(oPC, "ONNC");
string sMod;
string sToken;
string sNew;
int a;
int b;
int c;
object oItem;
//Cycle through thier inventory to find the proper item(s)
oItem = GetFirstItemInInventory(oPC);
while(GetIsObjectValid(oItem)==TRUE)
{
//Change all items with the same name to a different color
if(GetName(oItem)==sName)
{
//Let's make sure it doesn't already have a color on it!!!
if(GetStringLeft(sName, 2)=="<c")
{
//Get the original name without the color strings!
sMod = GetSubString(sName, 6, 40);
}
else
{
sMod = sName;
}
a = Random(255); b = Random(255); c = Random(255);
//This color value will change EVERY time an item is selected.
sToken = ColorString(a,b,c);
//The new name of item (Color + Original Name)
sNew = sToken + sMod;
//Change the name to include color..
SetName(oItem, sNew);
}
oItem = GetNextItemInInventory(oPC);
}
//Remove the variables from the PC
DelayCommand(2.2, DeleteLocalString(oPC, "ONNC"));
//Main Script End
}