So, in the module I’m wokring on at the moment I use the Party Roster GUI a lot that can be found here (on some installations people can’t get to that GUI, but that’s another discussion we’ve already covered in another thread):
Now, the problem I have is that in a script I want to check how many people are in the roster (the total number, not just the ones currently in the party) but my scripts fail all the time. They compile and all that but they don’t work they way I want them to, so I must be doing something very wrong.
So here’s what the script looks like at the moment. Yes, I know it’s convoluted, but I couldn’t figure out another way to do it…Still, it doesn’t work the way it is now either…
At the top, the thing that I have “greyed out” that the game doesn’t check for, is my original script. When that didn’t work the way I wanted, I tried my best to do a new version which is what you see after the “greyed out” area:
/*int StartingConditional()
{
string sRoster;
object oPC = GetFirstPC();
object oRM = GetObjectByTag(GetFirstRosterMember());
int n=0;
while (GetIsObjectValid(oRM))
{
n++;
oRM = GetObjectByTag(GetNextRosterMember());
}
if(n>=5)
{
SetGlobalInt("EnoughPeopleRoster",1);
return TRUE;
}
return FALSE;
}
*/
const string sROSTER_NELOWYN = "nelowync"; // note: this needs to be the *roster* string-id
const string sROSTER_WRENBUR = "gnome"; // note: this needs to be the *roster* string-i
const string sROSTER_FLEKSA = "fleksac"; // note: this needs to be the *roster* string-i
const string sROSTER_SEMAPHINE = "semaphine"; // note: this needs to be the *roster* string-i
const string sROSTER_LANIA = "leniac"; // note: this needs to be the *roster* string-i
const string sROSTER_MATHIAS = "mathias"; // note: this needs to be the *roster* string-i
const string sROSTER_TINDRA = "tindra"; // note: this needs to be the *roster* string-i
const string sROSTER_AVIE = "avie"; // note: this needs to be the *roster* string-i
const string sROSTER_SETH = "seth"; // note: this needs to be the *roster* string-i
int StartingConditional()
{
int n=0;
object oPC = GetFirstPC();
/*
object oNelowyn = GetObjectByTag(sROSTER_NELOWYN);
object oWrenbur = GetObjectByTag(sROSTER_WRENBUR);
object oFleksa = GetObjectByTag(sROSTER_FLEKSA);
object oLania = GetObjectByTag(sROSTER_LANIA);
object oSemaphine = GetObjectByTag(sROSTER_SEMAPHINE);
object oTindra = GetObjectByTag(sROSTER_TINDRA);
object oMathias = GetObjectByTag(sROSTER_MATHIAS);
object oAvie = GetObjectByTag(sROSTER_AVIE);
object oSeth = GetObjectByTag(sROSTER_SETH);
object oTindra = GetObjectFromRosterName(sROSTER_TINDRA);
object oSemaphine = GetObjectFromRosterName(sROSTER_SEMAPHINE);
object oFleksa = GetObjectFromRosterName(sROSTER_FLEKSA);
object oLania = GetObjectFromRosterName(sROSTER_LANIA);
object oNelowyn = GetObjectFromRosterName(sROSTER_NELOWYN);
object oMathias = GetObjectFromRosterName(sROSTER_MATHIAS);
object oWrenbur = GetObjectFromRosterName(sROSTER_WRENBUR);
object oAvie = GetObjectFromRosterName(sROSTER_AVIE);
object oSeth = GetObjectFromRosterName(sROSTER_SETH);
*/
if(GetIsRosterMemberAvailable(sROSTER_TINDRA))
{
n++;
}
if(GetIsRosterMemberAvailable(sROSTER_SEMAPHINE))
{
n++;
}
if (GetIsRosterMemberAvailable(sROSTER_FLEKSA))
{
n++;
}
if (GetIsRosterMemberAvailable(sROSTER_LANIA))
{
n++;
}
if (GetIsRosterMemberAvailable(sROSTER_NELOWYN))
{
n++;
}
if (GetIsRosterMemberAvailable(sROSTER_MATHIAS))
{
n++;
}
if (GetIsRosterMemberAvailable(sROSTER_WRENBUR))
{
n++;
}
if (GetIsRosterMemberAvailable(sROSTER_AVIE))
{
n++;
}
if (GetIsRosterMemberAvailable(sROSTER_SETH))
{
n++;
}
if(n>=5)
{
SetGlobalInt("EnoughPeopleRoster",1);
return TRUE;
}
return FALSE;
}
Maybe there’s a better function for checking how many creatures are in the roster overall (not just the ones in the party), but I haven’t found one yet.
In fact, the more I think about this, if this is not working the way I thought it would, there could be huge ramafications for my current module, that I in that case need to solve somehow. Uurggh.
I really wish I could just use the first version of this script but…