Game Development Community

yet another GUI parse error

by Ben Hamlett · in Torque Game Builder · 12/24/2011 (4:10 am) · 2 replies

I am absolutely new to coding but I cant seem to see why I get a parse error from this script for my GUI

if (%level == "game/data/levels/titleScreen.t2d")
{
//alxPlay(titleAudio);
//Canvas.pushDialog(titleScreen);
}

function startUp()
{
Canvas.popDialog(titleScreen);
echo("Game Start Clicked");
Canvas.pushDialog(titleMenu);
}

function newPet_step1()
{
echo("New Pet Works");
}

function loadPet_step1()
{
echo("Load Pet Works");
}

Can anyone help me out please!?

#1
12/24/2011 (5:15 am)
silly me had to add %this to the functions, fixed code looks like

if (%level == "game/data/levels/titleScreen.t2d")
{
//alxPlay(titleAudio);
//Canvas.pushDialog(titleScreen);
}

function startUp(%this)
{
Canvas.popDialog(titleScreen);
echo("Game Start Clicked");
Canvas.pushDialog(titleMenu);
}

function newPet_step1(%this)
{
echo("New Pet Works");
}

function loadPet_step1(%this)
{
echo("Load Pet Works");
}
#2
12/24/2011 (8:33 am)
First line should also read:

if(%level $= "game/data/levels/titleScreen.t2d")

== is for numeric comparisons
$= is for string comparisons