Page 1 of 1
script error
Posted: September 14th, 2006, 6:20 pm
by t3vY
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");
}
}
Posted: September 15th, 2006, 1:23 am
by Drofder2004
You have
thread door1_rotate();
}
Floating in the middle of nowhere?
Posted: September 15th, 2006, 2:07 pm
by t3vY
Start the map with /developer 1 enabled.
what is developer

?
ok this is what i get 4 error:
******* script compile error *******
bad syntax: (file 'maps/mp/mp_rudnik.gsc', line 31)
thread door1_rotate();
You have
thread door1_rotate();
}
Floating in the middle of nowhere?
what shall i do?
Posted: September 15th, 2006, 2:23 pm
by Luke
******* script compile error *******
bad syntax: (file 'maps/mp/mp_rudnik.gsc', line 31)
thread door1_rotate();
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
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");
}
}
Posted: September 15th, 2006, 2:30 pm
by t3vY
now there is a new error
******* script compile error *******
uninitialised variable 'move_trig': (file 'maps/mp/mp_rudnik.gsc', line 4)
move_trig enablelinkto();
please help

Posted: September 15th, 2006, 2:42 pm
by Luke
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.
Posted: September 15th, 2006, 2:54 pm
by t3vY
tnx luke it works great now
just one question:
if i have this
move moveY(2300, 5);
wait 5;
my moving platform go 2300units but if i change time from 5 to 20 platform makes just 800 units why?
i hope you ll understand me

Posted: September 15th, 2006, 5:37 pm
by Luke
You should add move waittill("movedone"); directly below each move command i think. This tells it to complete the move before doing anything else.
Posted: September 15th, 2006, 6:46 pm
by Drofder2004
What do you mean I was wrong?
Code: Select all
check()
{
while(1)
{
self waittill("trigger");
iprintln("text");
wait 10;
}
}
thread door1_rotate();
}
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...
Code: Select all
check()
{
while(1)
{
self waittill("trigger");
iprintln("text");
wait 10;
}
thread door1_rotate();
}
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.
Posted: September 15th, 2006, 7:41 pm
by Luke
Who said you was wrong? I certainly didn't

is that possible anyway?

Posted: September 15th, 2006, 8:31 pm
by Drofder2004
KillerSam wrote:lukey boy wrote:Thats the line Drofder said was wrong, coz it's in the wrong place.
Perhaps a bad interpretation
Indeed, more than likely...
I was reading it pretty quickly and without much thought
And yes, it is very possible, but not in the case of "basics"

Posted: September 15th, 2006, 9:47 pm
by t3vY
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");
}
}
Posted: September 16th, 2006, 3:07 am
by Drofder2004
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;
}
}
could you explain what you are doing in this thread?
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...
Posted: September 16th, 2006, 10:16 am
by t3vY
i would like that my platform ll move 2300 units in 20 secons (horizontaly), with this script this cant be achieved(i think)
