compil script errror with my map
Moderator: Core Staff
- 
				soyeur
- CJ Wannabe 
- Posts: 23
- Joined: June 13th, 2009, 3:33 pm
compil script errror with my map
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);
}
}
			
			
									
									
						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);
}
}
- 
				Drofder2004  
- Core Staff 
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: compil script errror with my map
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
			
			
									
									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


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
- 
				Drofder2004  
- Core Staff 
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: compil script errror with my map
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 >.<
For some unknown reason, you will see the following just floating outside of a function...
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.
			
			
									
									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);
	}
}Code: Select all
{
thread teleporter();
}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.

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 
- Posts: 23
- Joined: June 13th, 2009, 3:33 pm
Re: compil script errror with my map
tthat doesnt works =( but when i delete my elevator my teleporter works and when i delete my teleporter my elevator works
			
			
									
									
						- 
				Pedsdude
- Site Admin 
- Posts: 15914
- Joined: October 15th, 2004, 7:18 pm
- Location: UK
Re: compil script errror with my map
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);
	}
}

- 
				soyeur
- CJ Wannabe 
- Posts: 23
- Joined: June 13th, 2009, 3:33 pm
Re: compil script errror with my map
that's working thnaks you alot but if i want to make more teleporters and elevator? how ca n i do?
			
			
									
									
						- 
				soyeur
- CJ Wannabe 
- Posts: 23
- Joined: June 13th, 2009, 3:33 pm
Re: compil script errror with my map
ok ty alot mate !
			
			
									
									
						- 
				soyeur
- CJ Wannabe 
- Posts: 23
- Joined: June 13th, 2009, 3:33 pm
Re: compil script errror with my map
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);
			
			
									
									
						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 
- Posts: 15914
- Joined: October 15th, 2004, 7:18 pm
- Location: UK
Re: compil script errror with my map
Eugh, there's no need to copy/paste all of the previous code for the new teleporter to work.
Here's a fixed version:
Of course, made sure that in the map editor you copied the older trigger and renamed the targetname to "teleporter1".
			
			
									
									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);
	}
}

- 
				soyeur
- CJ Wannabe 
- Posts: 23
- Joined: June 13th, 2009, 3:33 pm
- 
				Nightmare  
- Core Staff 
- Posts: 2688
- Joined: January 12th, 2006, 10:09 pm
- Contact:
Re: compil script errror with my map
Jesus christ, please, please, please, please DO NOT use that useless script at modsonline.
It is terribly inefficient and confusing.
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.
			
			
									
									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);
	}
}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]
						"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]
- 
				Drofder2004  
- Core Staff 
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: compil script errror with my map
lol, was gonna say the same, but didn't want to get too involved. Fix it and get outNightmare wrote:Jesus christ, please, please, please, please DO NOT use that useless script at modsonline.
It is terribly inefficient and confusing.


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 
- Posts: 23
- Joined: June 13th, 2009, 3:33 pm
Re: compil script errror with my map
i would like to know how to put health pack and weapons (bar,mp44...)  on my map please
			
			
									
									
						- 
				Drofder2004  
- Core Staff 
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: compil script errror with my map
In radiant, right click the 2D window, I think they are under "mp" or somewhere in that drop down list.
			
			
									
									
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