Problem UCGO SDK Function problem

Buzz313th

New member
Joined
Jan 1, 2010
Messages
92
Reaction score
0
Points
0
Could use a bit of help from anyone who is more familiar with the UCGO SDK than I.

The following code is suposed to transfer the remaining battery power from the external UCGO battery to the internal battery tank leaving 40kg of "battery" power in the external UCGO battery.

The code works fine as long as the battery is not grappled and within grapple distance of the vessel, but when the battery is grappled the "hUcgo.EatCloserCargoByType" function returns a -1.0. As per the UCGO SDK, the only time this function should return a -1.0 is if it can't find that "type" of UCGO resource either within grapple distance or grappled. Durring troubleshooting , I replaced the expression, "hUcgo.GetCargoSlotMass(0) - dBatteryEmptyKG" with just an simple interger like 20 and still it returns -1.0.

Never the less, I am baffled as too why this code only works when the cargo is ungrappled and not when it's grappled.

I posted on Dans forum asking for help, but I believe Dan is busy. If anyone can possibly shed some lihgt on this, I would really appreciate it.

JB





//fill internal with everything available from external

dInternalBatteryTankLevel = dInternalBatteryTankLevel + hUcgo.EatCloserCargoByType("battery", hUcgo.GetCargoSlotMass(0) - dBatteryEmptyKG);

sprintf(oapiDebugString(),"INTERNAL BATTERY LEVEL INCREASED TO %f. EXTERNAL BATTERY IS NOW EMPTY",
dInternalBatteryTankLevel);]



JB
 

Buzz313th

New member
Joined
Jan 1, 2010
Messages
92
Reaction score
0
Points
0
UCGO SDK Bug?

I think I may have found the problem with the UCGO "EAT CARGO" functions...

It appears that the "EatCargoByType" function needs to have a number larger than 45 in the last perameter to work as published in the SDK. If the number is 45 or less it returns a -1.0.

examples:

hUcgo.EatCloserCargoByType("CargoDescription", 45.1);

will return "45.1"


when

dBatteryAmountEaten = hUcgo.EatCloserCargoByType("CargoDescription", 45);

will return -1.0


Is this a bug, or is this by design?

If by design, why?

IMHO, it would be nice to have the ability to move resources from cargo to vessel with a finer resolution than 45 kg.

JB
 
Last edited:
Top