Author Topic: Help with this script - parsing variable list error  (Read 306 times)

Legacy_AstoundingArcaneArcher

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Help with this script - parsing variable list error
« on: August 03, 2011, 09:39:11 pm »


               Every time I use this script, it won't compile and I get the parsing variable list error. Help?

int InnRest(string aInnID,object aPC) - error on this line
{
 int bFoundPlace = FALSE;
 int iCounter = 1;
 object oWpt;
 object oPC;
 do
 {
   oWpt  = GetObjectByTag("h_wpt_inn_" + aInnID,iCounter);
   if (oWpt != OBJECT_INVALID)
   {
     // It can be easly modified to work with any char, not just PCs
     oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,
                              PLAYER_CHAR_IS_PC,
                              oWpt);
    // If the room isn't 1 tile large, put another number instead of 5.0
    if ((oPC==OBJECT_INVALID) || (GetDistanceBetween(oWpt,oPC) > 5.0))
      bFoundPlace = TRUE;
   }
  iCounter++;
 }
 while ((!bFoundPlace) && (oWpt != OBJECT_INVALID));
 if (bFoundPlace)
 {
   AssignCommand(aPC,ClearAllActions());
   if (oWpt != OBJECT_INVALID)
     AssignCommand(aPC,ActionJumpToObject(oWpt));
   AssignCommand(aPC,DelayCommand(3.0,ActionRest()));
 }
 return bFoundPlace;
}
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Help with this script - parsing variable list error
« Reply #1 on: August 03, 2011, 11:21:07 pm »


               It compiles fine for me. No errors.


int InnRest(string aInnID,object aPC) //- error on this line
{
    int bFoundPlace = FALSE;
    int iCounter = 1;
    object oWpt;
    object oPC;
    do
    {
        oWpt = GetObjectByTag("h_wpt_inn_" + aInnID,iCounter);
        if (oWpt != OBJECT_INVALID)
        {
            // It can be easly modified to work with any char, not just PCs
            oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oWpt);
            // If the room isn't 1 tile large, put another number instead of 5.0
            if ((oPC==OBJECT_INVALID) || (GetDistanceBetween(oWpt,oPC) > 5.0))
            bFoundPlace = TRUE;
        }
        iCounter++;
    }
    while ((!bFoundPlace) && (oWpt != OBJECT_INVALID));
    if (bFoundPlace)
    {
        AssignCommand(aPC,ClearAllActions());
        if (oWpt != OBJECT_INVALID)
        AssignCommand(aPC,ActionJumpToObject(oWpt));
        AssignCommand(aPC,DelayCommand(3.0,ActionRest()));
    }
    return bFoundPlace;
}

void main()
{
    object oPC = GetLastUsedBy();
    InnRest("string", oPC);
}
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Help with this script - parsing variable list error
« Reply #2 on: August 03, 2011, 11:31:35 pm »


               Yup, I don't mean to be demeaning if you already know this, but what you posted in the OP is not a "real script." Rather it is a function that needs to be called from another script as an #include or posted above the void main() like GoG did (and then call the function in the script body of the void main() section).
               
               

               


                     Modifié par _Knightmare_, 03 août 2011 - 10:32 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Help with this script - parsing variable list error
« Reply #3 on: August 03, 2011, 11:42:10 pm »


               If you have an error in the script that is calling the function it can cause errors on like that at times.   Something like forgetting to place the simicolon after the line that calls the function.  

or if you declaired another varaible or function in you script that is named 'InnRest' will also cause the problem.

Your best bet is to do a search in your script for "InnRest"  and see if you have declaired a var by that name.