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;
}
Help with this script - parsing variable list error
Débuté par
AstoundingArcaneArcher
, août 03 2011 08:39
#1
Posté 03 août 2011 - 08:39
#2
Posté 03 août 2011 - 10:21
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);
}
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);
}
#3
Posté 03 août 2011 - 10:31
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 .
#4
Posté 03 août 2011 - 10:42
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.
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.





Retour en haut






