script compile error (on elevator)
Moderator: Core Staff
script compile error (on elevator)
Hey
i just started to make maps (4 days ago) and made some work (easy ones without gsc files)
i wanted to created an elevator just into a test map (how it works e.g.) and i have a script compile error
the directory of my files are both in
cod/main/maps/mp (that is probably right)
this is the problem that is been given on my console:
http://rapidshare.de/files/13020777/pic1.GIF.html
This is my GSC file
http://rapidshare.de/files/13020853/ele ... t.gsc.html
And this is my map (bsp and map so you can see how i named my brushes)
http://rapidshare.de/files/13020940/ele ... t.bsp.html
http://rapidshare.de/files/13020982/ele ... t.map.html
it is an very basic map i made (spawn, (simple) skybox, intermission, and elevator .. that is all .. so to find the problem shouldent be that hard i hope some of you guys can help me =)
thnx anyway =)
i just started to make maps (4 days ago) and made some work (easy ones without gsc files)
i wanted to created an elevator just into a test map (how it works e.g.) and i have a script compile error
the directory of my files are both in
cod/main/maps/mp (that is probably right)
this is the problem that is been given on my console:
http://rapidshare.de/files/13020777/pic1.GIF.html
This is my GSC file
http://rapidshare.de/files/13020853/ele ... t.gsc.html
And this is my map (bsp and map so you can see how i named my brushes)
http://rapidshare.de/files/13020940/ele ... t.bsp.html
http://rapidshare.de/files/13020982/ele ... t.map.html
it is an very basic map i made (spawn, (simple) skybox, intermission, and elevator .. that is all .. so to find the problem shouldent be that hard i hope some of you guys can help me =)
thnx anyway =)
Code: Select all
main() {
thread elevator_start();
}
elevator_start() {
elevator = getent ("elevatormodel","targetname");
elevator_trig = getent ("elevatorswitch","targetname")
while (1)
{
elevator_trig waittill ("trigger");
wait 3;
elecator movez (956, 3, 1, 2);
elevator waittill ("movedone");
wait 5;
elevator movez (-956, 3, 1, 2);
elevator waittill ("movedone");
wait 1;
}
}
Code: Select all
elevator_trig = getent ("elevatorswitch","targetname")
Code: Select all
elevator_trig = getent ("elevatorswitch","targetname");



Code: Select all
bad token ' ': (File 'maps\mp\elevatortest.gsc'. line 1)
and what peds said, apart from that i couldnt find much elseelecator movez (956, 3, 1, 2);

Drofder
Last edited by Luke on February 11th, 2006, 3:30 pm, edited 1 time in total.
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
The only 2 mistakes are spotted.
1 thing, and this wont effect the coding at all, but personally I prefer to put the {} on their own lines (not on the same line as the thread)
So after changing the 2 mistakes above and my own personally preference, this would be the code,
Also your script doesnt work like a real lift, it waits and then automatically comes up. I dont know the proper way of doing this ( I have seen some really fancy ways) but my code would be [untested]
Also, another thing I would do is use moveto instead of movez. This is simply to stop problems of the lift not going back to the exact position if it gets stuck.
As I said the code is untested but it looks fine
1 thing, and this wont effect the coding at all, but personally I prefer to put the {} on their own lines (not on the same line as the thread)
So after changing the 2 mistakes above and my own personally preference, this would be the code,
Code: Select all
main()
{
thread elevator_start();
}
elevator_start()
{
elevator = getent ("elevatormodel","targetname");
elevator_trig = getent ("elevatorswitch","targetname");
while (1)
{
elevator_trig waittill ("trigger");
wait 3;
elevator movez (956, 3, 1, 2);
elevator waittill ("movedone");
wait 5;
elevator movez (-956, 3, 1, 2);
elevator waittill ("movedone");
wait 1;
}
}
Code: Select all
main()
{
thread elevator_start();
}
elevator_start()
{
elevator = getent ("elevatormodel","targetname");
elevator_trig = getent ("elevatorswitch","targetname");
position = 0;
while (1)
{
elevator_trig waittill ("trigger");
wait 3;
if(position == 0)
{
elevator movez (956, 3, 1, 2);
position = 1;
}
else if(position == 1)
{
elevator movez (-956, 3, 1, 2);
position = 0;
}
elevator waittill ("movedone");
}
}
As I said the code is untested but it looks fine


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
@Pedsdude thnx .. i will look for that kind of mistakes more often if it will give that kind of error =)
@Luke you are right .. it is the same script cos i was trying to make one myself but i didnt get it working so i kinda copie it and try if it was working
i hope you dont mind
only because of my lazyness to modifie the heights and speed
@drofder2004 Thnx ... your script worked very good ..
@Pwn-Rikku .. no comment
@Luke you are right .. it is the same script cos i was trying to make one myself but i didnt get it working so i kinda copie it and try if it was working


@drofder2004 Thnx ... your script worked very good ..

@Pwn-Rikku .. no comment

yeah..i've been trying to make a realistic elevator coz rince asked me to, but i've been using movez for the up and down movement, and moveto for the doors, this is what i used for the doors, using a trigger_multiple so theyre like realistic automatic doors:KillerSam wrote:thats what i was wondering....is it just replace movey with moveto and then the co-ordinates instead of the amount?
Code: Select all
door2()
{
door3 = getent ("door3","targetname");
door4 = getent ("door4","targetname");
door_trig2 = getent ("door_trig2","targetname");
while (1)
{
door_trig2 waittill ("trigger");
door3 moveto ((0, 32,0), 1,0.5,0.5);
door4 moveto ((0, -32,0), 1,0.5,0.5);
wait (1);
door3 moveto ((0, 0,0), 1,0.5,0.5);
door4 moveto ((0, 0,0), 1,0.5,0.5);
}
}
Code: Select all
elevator1()
{
door1 = getent ("door1","targetname");
door2 = getent ("door2","targetname");
door1_button = getent ("door1_button","targetname");
door1a = getent ("door1a","targetname");
door1b = getent ("door1b","targetname");
lift1 = getent ("lift1","targetname");
lift1_trig = getent ("lift1_trig","targetname");
lift1_sound = getent ("lift1_sound","targetname");
while (1)
{
lift1_trig waittill ("trigger",user);
door1a moveto ((0, -32,0), 1,0.5,0.5);
door1b moveto ((0, 32,0), 1,0.5,0.5);
wait (3);
lift1_sound playsound("lift1");
lift1 movez (511, 3, 1, 2);
door1a movez (511, 3, 1, 2);
door1b movez (511, 3, 1, 2);
door1_button movez (511, 3, 1, 2);
wait 3;
door1a movey (32, 3, 1, 2);
door1b movey (-32, 3, 1, 2);
wait 6;
door1a movey (-32, 3, 1, 2);
door1b movey (32, 3, 1, 2);
wait 3;
lift1_sound playsound("lift1");
lift1 movez (-511, 3, 1, 2);
door1a movez (-511, 3, 1, 2);
door1b movez (-511, 3, 1, 2);
door1_button movez (-511, 3, 1, 2);
lift1 waittill ("movedone");
wait 1;
door1a moveto ((0, 0,0), 1,0.5,0.5);
door1b moveto ((0, 0,0), 1,0.5,0.5);
door1 moveto ((0, 32,0), 1,0.5,0.5);
door2 moveto ((0, -32,0), 1,0.5,0.5);
}
}
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
The moveto function works exactly how it says it does, it moves the script_whatever to an origin.
So, you make your script_brushmodel (either make sure it has an origin brush or an origin key)
The functions works like this
variable moveto ((x,y,z),t,a,d)
(x,y,z) = the exact coordinates
t = time it should take
a = acceleraion
d = decceleration
(a+d) =< t
Use the editor to get origins of all the positions.
So, you make your script_brushmodel (either make sure it has an origin brush or an origin key)
The functions works like this
variable moveto ((x,y,z),t,a,d)
(x,y,z) = the exact coordinates
t = time it should take
a = acceleraion
d = decceleration
(a+d) =< t
Use the editor to get origins of all the positions.

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
I don't see much difference tbh, except the moveto function has a fixed origin, so when u tell it to move something it will always move from its origin first, thats what i've found with it anyway. so i assume with that theres no way to (for example) make something moveto up 100 units, wait, and move from that spot to another?
-
- Core Staff
- Posts: 13315
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
movez (100, 1)Luke wrote:I don't see much difference tbh, except the moveto function has a fixed origin, so when u tell it to move something it will always move from its origin first, thats what i've found with it anyway. so i assume with that theres no way to (for example) make something moveto up 100 units, wait, and move from that spot to another?
wait 3;
move...
???
Moveto is the best option because movex/y/z can screw up and move to far. e.g
Lift at z of 0
moves up to 100
tries to move down to 0 again but is blocked (script gets confused)
lift then moves up again to 200. (lift is now flying above the building


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
Who is online
Users browsing this forum: No registered users and 4 guests