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

Members Online

»
0 Active | 9 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: why doesn't this work?
cybershot
General Member
Since: Dec 29, 2005
Posts: 944
Last: Mar 4, 2018
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Sunday, Nov. 18, 2007 04:17 am
I wanted to see if i could get this script to print to the screen but i can't. the code doesn't crash, but nothing happens when i spawn. Does it need a trigger, or is there a way to get it working without one in a map

Main()
{
for(x=0;x<5;x++)
iprintlnbold(x);
}

i called this testprogram.gsc then in the main .gsc i put maps/mp/testprogram::main();
Share |
SQUISHY44
General Member
Since: Apr 16, 2007
Posts: 213
Last: Jul 20, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Nov. 18, 2007 04:42 am
try using i instead of x
Share |
cybershot
General Member
Since: Dec 29, 2005
Posts: 944
Last: Mar 4, 2018
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Sunday, Nov. 18, 2007 04:43 am
i will try that. but whats the difference? why do they almost always use i for loops?
Share |
Filbert
General Member
Since: Jan 24, 2005
Posts: 869
Last: Oct 21, 2009
[view latest posts]
Level 7
MODSCON
Category: CoD2 Scripting
Posted: Sunday, Nov. 18, 2007 05:19 am
What you call your variable shouldn't matter.
Share |
marcp22
General Member
Since: May 14, 2005
Posts: 76
Last: Jul 15, 2008
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Sunday, Nov. 18, 2007 05:42 am
why dont you try making both "Main()" in your testprogam.gsc file and "main()" in you map gsc the same [tongue]
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 Scripting
Posted: Sunday, Nov. 18, 2007 11:08 am
Actually.... it probably does work.. :p

however, because the script starts as soon as the map is loaded (which is before you join) you never get to see it.

Try it with a trigger, so you know when it should run.

You also can try it with a trigger waittill("trigger", user);
and then use 'user' for the iprintln, so only the player triggering can see it..
Share |
cybershot
General Member
Since: Dec 29, 2005
Posts: 944
Last: Mar 4, 2018
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Sunday, Nov. 18, 2007 07:11 pm
i didn't see it working. i checked the console a long ways up to see if it printed and didn't see it. i tried your suggestion to add the waittill("trigger", user); but i couldn't get it working. to do it that way you would need to add the getentarray("test"; "targetname"); right? so then i just kept getting unitialized variables on user.. what i wanted to try to get this little program to do is just iprintlnbold one message when the player contacts the trigger. i got it printing a whole bunch on one of my other attemps do to the loop, but i don't want it spamed..
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 Scripting
Posted: Sunday, Nov. 18, 2007 08:38 pm
Make a single trigger targetnamed 'test'.

Main()
{
trigger = getent("targetname";"test");
trigger waittill("trigger";user);
for(x=0;x<5;x++)
{
user iprintlnbold(x);
}
}

This should work.
Share |
cybershot
General Member
Since: Dec 29, 2005
Posts: 944
Last: Mar 4, 2018
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Sunday, Nov. 18, 2007 09:02 pm
i kept getting this error. i can't find the bad syntax

bad syntax: (file 'maps/mp/testprogram.gsc', line 3)
trigger = getent("targetname"; "test");
Share |
The_Caretaker
General Member
Since: Jun 8, 2004
Posts: 11625
Last: Jul 7, 2009
[view latest posts]
Level 10
Category: CoD2 Scripting
Posted: Sunday, Nov. 18, 2007 11:24 pm
do'h.

trigger = getent("targetname";"test");

should be

trigger = getent("test";"targetname");
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 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

»