script error

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

Moderator: Core Staff

Post Reply
User avatar
t3vY
CJ Worshipper
CJ Worshipper
Posts: 362
Joined: January 15th, 2006, 1:57 pm
Location: zamušani

script error

Post by t3vY » September 14th, 2006, 6:20 pm

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");
}
}

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

Post by Drofder2004 » September 15th, 2006, 1:23 am

You have

thread door1_rotate();
}

Floating in the middle of nowhere?
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
t3vY
CJ Worshipper
CJ Worshipper
Posts: 362
Joined: January 15th, 2006, 1:57 pm
Location: zamušani

Post by t3vY » September 15th, 2006, 2:07 pm

Start the map with /developer 1 enabled.
what is developer :oops: ?

ok this is what i get 4 error:

******* script compile error *******
bad syntax: (file 'maps/mp/mp_rudnik.gsc', line 31)
thread door1_rotate();

:cry:


You have

thread door1_rotate();
}

Floating in the middle of nowhere?


what shall i do?

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » September 15th, 2006, 2:23 pm

******* 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 :P

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

User avatar
t3vY
CJ Worshipper
CJ Worshipper
Posts: 362
Joined: January 15th, 2006, 1:57 pm
Location: zamušani

Post by t3vY » September 15th, 2006, 2:30 pm

now there is a new error :cry: :cry:

******* script compile error *******
uninitialised variable 'move_trig': (file 'maps/mp/mp_rudnik.gsc', line 4)
move_trig enablelinkto();

please help :roll:

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » September 15th, 2006, 2:42 pm

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.
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php

User avatar
t3vY
CJ Worshipper
CJ Worshipper
Posts: 362
Joined: January 15th, 2006, 1:57 pm
Location: zamušani

Post by t3vY » September 15th, 2006, 2:54 pm

tnx luke it works great now :D :D
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 :roll:

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » September 15th, 2006, 5:37 pm

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

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

Post by Drofder2004 » September 15th, 2006, 6:46 pm

What do you mean I was wrong? :P

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.
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

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » September 15th, 2006, 7:41 pm

Code: Select all

What do you mean I was wrong?
Who said you was wrong? I certainly didn't :? is that possible anyway? :P
Watch this before posting a question: http://www.albinoblacksheep.com/flash/posting.php

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

Post by Drofder2004 » September 15th, 2006, 8:31 pm

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 :P

And yes, it is very possible, but not in the case of "basics" ;)
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
t3vY
CJ Worshipper
CJ Worshipper
Posts: 362
Joined: January 15th, 2006, 1:57 pm
Location: zamušani

Post by t3vY » September 15th, 2006, 9:47 pm

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");
}
}

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

Post by Drofder2004 » September 16th, 2006, 3:07 am

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...
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
t3vY
CJ Worshipper
CJ Worshipper
Posts: 362
Joined: January 15th, 2006, 1:57 pm
Location: zamušani

Post by t3vY » September 16th, 2006, 10:16 am

i would like that my platform ll move 2300 units in 20 secons (horizontaly), with this script this cant be achieved(i think) :roll:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest