Player Resource Consortium

 

Author Topic: Subrace field not recognized  (Read 20448 times)

0 Members and 1 Guest are viewing this topic.

October 06, 2009, 06:36:20 AM
Reply #30

Thanks for the pointers.  As you can tell I don't do this for a living & have apparently learned what I do know from a lot of bad examples :D

Speaking of examples, is this how you would script drow_recog,nss?

Code: [Select]

int StartingConditional()
    {
        int nRace = GetRacialType(GetPCSpeaker());
        if (163 || 164 == nRace )
            return TRUE;
        return FALSE;
    }
« Last Edit: October 06, 2009, 06:46:40 AM by DM Heatstroke »
HEATSTROKE


October 06, 2009, 07:46:36 PM
Reply #31
  • Jr. Associate
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile

Quote from: DM Heatstroke

Thanks for the pointers.  As you can tell I don't do this for a living & have apparently learned what I do know from a lot of bad examples :D

Speaking of examples, is this how you would script drow_recog,nss?

Code: [Select]

int StartingConditional()
    {
        int nRace = GetRacialType(GetPCSpeaker());
        if (163 || 164 == nRace )
            return TRUE;
        return FALSE;
    }


Almost. No way exists in nwscript to do multiple comparison on a single operand. The statement if (163 || 164 == nRace) is evaluated to if true or nRace is 164 -- obviously not what you want!

Logical and (&&), logical or (||), logical not (!) operate on one or more conditions; operand expressions are first evaluated in place to true or false. The && and || operators are always evaluated after the comparison operators and most other operators.

So with this knowledge in mind, the if statement needs more tweaking:
if nRace is 163 or nRace is 164
and nwscript-ified:
if (163 == nRace || 164 == nRace)

Hope that helps.


October 06, 2009, 10:07:46 PM
Reply #32

Quote from: N-S


Almost. No way exists in nwscript to do multiple comparison on a single operand. The statement if (163 || 164 == nRace) is evaluated to if true or nRace is 164 -- obviously not what you want!


And that's why he was always getting sent to the Drow area.  Makes perfect sense.  Thanks again, now let me see if I can fix those other scripts now.
« Last Edit: October 06, 2009, 10:16:41 PM by DM Heatstroke »
HEATSTROKE


October 11, 2009, 02:45:37 PM
Reply #33

Thank you N-S for your help.
I changed the scripts reflecting your suggestion.
The only script I can't get to compile is rr_enter.nss. And it looks like the factions are set here so this must be why the whole faction thing is not working. When trying to compile I get the following error:

rr_enter.nss(250): ERROR: NO RIGHT BRACKET ON EXPRESSION

I have looked for a place that looked like it could use a right bracket but everything seemed OK.
Anyone have any idea how to fix this (hopefully final) issue?
In case someone wants to take a look at this I attached the script.
« Last Edit: October 12, 2009, 04:25:04 PM by Badjaccur »


October 26, 2009, 01:51:47 PM
Reply #34

I don't have a compiler at work so I have no idea if this will work or not.

Code: [Select]
if(SUBRACESYSTEM)
    {

// Sets up subrace if legal one chosen
        if(use_pc_subrace())
            {
              SendMessageToPC(oPC,"Your subrace of "+GetSubRace(oPC)+" has been enabled.");
              int iRace = GetRacialType(oPC);
              if (163 == iRace || 164 == iRace)
                {
                  AdjustReputation(oPC,GetObjectByTag("bad_boy"),100);
                  if (!HasItem(oPC,"BondofH_NOD"))
                    AdjustReputation(oPC,GetObjectByTag("good_boy"),-100);
                }
            }                

    }


By the way, don't use NESS in conjunction with the PRC, too many DelayCommands & it stops spawning stuff.
« Last Edit: October 27, 2009, 01:39:55 PM by DM Heatstroke »
HEATSTROKE


October 26, 2009, 04:30:04 PM
Reply #35
  • Jr. Associate
  • **
  • Posts: 62
  • Karma: +0/-0
    • View Profile

@DM Heatstroke:
Seems to be it, but since whitespace is ignored that should be legal syntax and compile OK. Is the error with nwnnsscomp or clcompile?

I don't have an IDE nor the include files for this script. I did see this when looking at it (line 101):
Code: [Select]
if(!STARTING_GOLD)
{
...
}[color=#cc0000]        if (GetLocalInt(oMod,"GIVELEVEL") > 1)[/color]
if(GetLocalInt(oMod,"GIVELEVEL") > 1)
{
...

Looks like a copy-paste mistake. But it should also compile without error.