now i know what this means, it means that ive got some unbalance with the brackets, but I’ve checked and checked again and I can’t find anythign wrong with it.
the three errors im getting are:
expecting } found else on line 35
expecting } found else on line 54
expecting EOF found } on line 59
private var bowtext = 0;
private var lantext = 0;
function OnGUI ()
{
while(lantext == 1)
{
GUI.Label (Rect (0,0,100,50), "Press 'E' to pick up Lantern");
}
while(bowtext == 1)
{
GUI.Label (Rect (0,0,100,50), "Press 'E' to pick up Bow");
}
}
function Update ()
{
if (Physics.Raycast(Transform.position, Transform.forward, hit, rayCastlength))
{
//is the player touching a lantern pickup object?
while (hit.Collider.gameObject.tag == "lanternpickup")
{
//display text
lantext = 1;
if (Input.GetKeyDown(KeyCode.E))
{
//activate lantern in players hand
//destroy pickup object
Destroy(hit.gameObject);
lantext = 0;
}
}
else
{
//stop displaying text
lantext = 0;
}
//is the player touching a bow pickup object?
while (hit.Collider.gameObject.tag == "bowpickup")
{
//display text
bowtext = 1;
if (Input.GetKeyDown(KeyCode.E))
{
//activate bow in players hand
//destroy bow pickup object
Destroy(hit.gameObject);
bowtext = 0;
}
}
else
{
//stop displaying text
bowtext = 0;
}
}
}