script error
Moderator: Core Staff
script error
hi
can u guys help me and try to find what is wrong with this script....please:
main()
{
maps\mp\_load::main();
move_trig = getent("vozicek","targetname");
move = getent("vozicek1","targetname");
move_trig enablelinkto();
move_trig linkto(move);
move_trig thread check();
while(1)
{
move moveY(2300, 20);
wait 5;
move moveY(-2300, 20);
wait 5;
}
}
check()
{
while(1)
{
self waittill("trigger");
iprintln("text");
wait 10;
}
}
thread door1_rotate();
}
door1_rotate()
{
door1 = getent("door1", "targetname");
trig = getent("door_trigger1", "targetname");
while (1)
{
trig waittill("trigger");
door1 rotateYaw(-90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
wait (3);
door1 rotateYaw(90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
}
}
can u guys help me and try to find what is wrong with this script....please:
main()
{
maps\mp\_load::main();
move_trig = getent("vozicek","targetname");
move = getent("vozicek1","targetname");
move_trig enablelinkto();
move_trig linkto(move);
move_trig thread check();
while(1)
{
move moveY(2300, 20);
wait 5;
move moveY(-2300, 20);
wait 5;
}
}
check()
{
while(1)
{
self waittill("trigger");
iprintln("text");
wait 10;
}
}
thread door1_rotate();
}
door1_rotate()
{
door1 = getent("door1", "targetname");
trig = getent("door_trigger1", "targetname");
while (1)
{
trig waittill("trigger");
door1 rotateYaw(-90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
wait (3);
door1 rotateYaw(90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
}
}
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Thats the line Drofder said was wrong, coz it's in the wrong place. I put something together quckly which may or may not work******* script compile error *******
bad syntax: (file 'maps/mp/mp_rudnik.gsc', line 31)
thread door1_rotate();
Code: Select all
main()
{
maps\mp\_load::main();
move_trig enablelinkto();
move_trig linkto(move);
thread move();
thread door1_rotate();
}
move()
{
move_trig = getent("vozicek","targetname");
move = getent("vozicek1","targetname");
move_trig thread check();
while(1)
{
move moveY(2300, 20);
wait 5;
move moveY(-2300, 20);
wait 5;
}
}
check()
{
while(1)
{
self waittill("trigger");
iprintln("text");
wait 10;
}
}
door1_rotate()
{
door1 = getent("door1", "targetname");
trig = getent("door_trigger1", "targetname");
while (1)
{
trig waittill("trigger");
door1 rotateYaw(-90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
wait (3);
door1 rotateYaw(90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
}
}
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php
Sorry I put the linkto in the wrong place. These lines:
move_trig enablelinkto();
move_trig linkto(move);
should be below:
move()
{
move_trig = getent("vozicek","targetname");
move = getent("vozicek1","targetname");
Just cut and paste them to there.
move_trig enablelinkto();
move_trig linkto(move);
should be below:
move()
{
move_trig = getent("vozicek","targetname");
move = getent("vozicek1","targetname");
Just cut and paste them to there.
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php
You should add move waittill("movedone"); directly below each move command i think. This tells it to complete the move before doing anything else.
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
What do you mean I was wrong?
Check that above, and tell me I was wrong.
There are 2 problems with the above, the first being obvious... There are 2 { (open brackets) and 3 } (close brackets) so in theory, you are closing a bracket that doesnt exist, causing an error.
The second problem is the format of the text AFTER the fix has been added, lets look at the code with no errors...
I always read codes aloud like it is a normal sentence. In this case...
"While loop is true, wait til trigger is triggered then print text. Wait 10 seconds and re-loop."
As you can see in that sentence, thread door1_rotate is never mentioned, that is because "while(1)" is an infinite loop (well, until "return 0;" is called)...
#
Just to answer other questions raised in this thread...
developer is a command used to enable "debuggin" mode". It is used by developers (obviously?).
Before loading a map or mod, type in console /developer 1
This starts up developer mode.
Once started errors will be shown on screen and the error will contain exact details, with out this you will get a weird @##### error (where the # are numbers, eg @51002)
If you are using a movement command, unless required, always use "<ent> waittill("movedone");"
All this basically does is look at the previous move command, gets the wait time and automatically waits for it to complete.
Code: Select all
check()
{
while(1)
{
self waittill("trigger");
iprintln("text");
wait 10;
}
}
thread door1_rotate();
}
There are 2 problems with the above, the first being obvious... There are 2 { (open brackets) and 3 } (close brackets) so in theory, you are closing a bracket that doesnt exist, causing an error.
The second problem is the format of the text AFTER the fix has been added, lets look at the code with no errors...
Code: Select all
check()
{
while(1)
{
self waittill("trigger");
iprintln("text");
wait 10;
}
thread door1_rotate();
}
"While loop is true, wait til trigger is triggered then print text. Wait 10 seconds and re-loop."
As you can see in that sentence, thread door1_rotate is never mentioned, that is because "while(1)" is an infinite loop (well, until "return 0;" is called)...
#
Just to answer other questions raised in this thread...
developer is a command used to enable "debuggin" mode". It is used by developers (obviously?).
Before loading a map or mod, type in console /developer 1
This starts up developer mode.
Once started errors will be shown on screen and the error will contain exact details, with out this you will get a weird @##### error (where the # are numbers, eg @51002)
If you are using a movement command, unless required, always use "<ent> waittill("movedone");"
All this basically does is look at the previous move command, gets the wait time and automatically waits for it to complete.
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
Code: Select all
What do you mean I was wrong?
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Indeed, more than likely...KillerSam wrote:Perhaps a bad interpretationlukey boy wrote:Thats the line Drofder said was wrong, coz it's in the wrong place.
I was reading it pretty quickly and without much thought
And yes, it is very possible, but not in the case of "basics"
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
ok this is my .gsc file....what shall i change so my platform ll move normaly
main()
{
maps\mp\_load::main();
thread move();
thread door1_rotate();
}
move()
{
move_trig = getent("vozicek","targetname");
move = getent("vozicek1","targetname");
move_trig enablelinkto();
move_trig linkto(move);
move_trig thread check();
while(1)
{
move moveY(2300, 5);
wait 5;
move moveY(-2300, 5);
wait 5;
}
}
check()
{
while(1)
{
self waittill("trigger");
iprintln("text");
wait 10;
}
}
door1_rotate()
{
door1 = getent("door1", "targetname");
trig = getent("door_trigger1", "targetname");
while (1)
{
trig waittill("trigger");
door1 rotateYaw(-90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
wait (3);
door1 rotateYaw(90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
}
}
main()
{
maps\mp\_load::main();
thread move();
thread door1_rotate();
}
move()
{
move_trig = getent("vozicek","targetname");
move = getent("vozicek1","targetname");
move_trig enablelinkto();
move_trig linkto(move);
move_trig thread check();
while(1)
{
move moveY(2300, 5);
wait 5;
move moveY(-2300, 5);
wait 5;
}
}
check()
{
while(1)
{
self waittill("trigger");
iprintln("text");
wait 10;
}
}
door1_rotate()
{
door1 = getent("door1", "targetname");
trig = getent("door_trigger1", "targetname");
while (1)
{
trig waittill("trigger");
door1 rotateYaw(-90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
wait (3);
door1 rotateYaw(90, 1.5, 0.7, 0.7);
door1 waittill("rotatedone");
}
}
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
could you explain what you are doing in this thread?t3vY wrote:move()
{
move_trig = getent("vozicek","targetname");
move = getent("vozicek1","targetname");
move_trig enablelinkto();
move_trig linkto(move);
move_trig thread check();
while(1)
{
move moveY(2300, 5);
wait 5;
move moveY(-2300, 5);
wait 5;
}
}
this thread above is a thread I wrote for a moving trigger attached to a moving platform, is this what you are trying to achieve? Or just a moving platform?
Explain what you are trying to make, because I am confused...
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 1 guest