Hello,
I have been trying to use the else statement when I use an inventory item on a object ,but I keep getting "unexpected else" error. I'am trying to make it where only one inventory item works.
Here is the script:
function Painting_UseInv()
{
if (cBert.ActiveInventory == iPscraper)
cBert.Walk(445, 218, eBlock, eWalkableAreas);
cBert.FaceObject(Painting);
Painting.Visible = false;
PaintingSide.Visible = true;
RemoveWalkableArea(4);
}
else{
cBert.Walk(445, 218, eBlock, eWalkableAreas);
Display("This won't work");
}
Has anyone else had this problem?
Put a bracket behind the "if" clause, and remember to finish the whole function with a bracket
function Painting_UseInv()
{
if (cBert.ActiveInventory == iPscraper){ //this is where the bracket was missing
//stuff
}
else{
//other stuff
}
}//to close the function
That should do it :)
That was it!I keep on forgetting about the closing braces. Thank for for you reply! :-D