Programming Question please help with ummu selection

Mr Martian

Orbinaut/Addon dev/Donator
Addon Developer
Donator
Joined
Jun 6, 2012
Messages
317
Reaction score
124
Points
43
Location
Sydney, Australia, Earth, Sol
Website
www.orbithangar.com
hey guys, i am trying to add ummu to my vessel, this is what i have in clbkConsumeBufferedKey for the crew slot selection:


Code:
//---------------------------------------------------------------------------
// Ummu Key "2" Select previous member This is just internal to the demo
// you may do your own selection system by panel button
if(key==OAPI_KEY_2&&!KEYMOD_SHIFT(kstate)&&!KEYMOD_CONTROL (kstate))
{
// we test there is someone aboard
if(Crew.GetCrewTotalNumber()==0)
{
strcpy(SendHudMessage(),"Sorry no one aboard unable to select");
return 1;
}
if(iSelectedUmmuMember>0)
iSelectedUmmuMember--;
char * Name=Crew.GetCrewNameBySlotNumber(iSelectedUmmuMember);
sprintf(SendHudMessage(),"Slot %i %s \"%s\" aged %i Selected for EVA or Transfer"
", please press \"E\" to EVA",iSelectedUmmuMember,
Crew.GetCrewMiscIdBySlotNumber(iSelectedUmmuMember),Name,
Crew.GetCrewAgeBySlotNumber(iSelectedUmmuMember));
return 1;
}

the problem is, i can only select crew members 1, and 2. any above 2 do not work, nothing happens, i can only select slots 1 and 2. i have followed the instructions in the ummu sdk, and i dont know what i am doing wrong... any help would be much appreciated. thanks in advance :cheers:
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,404
Reaction score
581
Points
153
Location
Vienna
the problem is, i can only select crew members 1, and 2. any above 2 do not work, nothing happens, i can only select slots 1 and 2. i have followed the instructions in the ummu sdk, and i dont know what i am doing wrong... any help would be much appreciated. thanks in advance :cheers:

Well, this is how you implemented it there. I guess you initialized iSelectedUmmuMember to a constant 2 or Crew.GetCrewTotalNumber(). So your lines here only allow decrementing the slot from the total number minus 1 (or fixed 1) down to 0:
Code:
if(iSelectedUmmuMember>0)
iSelectedUmmuMember--;
How do you think that that variable gets set to Crew.GetCrewTotalNumber() again in order to select more slots?

regards,
Face
 

Mr Martian

Orbinaut/Addon dev/Donator
Addon Developer
Donator
Joined
Jun 6, 2012
Messages
317
Reaction score
124
Points
43
Location
Sydney, Australia, Earth, Sol
Website
www.orbithangar.com
oh, silly me, i didn't relise that i keep pressin the 1 and 2 keys to toggle between the crew members. i thought each crew member was allocated a separate number key! thanks anyway face :cheers:
 
Top