"Bad Syntax"

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
BatterY
CJ Worshipper
CJ Worshipper
Posts: 238
Joined: January 29th, 2010, 10:27 pm

"Bad Syntax"

Post by BatterY » April 16th, 2010, 3:58 pm

I had a script compile error, and didn't know what to do, so i read the topic which said that /developer 1 would help.
I did that but now it shows the part of my gsc that i cant find a problem

the thread which CoD complains about:

Code: Select all

door()
{
door1 = getent("door_l","targetname");
door2 = getent("door_r","targetname");
trigger = getent("enter","targetname");
while(1)
{
trigger waittill("trigger");
if level.code == level.answer; // this is the one that it complains
user iprintlnbold("Correct Code ^6:D");
door1 moveX(-8,1,0.5,0.5);
door1 waittill("movedone");
door2 moveX(-8,1,0.5,0.5);
door2 waittill("movedone");
door1 moveY(-24,1,0.5,0.5);
door1 waittill("movedone");
door2 moveY(24,1,0.5,0.5);
door2 waittill("movedone");
wait 2;
door1 moveY(24,1,0.5,0.5);
door1 waittill("movedone");
door2 moveY(-24,1,0.5,0.5);
door2 waittill("movedone");
door1 moveX(8,1,0.5,0.5);
door1 waittill("movedone");
door2 moveX(8,1,0.5,0.5);
door2 waittill("movedone");
wait 5;
else
user iprintlnbold("Wrong Code, Try Again");
level.code = "";
wait 5;
}
}

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: "Bad Syntax"

Post by waywaaaard » April 16th, 2010, 4:46 pm

Basic understanding of scripting is missing I guess. Look at Drofder's Scripting Guide. You need braces for your condition.

http://pastebin.com/XC6e9y7q here version with highlighted bits and syntax highlighting

Code: Select all

door(){
	door1 = getent("door_l","targetname");
	door2 = getent("door_r","targetname");
	trigger = getent("enter","targetname");
	while(1){
		trigger waittill("trigger");
		if(level.code == level.answer){
			user iprintlnbold("Correct Code ^6:D");
			door1 moveX(-8,1,0.5,0.5);
			door1 waittill("movedone");
			door2 moveX(-8,1,0.5,0.5);
			door2 waittill("movedone");
			door1 moveY(-24,1,0.5,0.5);
			door1 waittill("movedone");
			door2 moveY(24,1,0.5,0.5);
			door2 waittill("movedone");
			wait 2;
			door1 moveY(24,1,0.5,0.5);
			door1 waittill("movedone");
			door2 moveY(-24,1,0.5,0.5);
			door2 waittill("movedone");
			door1 moveX(8,1,0.5,0.5);
			door1 waittill("movedone");
			door2 moveX(8,1,0.5,0.5);
			door2 waittill("movedone");
			wait 5;
		}else{
			user iprintlnbold("Wrong Code, Try Again");
			level.code = "";
			wait 5;
		}
}
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

BatterY
CJ Worshipper
CJ Worshipper
Posts: 238
Joined: January 29th, 2010, 10:27 pm

Re: "Bad Syntax"

Post by BatterY » April 16th, 2010, 5:01 pm

thanks, but was it "Learn from your mistakes" ?

EDIT:
haha, you forgot to add one "}" in the end :lol:
Last edited by BatterY on April 16th, 2010, 5:12 pm, edited 1 time in total.

User avatar
waywaaaard
Core Staff
Core Staff
Posts: 2214
Joined: February 6th, 2006, 3:18 pm
Location: Germany/Bayern

Re: "Bad Syntax"

Post by waywaaaard » April 16th, 2010, 5:10 pm

Yeah of course but try to read the guide so you get known to the basic constructs of the language.
THAT HANDS WERE NOT TRACED!
visit my blog: Link
Soviet wrote:Yeah, watch out, Peds will hit you with his +5 D-Battleaxe of homosexuality :roll:

Post Reply

Who is online

Users browsing this forum: No registered users and 26 guests