Aller au contenu

Photo

utility scripts [ getvars & showcolors ]


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
kevL

kevL
  • Members
  • 4 070 messages
just a couple of utility scripts.
Pretty self-explanatory, but if there's bugs or something i forgot Pls post up,

 
// 'getvars'
//
// Shows the varname, index, type, and value of all local variables on an object.
// Also, the object's name and tag, or a warning if they haven't been set.
//
// sTag: tag of object to investigate.
//      - if sTag is blank "" use playerCurrentTarget.
//      - accepts 'ginc_param_const' constants, eg. "$MODULE"
// note: also works on targetted items, triggers in debugmode, etc.
// kevL 2014 mar 26

#include "ginc_param_const" // GetTarget


// ___________________
// ** subFunctions ***
//
void Tell(string sTell)
{
    SendMessageToPC(GetFirstPC(FALSE), sTell);
}
//
string GetName_2(object oTarget)
{
    string sRet = "";
    if ("" == (sRet = GetName(oTarget))) sRet = "<c=crimson>name_INVALID</c>";
    return sRet;
}
//
string GetTag_2(object oTarget)
{
    string sRet = "";
    if ("" == (sRet = GetTag(oTarget))) sRet = "<c=crimson>tag_INVALID</c>";
    return sRet;
}


// ___________
// ** MAIN ***
void main(string sTag)
{
    object oTarget = OBJECT_INVALID;
    if (sTag == "")
        oTarget = GetPlayerCurrentTarget(OBJECT_SELF);
    else
        oTarget = GetTarget(sTag);

    if (!GetIsObjectValid(oTarget))
    {
        Tell("\n<c=crimson>Run ( getvars ) Target INVALID</c>");
        return;
    }


    Tell("\n<c=cornflowerblue>run ( getvars ) on</c> " + GetName_2(oTarget)
        + " <c=cornflowerblue>( tag :</c> " + GetTag_2(oTarget) + " <c=cornflowerblue>)</c>");

    int i;
    int iVars = GetVariableCount(oTarget);
    for (i = 0; i < iVars + 1; ++i)
    {
        string sVar = GetVariableName(oTarget, i);
        string sID = IntToString(i);

        int iVarType = GetVariableType(oTarget, i);
        switch (iVarType)
        {
            case VARIABLE_TYPE_INT:
            {
                int iInt = GetVariableValueInt(oTarget, i);
                Tell(sVar + " <c=sandybrown>[ id " + sID + " int ]</c> = " + IntToString(iInt));
            }
            break;

            case VARIABLE_TYPE_FLOAT:
            {
                float fFloat = GetVariableValueFloat(oTarget, i);
                Tell(sVar + " <c=sandybrown>[ id " + sID + " float ]</c> = " + FloatToString(fFloat));
            }
            break;

            case VARIABLE_TYPE_STRING:
            {
                string sString = GetVariableValueString(oTarget, i);
                Tell(sVar + " <c=sandybrown>[ id " + sID + " string ]</c> = " + sString);
            }
            break;

            case VARIABLE_TYPE_DWORD:
            {
                object oObject = GetVariableValueObject(oTarget, i);
                Tell(sVar + " <c=sandybrown>[ id " + sID + " object ]</c> = " + ObjectToString(oObject));
            }
            break;

            case VARIABLE_TYPE_LOCATION:
            {
                location lLoc = GetVariableValueLocation(oTarget, i);
                vector vLoc = GetPositionFromLocation(lLoc);
                object oArea = GetAreaFromLocation(lLoc);
                Tell(sVar + " <c=sandybrown>[ id " + sID + " location ]</c> ="
                    + "\n<c=sandybrown>. . areaName :</c> " + GetName_2(oArea)
                            + " <c=sandybrown>( areaTag :</c> " + GetTag_2(oArea) + " <c=sandybrown>)"
                    + "\n. . vector :</c> ( "
                            + FloatToString(vLoc.x) + ","
                            + FloatToString(vLoc.y) + ","
                            + FloatToString(vLoc.z) + " )"
                    + "\n<c=sandybrown>. . facing :</c> " + FloatToString(GetFacingFromLocation(lLoc)));
            }
            break;

            default:
                Tell("<c=cornflowerblue>. no more Vars</c>");
            break;
        }
    }
}

// 'showcolors'
//
// Prints examples of colors contained in NWN2_Colors.2da to the chat window.
// kevL 2011 aug 18


void main()
{
    object oPC = OBJECT_SELF;

    SendMessageToPC(oPC, "<c=AliceBlue>This is 0                AliceBlue               F0F8FF</c>");
    SendMessageToPC(oPC, "<c=AntiqueWhite>This is 1             AntiqueWhite            FAEBD7</c>");
    SendMessageToPC(oPC, "<c=Aqua>This is 2                     Aqua                    00FFFF</c>");
    SendMessageToPC(oPC, "<c=Aquamarine>This is 3               Aquamarine              7FFFD4</c>");
    SendMessageToPC(oPC, "<c=Azure>This is 4                    Azure                   F0FFFF</c>");
    SendMessageToPC(oPC, "<c=Beige>This is 5                    Beige                   F5F5DC</c>");
    SendMessageToPC(oPC, "<c=Bisque>This is 6                   Bisque                  FFE4C4</c>");
    SendMessageToPC(oPC, "<c=Black>This is 7                    Black                   000000</c>");
    SendMessageToPC(oPC, "<c=BlanchedAlmond>This is 8           BlanchedAlmond          FFEBCD</c>");
    SendMessageToPC(oPC, "<c=Blue>This is 9                     Blue                    0000FF</c>");
    SendMessageToPC(oPC, "<c=BlueViolet>This is 10              BlueViolet              8A2BE2</c>");
    SendMessageToPC(oPC, "<c=Brown>This is 11                   Brown                   A52A2A</c>");
    SendMessageToPC(oPC, "<c=BurlyWood>This is 12               BurlyWood               DEB887</c>");
    SendMessageToPC(oPC, "<c=CadetBlue>This is 13               CadetBlue               5F9EA0</c>");
    SendMessageToPC(oPC, "<c=Chartreuse>This is 14              Chartreuse              7FFF00</c>");
    SendMessageToPC(oPC, "<c=Chocolate>This is 15               Chocolate               D2691E</c>");
    SendMessageToPC(oPC, "<c=Coral>This is 16                   Coral                   FF7F50</c>");
    SendMessageToPC(oPC, "<c=CornflowerBlue>This is 17          CornflowerBlue          6495ED</c>");
    SendMessageToPC(oPC, "<c=Cornsilk>This is 18                Cornsilk                FFF8DC</c>");
    SendMessageToPC(oPC, "<c=Crimson>This is 19                 Crimson                 DC143C</c>");
    SendMessageToPC(oPC, "<c=Cyan>This is 20                    Cyan                    00FFFF</c>");
    SendMessageToPC(oPC, "<c=DarkBlue>This is 21                DarkBlue                00008B</c>");
    SendMessageToPC(oPC, "<c=DarkCyan>This is 22                DarkCyan                008B8B</c>");
    SendMessageToPC(oPC, "<c=DarkGoldenRod>This is 23           DarkGoldenRod           B8860B</c>");
    SendMessageToPC(oPC, "<c=DarkGray>This is 24                DarkGray                A9A9A9</c>");
    SendMessageToPC(oPC, "<c=DarkGreen>This is 25               DarkGreen               006400</c>");
    SendMessageToPC(oPC, "<c=DarkKhaki>This is 26               DarkKhaki               BDB76B</c>");
    SendMessageToPC(oPC, "<c=DarkMagenta>This is 27             DarkMagenta             8B008B</c>");
    SendMessageToPC(oPC, "<c=DarkOliveGreen>This is 28          DarkOliveGreen          556B2F</c>");
    SendMessageToPC(oPC, "<c=DarkOrange>This is 29              DarkOrange              FF8C00</c>");
    SendMessageToPC(oPC, "<c=DarkOrchid>This is 30              DarkOrchid              9932CC</c>");
    SendMessageToPC(oPC, "<c=DarkRed>This is 31                 DarkRed                 8B0000</c>");
    SendMessageToPC(oPC, "<c=DarkSalmon>This is 32              DarkSalmon              E9967A</c>");
    SendMessageToPC(oPC, "<c=DarkSeaGreen>This is 33            DarkSeaGreen            8FBC8F</c>");
    SendMessageToPC(oPC, "<c=DarkSlateBlue>This is 34           DarkSlateBlue           483D8B</c>");
    SendMessageToPC(oPC, "<c=DarkSlateGray>This is 35           DarkSlateGray           2F4F4F</c>");
    SendMessageToPC(oPC, "<c=DarkTurquoise>This is 36           DarkTurquoise           00CED1</c>");
    SendMessageToPC(oPC, "<c=DarkViolet>This is 37              DarkViolet              9400D3</c>");
    SendMessageToPC(oPC, "<c=DeepPink>This is 38                DeepPink                FF1493</c>");
    SendMessageToPC(oPC, "<c=DeepSkyBlue>This is 39             DeepSkyBlue             00BFFF</c>");
    SendMessageToPC(oPC, "<c=DimGray>This is 40                 DimGray                 696969</c>");
    SendMessageToPC(oPC, "<c=DodgerBlue>This is 41              DodgerBlue              1E90FF</c>");
    SendMessageToPC(oPC, "<c=Feldspar>This is 42                Feldspar                D19275</c>");
    SendMessageToPC(oPC, "<c=FireBrick>This is 43               FireBrick               B22222</c>");
    SendMessageToPC(oPC, "<c=FloralWhite>This is 44             FloralWhite             FFFAF0</c>");
    SendMessageToPC(oPC, "<c=ForestGreen>This is 45             ForestGreen             228B22</c>");
    SendMessageToPC(oPC, "<c=Fuchsia>This is 46                 Fuchsia                 FF00FF</c>");
    SendMessageToPC(oPC, "<c=Gainsboro>This is 47               Gainsboro               DCDCDC</c>");
    SendMessageToPC(oPC, "<c=GhostWhite>This is 48              GhostWhite              F8F8FF</c>");
    SendMessageToPC(oPC, "<c=Gold>This is 49                    Gold                    FFD700</c>");
    SendMessageToPC(oPC, "<c=GoldenRod>This is 50               GoldenRod               DAA520</c>");
    SendMessageToPC(oPC, "<c=Gray>This is 51                    Gray                    808080</c>");
    SendMessageToPC(oPC, "<c=Green>This is 52                   Green                   008000</c>");
    SendMessageToPC(oPC, "<c=GreenYellow>This is 53             GreenYellow             ADFF2F</c>");
    SendMessageToPC(oPC, "<c=HoneyDew>This is 54                HoneyDew                F0FFF0</c>");
    SendMessageToPC(oPC, "<c=HotPink>This is 55                 HotPink                 FF69B4</c>");
    SendMessageToPC(oPC, "<c=IndianRed>This is 56               IndianRed               CD5C5C</c>");
    SendMessageToPC(oPC, "<c=Indigo>This is 57                  Indigo                  4B0082</c>");
    SendMessageToPC(oPC, "<c=Ivory>This is 58                   Ivory                   FFFFF0</c>");
    SendMessageToPC(oPC, "<c=Khaki>This is 59                   Khaki                   F0E68C</c>");
    SendMessageToPC(oPC, "<c=Lavender>This is 60                Lavender                E6E6FA</c>");
    SendMessageToPC(oPC, "<c=LavenderBlush>This is 61           LavenderBlush           FFF0F5</c>");
    SendMessageToPC(oPC, "<c=LawnGreen>This is 62               LawnGreen               7CFC00</c>");
    SendMessageToPC(oPC, "<c=LemonChiffon>This is 63            LemonChiffon            FFFACD</c>");
    SendMessageToPC(oPC, "<c=LightBlue>This is 64               LightBlue               ADD8E6</c>");
    SendMessageToPC(oPC, "<c=LightCoral>This is 65              LightCoral              F08080</c>");
    SendMessageToPC(oPC, "<c=LightCyan>This is 66               LightCyan               E0FFFF</c>");
    SendMessageToPC(oPC, "<c=LightGoldenRodYellow>This is 67    LightGoldenRodYellow    FAFAD2</c>");
    SendMessageToPC(oPC, "<c=LightGrey>This is 68               LightGrey               D3D3D3</c>");
    SendMessageToPC(oPC, "<c=LightGreen>This is 69              LightGreen              90EE90</c>");
    SendMessageToPC(oPC, "<c=LightPink>This is 70               LightPink               FFB6C1</c>");
    SendMessageToPC(oPC, "<c=LightSalmon>This is 71             LightSalmon             FFA07A</c>");
    SendMessageToPC(oPC, "<c=LightSeaGreen>This is 72           LightSeaGreen           20B2AA</c>");
    SendMessageToPC(oPC, "<c=LightSkyBlue>This is 73            LightSkyBlue            87CEFA</c>");
    SendMessageToPC(oPC, "<c=LightSlateBlue>This is 74          LightSlateBlue          8470FF</c>");
    SendMessageToPC(oPC, "<c=LightSlateGray>This is 75          LightSlateGray          778899</c>");
    SendMessageToPC(oPC, "<c=LightSteelBlue>This is 76          LightSteelBlue          B0C4DE</c>");
    SendMessageToPC(oPC, "<c=LightYellow>This is 77             LightYellow             FFFFE0</c>");
    SendMessageToPC(oPC, "<c=Lime>This is 78                    Lime                    00FF00</c>");
    SendMessageToPC(oPC, "<c=LimeGreen>This is 79               LimeGreen               32CD32</c>");
    SendMessageToPC(oPC, "<c=Linen>This is 80                   Linen                   FAF0E6</c>");
    SendMessageToPC(oPC, "<c=Magenta>This is 81                 Magenta                 FF00FF</c>");
    SendMessageToPC(oPC, "<c=Maroon>This is 82                  Maroon                  800000</c>");
    SendMessageToPC(oPC, "<c=MediumAquaMarine>This is 83        MediumAquaMarine        66CDAA</c>");
    SendMessageToPC(oPC, "<c=MediumBlue>This is 84              MediumBlue              0000CD</c>");
    SendMessageToPC(oPC, "<c=MediumOrchid>This is 85            MediumOrchid            BA55D3</c>");
    SendMessageToPC(oPC, "<c=MediumPurple>This is 86            MediumPurple            9370D8</c>");
    SendMessageToPC(oPC, "<c=MediumSeaGreen>This is 87          MediumSeaGreen          3CB371</c>");
    SendMessageToPC(oPC, "<c=MediumSlateBlue>This is 88         MediumSlateBlue         7B68EE</c>");
    SendMessageToPC(oPC, "<c=MediumSpringGreen>This is 89       MediumSpringGreen       00FA9A</c>");
    SendMessageToPC(oPC, "<c=MediumTurquoise>This is 90         MediumTurquoise         48D1CC</c>");
    SendMessageToPC(oPC, "<c=MediumVioletRed>This is 91         MediumVioletRed         C71585</c>");
    SendMessageToPC(oPC, "<c=MidnightBlue>This is 92            MidnightBlue            191970</c>");
    SendMessageToPC(oPC, "<c=MintCream>This is 93               MintCream               F5FFFA</c>");
    SendMessageToPC(oPC, "<c=MistyRose>This is 94               MistyRose               FFE4E1</c>");
    SendMessageToPC(oPC, "<c=Moccasin>This is 95                Moccasin                FFE4B5</c>");
    SendMessageToPC(oPC, "<c=NavajoWhite>This is 96             NavajoWhite             FFDEAD</c>");
    SendMessageToPC(oPC, "<c=Navy>This is 97                    Navy                    000080</c>");
    SendMessageToPC(oPC, "<c=OldLace>This is 98                 OldLace                 FDF5E6</c>");
    SendMessageToPC(oPC, "<c=Olive>This is 99                   Olive                   808000</c>");
    SendMessageToPC(oPC, "<c=OliveDrab>This is 100              OliveDrab               6B8E23</c>");
    SendMessageToPC(oPC, "<c=Orange>This is 101                 Orange                  FFA500</c>");
    SendMessageToPC(oPC, "<c=OrangeRed>This is 102              OrangeRed               FF4500</c>");
    SendMessageToPC(oPC, "<c=Orchid>This is 103                 Orchid                  DA70D6</c>");
    SendMessageToPC(oPC, "<c=PaleGoldenRod>This is 104          PaleGoldenRod           EEE8AA</c>");
    SendMessageToPC(oPC, "<c=PaleGreen>This is 105              PaleGreen               98FB98</c>");
    SendMessageToPC(oPC, "<c=PaleTurquoise>This is 106          PaleTurquoise           AFEEEE</c>");
    SendMessageToPC(oPC, "<c=PaleVioletRed>This is 107          PaleVioletRed           D87093</c>");
    SendMessageToPC(oPC, "<c=PapayaWhip>This is 108             PapayaWhip              FFEFD5</c>");
    SendMessageToPC(oPC, "<c=PeachPuff>This is 109              PeachPuff               FFDAB9</c>");
    SendMessageToPC(oPC, "<c=Peru>This is 110                   Peru                    CD853F</c>");
    SendMessageToPC(oPC, "<c=Pink>This is 111                   Pink                    FFC0CB</c>");
    SendMessageToPC(oPC, "<c=Plum>This is 112                   Plum                    DDA0DD</c>");
    SendMessageToPC(oPC, "<c=PowderBlue>This is 113             PowderBlue              B0E0E6</c>");
    SendMessageToPC(oPC, "<c=Purple>This is 114                 Purple                  800080</c>");
    SendMessageToPC(oPC, "<c=Red>This is 115                    Red                     FF0000</c>");
    SendMessageToPC(oPC, "<c=RosyBrown>This is 116              RosyBrown               BC8F8F</c>");
    SendMessageToPC(oPC, "<c=RoyalBlue>This is 117              RoyalBlue               0000B8</c>");
    SendMessageToPC(oPC, "<c=SaddleBrown>This is 118            SaddleBrown             8B4513</c>");
    SendMessageToPC(oPC, "<c=Salmon>This is 119                 Salmon                  FA8072</c>");
    SendMessageToPC(oPC, "<c=SandyBrown>This is 120             SandyBrown              F4A460</c>");
    SendMessageToPC(oPC, "<c=SeaGreen>This is 121               SeaGreen                2E8B57</c>");
    SendMessageToPC(oPC, "<c=SeaShell>This is 122               SeaShell                FFF5EE</c>");
    SendMessageToPC(oPC, "<c=Sienna>This is 123                 Sienna                  A0522D</c>");
    SendMessageToPC(oPC, "<c=Silver>This is 124                 Silver                  C0C0C0</c>");
    SendMessageToPC(oPC, "<c=SkyBlue>This is 125                SkyBlue                 87CEEB</c>");
    SendMessageToPC(oPC, "<c=SlateBlue>This is 126              SlateBlue               6A5ACD</c>");
    SendMessageToPC(oPC, "<c=SlateGray>This is 127              SlateGray               708090</c>");
    SendMessageToPC(oPC, "<c=Snow>This is 128                   Snow                    FFFAFA</c>");
    SendMessageToPC(oPC, "<c=SpringGreen>This is 129            SpringGreen             00FF7F</c>");
    SendMessageToPC(oPC, "<c=SteelBlue>This is 130              SteelBlue               4682B4</c>");
    SendMessageToPC(oPC, "<c=Tan>This is 131                    Tan                     D2B48C</c>");
    SendMessageToPC(oPC, "<c=Teal>This is 132                   Teal                    808000</c>");
    SendMessageToPC(oPC, "<c=Thistle>This is 133                Thistle                 D8BFD8</c>");
    SendMessageToPC(oPC, "<c=Tomato>This is 134                 Tomato                  FF6347</c>");
    SendMessageToPC(oPC, "<c=Turquoise>This is 135              Turquoise               40E0D0</c>");
    SendMessageToPC(oPC, "<c=Violet>This is 136                 Violet                  EE82EE</c>");
    SendMessageToPC(oPC, "<c=VioletRed>This is 137              VioletRed               D02090</c>");
    SendMessageToPC(oPC, "<c=Wheat>This is 138                  Wheat                   F5DEB3</c>");
    SendMessageToPC(oPC, "<c=White>This is 139                  White                   FFFFFF</c>");
    SendMessageToPC(oPC, "<c=WhiteSmoke>This is 140             WhiteSmoke              F5F5F5</c>");
    SendMessageToPC(oPC, "<c=Yellow>This is 141                 Yellow                  FFFF00</c>");
    SendMessageToPC(oPC, "<c=YellowGreen>This is 142            YellowGreen             9ACD32</c>");
    SendMessageToPC(oPC, "<c=Text>This is 143                   Text                    C0C0C0</c>");
    SendMessageToPC(oPC, "<c=TextPositive>This is 144           TextPositive            0DFEF8</c>");
    SendMessageToPC(oPC, "<c=TextNegative>This is 145           TextNegative            FB2D2D</c>");
    SendMessageToPC(oPC, "<c=TextNeutral>This is 146            TextNeutral             DEDEDE</c>");
    SendMessageToPC(oPC, "<c=ItemUseable>This is 147            ItemUseable             FFFFFF</c>");
    SendMessageToPC(oPC, "<c=ItemNotUseable>This is 148         ItemNotUseable          FF0000</c>");
    SendMessageToPC(oPC, "<c=Unidentified>This is 149           Unidentified            00FFFF</c>");
    SendMessageToPC(oPC, "<c=HotbarText>This is 150             HotbarText              BCBCBC</c>");
    SendMessageToPC(oPC, "<c=HotbarDisabled>This is 151         HotbarDisabled          666666</c>");
    SendMessageToPC(oPC, "<c=HotbarItmNoUse>This is 152         HotbarItmNoUse          FF0000</c>");
}

Plus, an indepth 'study' of PC/Companion/Associate/NPC functions is available at NwVault.
  • rjshae aime ceci

#2
Dann-J

Dann-J
  • Members
  • 3 161 messages

For choosing text colours, there is also this PDF.


  • rjshae aime ceci

#3
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi KevL,

Thanks for posting those util scripts ... :)

Lance.

For choosing text colours, there is also this PDF.


Hi DannJ,

I noticed that page makes reference to one of my old Blueyonder website pages. :)

I have not been with Blueyonder for some time now, and I suppose there is a risk of it being "removed" at any time. In case you (or others are interested), I moved the page to my Talk Talk webpages here:-

NWN2 Colour Page: -- http://www.worldofal...net/colours.htm

Cheers, Lance.
  • rjshae aime ceci

#4
Dann-J

Dann-J
  • Members
  • 3 161 messages

Thanks. I've modified the link on the vault page, but not in the PDF itself. I don't think I still have the Word document I generated the PDF from.



#5
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

Thanks. I've modified the link on the vault page, but not in the PDF itself. I don't think I still have the Word document I generated the PDF from.


Yes, that's fine.

I know what you mean about editing PDFs. I still have references on some of my PDF downloads that point to the older site as well, so I do understand exactly what you mean. :)

Cheers,

Lance.