It's more for convenience than 'you must do it this way!' as:
ObjSet(ObjFind(1000), O_DISABLE, 0);
is exactly the same as:
idx = ObjFind(1000);
ObjSet(idx, O_DISABLE, 0);
So, if you are making a lot of things happen at the same time when actioning an object (or using an item) you can just use the first bit of code to identify and modify each subsequent object in turn rather than continually switching the idx.
When 'using' an object you put idx in brackets and then use idx to identify the item being used as that is how the engine works in the 'UseObject' function, but once the 'item' is identified just identify the things that need to happen directly.
Also, think of 'idx' in the same way that you used 'item' in your cake/file coding; it's just an identifier and if you need to identify a lot of different objects in the same function you can just as easily start the function with a whole list of identifiers. Here's an example of having to ensure that three separate actions have occurred before something will happen:
func ActionObject_999()
{
ida = ObjFind(1000);
idb = ObjFind(1001);
idc = ObjFind(1002);
if (ObjGet(ida, O_STATUS) == 1
&& ObjGet(idb, O_STATUS) == 1
&& ObjGet(idc, O_STATUS) == 1)
{
ObjSet(ObjFind(1003), O_DISABLE, 0);
ObjSet(ObjFind(999), O_DISABLE, 1);
return;
}
else
{
Message1 (5,2, ""Nothing happened"");
MessagePop();
}
}
One final tip. If you are moving a visible object to somewhere else in the same room then you have to give it an identifier as you have to use the command ObjPresent(idx) (or whatever identifier you're using) to make it visible, otherwise it will only be visible when you next re-enter that room.