Author Topic: I can't find Waldo!  (Read 474 times)

Legacy_Jlad

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
I can't find Waldo!
« on: October 20, 2010, 09:04:52 pm »


               int nXP = FloatToInt((Get2DAString(xptable, string GetChallengeRating(oDead) , int (PWFXP_GetLevel(oGroupMbr) - 1 ))) * fFinalModifier);

ERROR: UNKNOWN STATE IN COMPILER

He's somewhere in there....I just don't know where. '<img'>
               
               

               
            

Legacy_Avonos the Rogue

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
I can't find Waldo!
« Reply #1 on: October 20, 2010, 09:19:29 pm »


               int nXP = FloatToInt((Get2DAString("xptable",GetChallengeRating(oDead),(PWFXP_GetLevel(oGroupMbr) -1))) * fFinalModifier);

It looks like waldo had a twin too.  If you're new to scripting check out the NWN Lexicon v1.69 on the NWN Vault.  It's plain handy.
               
               

               
            

Legacy_Jlad

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
I can't find Waldo!
« Reply #2 on: October 20, 2010, 09:22:37 pm »


               Hmm...I'll try those quotes, but I initially started without "string" or "int" and it gave me a different error.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
I can't find Waldo!
« Reply #3 on: October 20, 2010, 09:49:58 pm »


               There is more then just twins here.   Here is what you have with some whitespace add and comments for easier reading.

int nXP =
          FloatToInt   // the stuff in the middle is not evaluating to a float. First mismatch   
          (
              (
                  Get2DAString  // This returns a string and  you then multuiply it by a float. does not work.    

                  (
                      xptable,        // Unless this a a var for a string you need quotes aroud it.    

                      string GetChallengeRating(oDead),  // this ARG needs to be a string for the collumn name.    

                      int (PWFXP_GetLevel(oGroupMbr) - 1 ) // This arg need to be an int. But you are trying to declair an int var named '(PWFXP_GetLevel(oGroupMbr) - 1 )'   

                   )
                )
                * fFinalModifier  // you are trying to multiply this by the string returned from Get2DAString.    

            );
               
               

               
            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
I can't find Waldo!
« Reply #4 on: October 20, 2010, 10:31:08 pm »


               There's a lot of unexplained stuff in that one line.  Maybe if you could give the surrounding code and tell what you are trying to do.
               
               

               
            

Legacy_Jlad

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
I can't find Waldo!
« Reply #5 on: October 20, 2010, 10:33:50 pm »


               Basically I'm trying to mod PWFXP to call on the regular campaign xptables for the base XP value.  It's an effort to kill summon XP loss in multiplayer while keeping XP progression to a close approximation of how normal campaign experience would work.

Maybe it would be a better idea to simplify this...I'll define a new variable 'bXP':

     int bXP=Get2DAString("xptable",string GetChallengeRating(oDead),int(PWFXP_GetLevel(oGroupMbr) - 1 ))

All the other code is stock and works fine.  All I need to do is pull the corresponding xptable.2da value for the CR/PC level.  This still produces an unknown state.

int bXP=Get2DAString("xptable",GetChallengeRating(oDead),(PWFXP_GetLevel(oGroupMbr) - 1))

This second option moves on to the next error (Error Parsing Variable List).  No matter where I put it the next line always seems to have this error.
               
               

               


                     Modifié par Jlad, 20 octobre 2010 - 09:53 .
                     
                  


            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
I can't find Waldo!
« Reply #6 on: October 20, 2010, 11:16:55 pm »


               Well the most obvious error is that GetChallengeRating returns a float but the function Get2DAString requires a string.
The way you convert that is with FloatToString.
That would make it:
int bXP=Get2DAString("xptable",FloatToString(GetChallengeRating(oDead)),(PWFXP_GetLevel(oGroupMbr) - 1));
               
               

               


                     Modifié par Mudeye, 20 octobre 2010 - 10:17 .
                     
                  


            

Legacy_Jlad

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
I can't find Waldo!
« Reply #7 on: October 20, 2010, 11:19:32 pm »


               Nevermind that parsing stuff...missed the semicolon....stupid mistake.  So the top one gives unknown state and the bottom one gives declaration doesn't match parameters.  I tried taking the pwfxp_getlevel business out and just putting an int 7 there, but that didn't work.



PWFXP_GetLevel is just pwfxp checking level by experience and not level.  I don't mind replacing it, but that's the command I saw used and I'm kind of just stitching together examples.
               
               

               
            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
I can't find Waldo!
« Reply #8 on: October 20, 2010, 11:21:55 pm »


               The "doesn't match parameters" error is because you don't have a string for the second parameter like I indicated.   Try it with the change I suggested.

The first one includes types "string" and "int" in the function call which is completely not right.
               
               

               


                     Modifié par Mudeye, 20 octobre 2010 - 10:22 .
                     
                  


            

Legacy_Jlad

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
I can't find Waldo!
« Reply #9 on: October 20, 2010, 11:24:30 pm »


               Yeah, sorry, posted at the same time...I tried it with yours but getting mismatched types error now.
               
               

               
            

Legacy_Jlad

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
I can't find Waldo!
« Reply #10 on: October 20, 2010, 11:44:14 pm »


               int bXP=StringToInt(Get2DAString("xptable",FloatToString(GetChallengeRating(oDead)),(PWFXP_GetLevel(oGroupMbr) - 1)));



Worked...hopefully.  Thanks.
               
               

               
            

Legacy_Jlad

  • Newbie
  • *
  • Posts: 20
  • Karma: +0/-0
I can't find Waldo!
« Reply #11 on: October 21, 2010, 12:12:33 am »


               Well it compiled fine, but it's returning XP 0.  I'm guessing the 2da string isn't referencing the table correctly.  I'm not sure whether it's the row or the column, though.  Would GetCharacterLevel(OBJECT_SELF) - 1 work better?  Or maybe the GetChallengeRating string isn't referencing the columns?

I'm pretty sure the GetChallengeRating isn't working, because if it returns a solid integer (which I'm not even sure it does, maybe decimal?) it's probably looking for the column by string and not integer.  But the xptables.2da columns are Level, C0, C1, C2, etc.  So if it is an integer, I still need to add a C to the front of it, right?

Edit:  I added some SendMessageToPC strings so that I could see what getchallengerating and pwfxp_getlevel were spitting out.  pwfxp_getlevel is working as intended, while getchallengerating is giving 0.500000000 for CR0 and 1.000000000 for CR1, 2.000000000, etc, etc.

Edit2:  Problem Solved.  The new code reads:


      string ChCol="C"+IntToString(FloatToInt(GetChallengeRating(oDead)));
      int LvRow=PWFXP_GetLevel(oGroupMbr) - 1;
      int bXP=StringToInt(Get2DAString("xptable",ChCol,LvRow));

Thanks for the help everybody.
               
               

               


                     Modifié par Jlad, 21 octobre 2010 - 12:28 .
                     
                  


            

Legacy_Avonos the Rogue

  • Jr. Member
  • **
  • Posts: 70
  • Karma: +0/-0
I can't find Waldo!
« Reply #12 on: October 21, 2010, 07:37:11 pm »


               Oi, I missed that float thing too.  Waldo is a tricky bugger.