OHHHHH i've got it!
i've highlighted in red a bit of code you shouldn't have in there:
func ActionObject_2000()
{
idx = OpenDialogInventory();
if(idx!=-1) UseObject(idx);
}
func UseObject_2000( idx )
{
if(ObjGet(idx,O_ID)==1000)<strong>[color="Red"];</strong>
{
Message0(5,4,"YOU USE THE KEY");
Message0(6,3,"AND THE DOORnCREAKS OPEN");
MessagePop();
InventorySub(idx);
idx = ObjFind(2000);
ObjSet(idx,O_DISABLE,1);
idx = BrushFind(2001);
BrushSet(idx,B_DRAW,0);
GameCommand(CMD_REFRESH);
}
else
{
DropObject(idx);
}
}
that is all it is. you don't use the semi-colon ( ; ) after 'if' statements. if you use anything, you use the { and } brackets to enclose code within that 'if' statement. however if you've only got ONE bit of code after it, then you can do away with the { and } brackets, which is why you see the following code on line 4:
if(idx!=-1) UseObject(idx);
this is an 'if' statement with ONE bit of code after it, which can look confusing as it doesn't have the { and } brackets encasing that one bit of code. If we were to go the long way around it, then it would look like this:
if(idx!=-1)
{
UseObject(idx);
}
but because it only has one bit of code there, we don't really need the two brackets, so they can be removed, which saves two lines of code. you could of course also have it as follows:
if(idx!=-1) { UseObject(idx); }
which would also work fine too.
so if you remove that erronous semi-colon, you should find it works fine. :smile:
Please let me know if any of this has confused you!