SOLVED: Cross-eyed.... ELSE problem

Started by barefoot, Tue 18/01/2011 07:50:21

Previous topic - Next topic

barefoot

Hi

I'm crosseyed this morning and i cant get the ELSE to work.. Rest ok..

Sorry to be a pain  ???

Code: ags

function cClaudia_Interact()
{
  
  if (player.HasInventory (iKey))
  {
  
  
  
   if ((cClaudia.x - cPaul.x <=90 && cClaudia.x >= cPaul.x) || (cPaul.x - cClaudia.x < 90 && cPaul.x > cClaudia.x))
    {
  
   cClaudia.FaceLocation(996, 249);
   cPaul.FaceCharacter(cClaudia);
   cPaul.Say("This place is desolate. I could mug her!!");
   Display("With an almighty punch you land a left hook on her chin and she falls down like a sack of spuds!");
   cClaudia.ChangeView(15);
   if (cClaudia.x > 299) 
{
  cClaudia.StopMoving();
}


   cPaul.Say("I'de better get her out of sight!");
   Display("You drag her down a small alley");
   cPaul.Say("Mm, Credit cards, a pearl necklace and a wad of cash. That should help me a bit!!");
   Display("You leave the woman in the alley and look for more cash and stuff");
   cClaudia.Transparency=100;
   
   
   }
 

}

else
  {
    
    Display("She's too far away!!");
  }
}



All eagle eyed replies welcomed

cheers

barefoot


I May Not Be Perfect but I Have A Big Heart ..

Unai

Let's see if I got this right...

Your else is acting with the
Code: ags
if (player.HasInventory (iKey))

statement, and I think you want it to work with the distance statements.

look at this clean up:

Code: ags

function cClaudia_Interact()
{
  	if (player.HasInventory (iKey))
	{
		if ((cClaudia.x - cPaul.x <=90 && cClaudia.x >= cPaul.x) || (cPaul.x - cClaudia.x < 90 && cPaul.x > cClaudia.x))
		{
			cClaudia.FaceLocation(996, 249);
			cPaul.FaceCharacter(cClaudia);
			cPaul.Say("This place is desolate. I could mug her!!");
			Display("With an almighty punch you land a left hook on her chin and she falls down like a sack of spuds!");
			cClaudia.ChangeView(15);
			if (cClaudia.x > 299) 
			{
				cClaudia.StopMoving();
			}
			cPaul.Say("I'de better get her out of sight!");
			Display("You drag her down a small alley");
			cPaul.Say("Mm, Credit cards, a pearl necklace and a wad of cash. That should help me a bit!!");
			Display("You leave the woman in the alley and look for more cash and stuff");
			cClaudia.Transparency=100;
		}
	}
	else
	{
		Display("She's too far away!!");
	}
}



What you need is:
Code: ags

function cClaudia_Interact()
{
  	if (player.HasInventory (iKey))
	{
		if ((cClaudia.x - cPaul.x <=90 && cClaudia.x >= cPaul.x) || (cPaul.x - cClaudia.x < 90 && cPaul.x > cClaudia.x))
		{
			cClaudia.FaceLocation(996, 249);
			cPaul.FaceCharacter(cClaudia);
			cPaul.Say("This place is desolate. I could mug her!!");
			Display("With an almighty punch you land a left hook on her chin and she falls down like a sack of spuds!");
			cClaudia.ChangeView(15);
			if (cClaudia.x > 299) 
			{
				cClaudia.StopMoving();
			}
			cPaul.Say("I'de better get her out of sight!");
			Display("You drag her down a small alley");
			cPaul.Say("Mm, Credit cards, a pearl necklace and a wad of cash. That should help me a bit!!");
			Display("You leave the woman in the alley and look for more cash and stuff");
			cClaudia.Transparency=100;
		}
		else
		{
			Display("She's too far away!!");
		}
	}
}
I am a deeply superficial person

barefoot

Cheers Unai... back on track  :=

barefoot

I May Not Be Perfect but I Have A Big Heart ..

SMF spam blocked by CleanTalk