compil script errror with my map

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

Moderator: Core Staff

Post Reply
soyeur
CJ Wannabe
CJ Wannabe
Posts: 23
Joined: June 13th, 2009, 3:33 pm

compil script errror with my map

Post by soyeur » June 21st, 2009, 4:18 pm

hi all im making aa fun map wiith elevator and teleporter and when i finished my map there where a script error and when i deleted my elevator with her script the map works and the teleporter too and wheen i deletaed my teleporter my elevator worked so i think there is a syntax error in my map.gsc so can you say me what's wrong !


my gsc file:

main() {
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
}

elevator_start() {
elevator = getentarray ("elevatorswitch","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}

elevator_think() {
while (1) {
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();
}
}

elevator_move() {
elevatormodel = getent ("elevatormodel", "targetname");
level.elevatorMoving = true;
speed = 2;
height = 228;
wait (1);
if (level.elevatorDown) { // moves to top
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else { // moves to bottom
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height - (height * 2), speed);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;
}
{
thread teleporter();
}
teleporter()
{
trigger = getent ("teleporter", "targetname");
while(1)
{
trigger waittill ("trigger",user);
user iprintlnbold ("Now Teleporting...");
wait(1);
user setOrigin( (816 , -1016, 432) );
wait(1);
}
}

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: compil script errror with my map

Post by Drofder2004 » June 21st, 2009, 5:51 pm

As long as there is only 1 line after and if or for statement it is fine...

ie..

if(a == 1)
runThread();

but doing something like

if(a == 1)
sayHello();
runthread();

If 'a' is not equal to 1, it will still run anything after the first line (runthread)...

I will look after eating my steak :P
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: compil script errror with my map

Post by Drofder2004 » June 21st, 2009, 11:57 pm

Ok, here is the code in its NORMAL format, none of that 'brakets-on-same-line' shit. If you are going to open up curly brackets, move then to the line below >.<

Code: Select all

main() 
{
	level.elevatorDown = true; // elevator starts at bottom: true/false
	level.elevatorMoving = false; // elevator is not currently moving
	thread elevator_start();
}

elevator_start() 
{
	elevator = getentarray ("elevatorswitch","targetname");
	if ( isdefined(elevator) )
		for (i = 0; i < elevator.size; i++)
			elevator[i] thread elevator_think();
}

elevator_think()
{
	while (1) 
	{
		self waittill ("trigger");
		if (!level.elevatorMoving)
			thread elevator_move();
	}
}

elevator_move()
{
	elevatormodel = getent ("elevatormodel", "targetname");
	level.elevatorMoving = true;
	speed = 2;
	height = 228;
	wait (1);
	if (level.elevatorDown) 
	{ // moves to top
		elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
			
		wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
		elevatormodel moveZ (height, speed);
		elevatormodel waittill ("movedone");
		level.elevatorDown = false;
	}
	else
	{ // moves to bottom
		elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
		wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
		elevatormodel moveZ (height - (height * 2), speed);
		elevatormodel waittill ("movedone");
		level.elevatorDown = true;
	}
	level.elevatorMoving = false;
}

{
thread teleporter();
}

teleporter()
{
	trigger = getent ("teleporter", "targetname");
	while(1)
	{
		trigger waittill ("trigger",user);
		user iprintlnbold ("Now Teleporting...");
		wait(1);
		user setOrigin( (816 , -1016, 432) );
		wait(1);
	}
}
For some unknown reason, you will see the following just floating outside of a function...

Code: Select all

{
thread teleporter();
}
That needs to be put in the main functions, without using the brackets...

And yes, it was £5 worth of fucking big, thick irish beef rump steak, cooked well done, but I had errands to run and then gaming to do first.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

soyeur
CJ Wannabe
CJ Wannabe
Posts: 23
Joined: June 13th, 2009, 3:33 pm

Re: compil script errror with my map

Post by soyeur » June 22nd, 2009, 12:49 am

tthat doesnt works =( but when i delete my elevator my teleporter works and when i delete my teleporter my elevator works

Pedsdude
Site Admin
Site Admin
Posts: 15909
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: compil script errror with my map

Post by Pedsdude » June 22nd, 2009, 1:02 am

What about this?

Code: Select all

main() 
{
	level.elevatorDown = true; // elevator starts at bottom: true/false
	level.elevatorMoving = false; // elevator is not currently moving
	thread elevator_start();
	thread teleporter();
}

elevator_start() 
{
	elevator = getentarray ("elevatorswitch","targetname");
	if ( isdefined(elevator) )
		for (i = 0; i < elevator.size; i++)
			elevator[i] thread elevator_think();
}

elevator_think()
{
	while (1) 
	{
		self waittill ("trigger");
		if (!level.elevatorMoving)
			thread elevator_move();
	}
}

elevator_move()
{
	elevatormodel = getent ("elevatormodel", "targetname");
	level.elevatorMoving = true;
	speed = 2;
	height = 228;
	wait (1);
	if (level.elevatorDown) 
	{ // moves to top
		elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
			
		wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
		elevatormodel moveZ (height, speed);
		elevatormodel waittill ("movedone");
		level.elevatorDown = false;
	}
	else
	{ // moves to bottom
		elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
		wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
		elevatormodel moveZ (height - (height * 2), speed);
		elevatormodel waittill ("movedone");
		level.elevatorDown = true;
	}
	level.elevatorMoving = false;
}

teleporter()
{
	trigger = getent ("teleporter", "targetname");
	while(1)
	{
		trigger waittill ("trigger",user);
		user iprintlnbold ("Now Teleporting...");
		wait(1);
		user setOrigin( (816 , -1016, 432) );
		wait(1);
	}
}
Image
Image

soyeur
CJ Wannabe
CJ Wannabe
Posts: 23
Joined: June 13th, 2009, 3:33 pm

Re: compil script errror with my map

Post by soyeur » June 22nd, 2009, 1:08 am

that's working thnaks you alot but if i want to make more teleporters and elevator? how ca n i do?

soyeur
CJ Wannabe
CJ Wannabe
Posts: 23
Joined: June 13th, 2009, 3:33 pm

Re: compil script errror with my map

Post by soyeur » June 22nd, 2009, 1:22 am

ok ty alot mate !

soyeur
CJ Wannabe
CJ Wannabe
Posts: 23
Joined: June 13th, 2009, 3:33 pm

Re: compil script errror with my map

Post by soyeur » June 22nd, 2009, 1:37 am

hum i made a second teleporter but that's not working =( look at my gsc file:


main()
{
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
thread teleporter();
thread teleporter1();
}

elevator_start()
{
elevator = getentarray ("elevatorswitch","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}

elevator_think()
{
while (1)
{
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();
}
}

elevator_move()
{
elevatormodel = getent ("elevatormodel", "targetname");
level.elevatorMoving = true;
speed = 2;
height = 228;
wait (1);
if (level.elevatorDown)
{ // moves to top
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv

wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else
{ // moves to bottom
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height - (height * 2), speed);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;
}

teleporter()
{
trigger = getent ("teleporter", "targetname");
while(1)
{
trigger waittill ("trigger",user);
user iprintlnbold ("Now Teleporting...");
wait(1);
user setOrigin( (1375 , 1016, -293) );
wait(1);
}
}
main()
{
level.elevatorDown = true; // elevator starts at bottom: true/false
level.elevatorMoving = false; // elevator is not currently moving
thread elevator_start();
thread teleporter();
}

elevator_start()
{
elevator = getentarray ("elevatorswitch","targetname");
if ( isdefined(elevator) )
for (i = 0; i < elevator.size; i++)
elevator thread elevator_think();
}

elevator_think()
{
while (1)
{
self waittill ("trigger");
if (!level.elevatorMoving)
thread elevator_move();
}
}

elevator_move()
{
elevatormodel = getent ("elevatormodel", "targetname");
level.elevatorMoving = true;
speed = 2;
height = 228;
wait (1);
if (level.elevatorDown)
{ // moves to top
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv

wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height, speed);
elevatormodel waittill ("movedone");
level.elevatorDown = false;
}
else
{ // moves to bottom
elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
elevatormodel moveZ (height - (height * 2), speed);
elevatormodel waittill ("movedone");
level.elevatorDown = true;
}
level.elevatorMoving = false;

teleporter1()
{
trigger = getent ("teleporter1", "targetname");
while(1)
{
trigger waittill ("trigger",user);
user iprintlnbold ("Now Teleporting...");
wait(1);
user setOrigin( (1300 , 9777, -293) );
wait(1);

Pedsdude
Site Admin
Site Admin
Posts: 15909
Joined: October 15th, 2004, 7:18 pm
Location: UK

Re: compil script errror with my map

Post by Pedsdude » June 22nd, 2009, 1:48 am

Eugh, there's no need to copy/paste all of the previous code for the new teleporter to work.

Here's a fixed version:

Code: Select all

main() 
{
	level.elevatorDown = true; // elevator starts at bottom: true/false
	level.elevatorMoving = false; // elevator is not currently moving
	thread elevator_start();
	thread teleporter();
	thread teleporter1();
}

elevator_start() 
{
	elevator = getentarray ("elevatorswitch","targetname");
	if ( isdefined(elevator) )
		for (i = 0; i < elevator.size; i++)
			elevator[i] thread elevator_think();
}

elevator_think()
{
	while (1) 
	{
		self waittill ("trigger");
		if (!level.elevatorMoving)
			thread elevator_move();
	}
}

elevator_move()
{
	elevatormodel = getent ("elevatormodel", "targetname");
	level.elevatorMoving = true;
	speed = 2;
	height = 228;
	wait (1);
	if (level.elevatorDown) 
	{ // moves to top
		elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
			
		wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
		elevatormodel moveZ (height, speed);
		elevatormodel waittill ("movedone");
		level.elevatorDown = false;
	}
	else
	{ // moves to bottom
		elevatormodel playsound ("elevator1"); // sound definition for soundaliases.csv
		wait (1); // wait a second to hear the motor start and then start the movement of the lift - feels more realistic
		elevatormodel moveZ (height - (height * 2), speed);
		elevatormodel waittill ("movedone");
		level.elevatorDown = true;
	}
	level.elevatorMoving = false;
}

teleporter()
{
	trigger = getent ("teleporter", "targetname");
	while(1)
	{
		trigger waittill ("trigger",user);
		user iprintlnbold ("Now Teleporting...");
		wait(1);
		user setOrigin( (816 , -1016, 432) );
		wait(1);
	}
}

teleporter1()
{
	trigger = getent ("teleporter1", "targetname");
	while(1)
	{
		trigger waittill ("trigger",user);
		user iprintlnbold ("Now Teleporting...");
		wait(1);
		user setOrigin( (1300 , 9777, -293) );
		wait(1);
	}
}
Of course, made sure that in the map editor you copied the older trigger and renamed the targetname to "teleporter1".
Image
Image

soyeur
CJ Wannabe
CJ Wannabe
Posts: 23
Joined: June 13th, 2009, 3:33 pm

Re: compil script errror with my map

Post by soyeur » June 22nd, 2009, 1:53 am

ty

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Re: compil script errror with my map

Post by Nightmare » June 22nd, 2009, 2:41 am

Jesus christ, please, please, please, please DO NOT use that useless script at modsonline.
It is terribly inefficient and confusing.

Code: Select all

main() 
{
	moveElevator();
	thread teleporter();
	thread teleporter1();
}

moveElevator()
{
	while(1)
	{
		trigger = getent ("elevatorTrigger","targetname");	//Assign trigger entitiy to variable trigger
		ele = getent ("elevatorModel", "targetname");		//Assign elevator entity to variable ele
		trigger waittill ("trigger");				//Wait till triggered
		ele moveZ (228, 2);					//Move elevator along Z axis 228 units (Up) in 2 seconds
		ele waittill ("movedone");				//Wait until elevator entity has finished moving
		wait 5;							//Wait 5 seconds
		ele moveZ (-228, 2);					//Move elevator along Z axis -228 units (Down) in 2 seconds
		ele waittill ("movedone");				
		wait 0.05;
	}
}

teleporter()
{
	trigger = getent ("teleporter", "targetname");
	while(1)
	{
		trigger waittill ("trigger",user);
		user setOrigin( (816 , -1016, 432) );
		wait(1);
	}
}

teleporter1()
{
	trigger = getent ("teleporter1", "targetname");
	while(1)
	{
		trigger waittill ("trigger",user);
		user setOrigin( (1300 , 9777, -293) );
		wait(1);
	}
}
Also, I cannot stress this enough, but please use your map name in front for the targetname if possible.
For example: mapname_elevatorTrigger.
This helps prevent conflicting with other maps.

If you still don't fully follow on how to make moving script_brushmodels, follow my tutorial here: viewtopic.php?f=18&t=2963.
I promise it will make much more sense than what is posted at ModsOnline.
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: compil script errror with my map

Post by Drofder2004 » June 22nd, 2009, 5:01 am

Nightmare wrote:Jesus christ, please, please, please, please DO NOT use that useless script at modsonline.
It is terribly inefficient and confusing.
lol, was gonna say the same, but didn't want to get too involved. Fix it and get out :P
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

soyeur
CJ Wannabe
CJ Wannabe
Posts: 23
Joined: June 13th, 2009, 3:33 pm

Re: compil script errror with my map

Post by soyeur » June 22nd, 2009, 3:26 pm

i would like to know how to put health pack and weapons (bar,mp44...) on my map please

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: compil script errror with my map

Post by Drofder2004 » June 22nd, 2009, 4:59 pm

In radiant, right click the 2D window, I think they are under "mp" or somewhere in that drop down list.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 28 guests