Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Mixand on Thu 20/05/2010 10:47:21

Title: Parse error. Don't know whats wrong?
Post by: Mixand on Thu 20/05/2010 10:47:21
I'm really embarrassed >.>
sorry


function hSandy_Interact()
{
if (cJason.ActiveInventory==iKnife);
{
 cJason.Walk(166, 126, eBlock, eWalkableAreas);
 Display("You cut the gum of sandy's hair.");
 cJason.AddInventory(iGum);
}
else
{
 cJason.Walk(188, 115, eBlock, eWalkableAreas);
 cJason.Think("Moving her would hurt and you can't take the gum off with your hands.");

}
}

But I get this error:

Failed to save room room4.crm; details below
room4.asc(59): Error (line 59): PE04: parse error at ';'

Thankyou for any help.

Title: Re: Parse error. Don't know whats wrong?
Post by: Sslaxx on Thu 20/05/2010 10:56:38
Quote from: Mixand on Thu 20/05/2010 10:47:21
function hSandy_Interact()
{
if (cJason.ActiveInventory==iKnife);
{
  cJason.Walk(166, 126, eBlock, eWalkableAreas);
  Display("You cut the gum of sandy's hair.");
  cJason.AddInventory(iGum);
}
else
{
  cJason.Walk(188, 115, eBlock, eWalkableAreas);
  cJason.Think("Moving her would hurt and you can't take the gum off with your hands.");

}
}

But I get this error:

Failed to save room room4.crm; details below
room4.asc(59): Error (line 59): PE04: parse error at ';'

Thankyou for any help.
if (cJason.ActiveInventory==iKnife);
I think that semicolon at the end of the if statement is a start.
Title: Re: Parse error. Don't know whats wrong?
Post by: Dualnames on Thu 20/05/2010 11:57:08
In case it's not obvious on Sslaxx's answer (which I doubt), but just in case.



function hSandy_Interact(){
if (cJason.ActiveInventory==iKnife) {
 cJason.Walk(166, 126, eBlock, eWalkableAreas);
 Display("You cut the gum of sandy's hair.");
 cJason.AddInventory(iGum);
}
else{
 cJason.Walk(188, 115, eBlock, eWalkableAreas);
 cJason.Think("Moving her would hurt and you can't take the gum off with your hands.");
}
}