Initial upload
Initial upload
This commit is contained in:
103
module/nss/coloritemred.nss
Normal file
103
module/nss/coloritemred.nss
Normal file
@@ -0,0 +1,103 @@
|
||||
//Script Name: coloritemred
|
||||
////////////////////////////////////////////////
|
||||
//Created by: Genisys / Guile
|
||||
//ON: 6/17/08
|
||||
////////////////////////////////////////////////
|
||||
/* **Notes**
|
||||
|
||||
This script goes in the ActionTaken
|
||||
event of the coloritemconv conversation
|
||||
on the line which will turn the item targeted
|
||||
to the proper color that matches this script's
|
||||
name (ie coloritemwhite script goes on the line
|
||||
which changes the color to white!)
|
||||
|
||||
**These GetRGB(#,#,#) are the functions you use to get the proper
|
||||
color for the token you are setting on the item name.**
|
||||
|
||||
GetRGB() := WHITE // no parameters, default is white
|
||||
GetRGB(15,15,1):= YELLOW
|
||||
GetRGB(15,5,1) := ORANGE
|
||||
GetRGB(15,1,1) := RED
|
||||
GetRGB(7,7,15) := BLUE
|
||||
GetRGB(1,15,1) := NEON GREEN
|
||||
GetRGB(1,11,1) := GREEN
|
||||
GetRGB(9,6,1) := BROWN
|
||||
GetRGB(11,9,11):= LIGHT PURPLE
|
||||
GetRGB(12,10,7):= TAN
|
||||
GetRGB(8,1,8) := PURPLE
|
||||
GetRGB(13,9,13):= PLUM
|
||||
GetRGB(1,7,7) := TEAL
|
||||
GetRGB(1,15,15):= CYAN
|
||||
GetRGB(1,1,15) := BRIGHT BLUE
|
||||
*/
|
||||
////////////////////////////////////////////////
|
||||
|
||||
///PROTOTYPE///
|
||||
|
||||
//This color system is by Genji, w/ special thanks to
|
||||
//ADAL-Miko & Rich Dersheimer for their help to Genji :)
|
||||
string GetRGB(int red = 15,int green = 15,int blue = 15);
|
||||
|
||||
|
||||
//Main Script//
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
//Define Major Variables
|
||||
object oPC = GetPCSpeaker();
|
||||
string sName = GetLocalString(oPC, "ONNC");
|
||||
|
||||
//string sToken = GetRGB(#,#,#);
|
||||
//(This is the proper function you need to create below!)
|
||||
string sToken = GetRGB(15,1,1); //Red
|
||||
|
||||
string sMod;
|
||||
|
||||
|
||||
//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;
|
||||
}
|
||||
//The new name of item (Color + Original Name)
|
||||
string sNew = sToken + sMod;
|
||||
|
||||
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
|
||||
if(GetName(oItem)==sName)
|
||||
//Change the name to include color..
|
||||
SetName(oItem, sNew);
|
||||
|
||||
oItem = GetNextItemInInventory(oPC);
|
||||
}
|
||||
|
||||
DestroyObject(OBJECT_SELF, 2.0f);
|
||||
|
||||
//Remove the variables from the PC
|
||||
DelayCommand(2.2, DeleteLocalString(oPC, "ONNC"));
|
||||
|
||||
//Main Script End
|
||||
}
|
||||
|
||||
//Prototype String Defined
|
||||
string GetRGB(int red = 15,int green = 15,int blue = 15)
|
||||
{
|
||||
object coloringBook = GetObjectByTag("ColoringBook");
|
||||
if (coloringBook == OBJECT_INVALID)
|
||||
coloringBook = CreateObject(OBJECT_TYPE_ITEM,"gen_coloringbook",GetLocation(GetWaypointByTag("dm_vault_drop")));
|
||||
string buffer = GetName(coloringBook);
|
||||
if(red > 15) red = 15; if(green > 15) green = 15; if(blue > 15) blue = 15;
|
||||
return "<c" + GetSubString(buffer, red - 1, 1) + GetSubString(buffer, green - 1, 1) + GetSubString(buffer, blue - 1, 1) +">";
|
||||
}
|
||||
Reference in New Issue
Block a user