Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 79 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Problem moving door Script compile error
dutchman16
General Member
Since: May 8, 2006
Posts: 177
Last: Apr 29, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Sunday, Apr. 19, 2009 03:36 pm
Hello, when I load my map I get a script compile error on line 5
Can you guys take a look at it?

main();
{
doortriggers = getentarray("deur_open","targetname");
for(i=0;i doortriggers
}
thread door_think();

door_think()
{
self.doormoving = false;
self.doorclosed = true;
self.doormodel = getent(self.target, "targetname");

while (1)
{
self waittill("trigger");
if(!self.doormoving)
self thread door_move();
}
}

door_move()
{
self.doormoving = true;
if(self.doorclosed)
{
self.doormodel moveto (((3077,5)(819,5),(0,0),1);
self.doormodel waittill("movetodone");
self.doorclosed = false;
}
else
{
self.doormodel moveto (((3077,5)(819,5),(0,0),1);
self.doormodel waittill("movetodone");
self.doorclosed = true;
}
self.doormoving = false;
}
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Sunday, Apr. 19, 2009 06:16 pm
Try this:

Code:
main();
{
doortriggers = getentarray("deur_open","targetname");
for(i=0;i< doortriggers.size;i++)
doortriggers[i] thread door_think();
}

door_think()
{
self.doormoving = false;
self.doorclosed = true;
self.doormodel = getent(self.target, "targetname");

while (1)
{
self waittill("trigger");
if(!self.doormoving)
self thread door_move();
}
}

door_move()
{
self.doormoving = true;
if(self.doorclosed)
{
self.doormodel moveto (((3077,5)(819,5),(0,0),1);
self.doormodel waittill("movetodone");
self.doorclosed = false;
}
else
{
self.doormodel moveto (((3077,5)(819,5),(0,0),1);
self.doormodel waittill("movetodone");
self.doorclosed = true;
}
self.doormoving = false;
}


Also, use the code button to post scripts, and if you notice, I put a space between the "less than" symbol and doortriggers.size:
< doortriggers.size

This is the reason your code got messed up when posting and turned italic, and removed some of the code, all you need is that simple space..

Why you moved "thread door_think();" to its own line, I don't know, but that's why it gives you the error you had.
Share |
dutchman16
General Member
Since: May 8, 2006
Posts: 177
Last: Apr 29, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Sunday, Apr. 19, 2009 06:43 pm
Thanks

I only get a new error now, It says: Could not find script maps/mp/_deur.gsc
This is my the beginning of my main file:
Code:
 
main()
{

maps\mp\_load::main();
maps\mp\_deur::main();


And I'm just my file is called: _deur.gsc in my raw\maps\mp folder.
Share |
DeekCiti
General Member
Since: Mar 13, 2008
Posts: 1293
Last: Jul 9, 2016
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Sunday, Apr. 19, 2009 07:26 pm
Add the script to your zone file:

rawfile,maps/mp/_deur.gsc


Share |
dutchman16
General Member
Since: May 8, 2006
Posts: 177
Last: Apr 29, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Tuesday, Apr. 21, 2009 03:44 pm
Oke, thank you fixed the most of the problem. Now I got a new error:

That there is a bad syntax on line 1 and 5,

Can someone check my script please?

Code:
main();
{
doortriggers = getentarray("deur_open","targetname");
for(i=0;i< doortriggers.size;i++)
doortriggers[i] thread door_think();
}

door_think()
{
self.doormoving = false;
self.doorclosed = true;
self.doormodel = getent(self.target, "targetname");

while (1)
{
self waittill("trigger");
if(!self.doormoving)
self thread door_move();
}
}

door_move()
{
self.doormoving = true;
if(self.doorclosed)
{
self.doormodel moveto ((3077.5,819.5,0.0),1);
self.doormodel waittill("movetodone");
self.doorclosed = false;
}
else
{
self.doormodel moveto ((3077.5,819.5,0.0),1);
self.doormodel waittill("movetodone");
self.doorclosed = true;
}
self.doormoving = false;
} 
Share |
zeroy
General Member
Since: Nov 26, 2007
Posts: 1060
Last: Mar 12, 2014
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Tuesday, Apr. 21, 2009 04:29 pm
dutchman16 writes...
Quote:
Oke, thank you fixed the most of the problem. Now I got a new error:

That there is a bad syntax on line 1 and 5,

Can someone check my script please?


I don't see any syntax error in that script, especially not Line 1 or 5, are you sure you are getting the error on this script?

edited on Apr. 21, 2009 12:29 pm by zeroy
Share |
techno2sl
General Member
Since: Aug 5, 2004
Posts: 2977
Last: Oct 14, 2010
[view latest posts]
Level 9
Category: CoD4 Scripting
Posted: Tuesday, Apr. 21, 2009 04:41 pm
Load the map:

/developer 2
/devmap mp_yourmapname

Read the error in the console shift + ¬

Also your levels main script is missing a "}"

Code:

main()
{

maps\mp\_load::main();
maps\mp\_deur::main();

}
Share |
dutchman16
General Member
Since: May 8, 2006
Posts: 177
Last: Apr 29, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Tuesday, Apr. 21, 2009 05:07 pm
Still got the syntax error:
oke here is my error:


the scripts:
mp_modern-dawnville.gsc
Code:
main()
{

maps\mp\_load::main();
maps\mp\_deur::main();

//setExpFog(500, 3500, .5, 0.5, 0.45, 0);
ambientPlay("ambient_middleeast_ext");
//VisionSetNaked( "mp_vacant" );

game["allies"] = "sas";
game["axis"] = "marines";

game["attackers"] = "axis";
game["defenders"] = "allies";
game["allies_soldiertype"] = "woodland";
game["axis_soldiertype"] = "woodland";
setdvar( "r_specularcolorscale", "1" );

setdvar("r_glowbloomintensity0",".1");
setdvar("r_glowbloomintensity1",".1");
setdvar("r_glowskybleedintensity0",".1");
//setdvar("compassmaxrange","1500");
}


_deur.gsc
Code:
main();
{
doortriggers = getentarray("deur_open","targetname");
for(i=0;i< doortriggers.size;i++)
doortriggers[i] thread door_think();
}

door_think()
{
self.doormoving = false;
self.doorclosed = true;
self.doormodel = getent(self.target, "targetname");

while (1)
{
self waittill("trigger");
if(!self.doormoving)
self thread door_move();
}
}

door_move()
{
self.doormoving = true;
if(self.doorclosed)
{
self.doormodel moveto ((3077.5,819.5,0.0),1);
self.doormodel waittill("movetodone");
self.doorclosed = false;
}
else
{
self.doormodel moveto ((3077.5,819.5,0.0),1);
self.doormodel waittill("movetodone");
self.doorclosed = true;
}
self.doormoving = false;
} 





edited on Apr. 21, 2009 01:09 pm by dutchman16
Share |
codmp
General Member
Since: Feb 7, 2006
Posts: 905
Last: Aug 1, 2011
[view latest posts]
Level 7
Category: CoD4 Scripting
Posted: Tuesday, Apr. 21, 2009 05:43 pm
You're problem is in _deur.gsc.

Right at the top: main(); <-----

Remove the semi-colon from main(), as it is not suppose to be there.
Share |
dutchman16
General Member
Since: May 8, 2006
Posts: 177
Last: Apr 29, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Wednesday, Apr. 22, 2009 03:49 pm
Now I get a new error :(

[/url]
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»