QuoteCode: ags int ran=Random(3); if (OBJECT1_FOUND == 0 && (ran==0) cEgo.AddInventory (iObject1)) {} else if (OBJECT2_FOUND == 0 && (ran==1) cEgo.AddInventory (iObject2)) {} else if (OBJECT3_FOUND == 0 && (ran==2) cEgo.AddInventory (iObject3)) {} else { Display ("Nothing was found."); }
If that's an exact copy/paste of what you have, I can understand all those parse errors.
Let's start, first your code seems to be lacking any connection to a function... so I'll add that:
function BoxLuckyDip() // giving it a name you can easy remember when you wish to use it.
{ // this starts this block of code
int ran=Random(3);
if (OBJECT1_FOUND == 0 && (ran==0)) cEgo.AddInventory (iObject1); // Note and remember to close the parenthesis, then add the command and end it with ;
else if (OBJECT2_FOUND == 0 && (ran==1)) cEgo.AddInventory (iObject2);
else if (OBJECT3_FOUND == 0 && (ran==2)) cEgo.AddInventory (iObject3);
else Display ("Nothing was found.");
} // this ends the function and corresponding block of code
I'm not sure where you changing the OBJECT3_FOUND variable, but it probably would make sense to change it here when you give the item, so you would then have:
function BoxLuckyDip()
{
int ran=Random(3);
if (OBJECT1_FOUND == 0 && (ran==0))
{ // note start of new block of code
cEgo.AddInventory (iObject1);
OBJECT1_FOUND = 1;
} // note end of this block of code...
else if (OBJECT2_FOUND == 0 && (ran==1))
{
cEgo.AddInventory (iObject2);
OBJECT2_FOUND = 1;
}
else if (OBJECT3_FOUND == 0 && (ran==2))
{
cEgo.AddInventory (iObject3);
OBJECT3_FOUND = 1;
}
else Display ("Nothing was found.");
}
Hope this helps.