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

Members Online

»
0 Active | 68 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 subscribe
Author Topic: Scripting Array Error
Snipethis
General Member
Since: May 31, 2007
Posts: 59
Last: Apr 4, 2009
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Sunday, Mar. 8, 2009 04:49 am
Anyone help please looked at following script till my Eyes Cross Pretty sure its just a Brain Fart at least i hope it is


Code:
  main() 


 maps\mp\_load::main();
 thread moveslider(); 
{
moveslider()
   {
     hoist = getentArray("slide","targetname");
     if(isdefined(hoist))
    for(i=0;i< hoist.size;i++)

  } 
     trig = getent ("slide_triger", "targetname"); 
   
   while(1)
      { 
      hoist movey(-199,0.05);
      wait(20);
      trig waittill("trigger");
      lamp movey(199,0.05);
      lamp waittill("movedone");
      wait (5);
      }
}


Am getting following Error when i try to compile:

Error
Script Compile Error
Bad Syntax
{(See console for details)


im sure we have all seen that.
looked and nothing is in the Consolel.


If someone find's the obvious please post it for me
and any sugestions if this is going to work.

Thanks

{S-K}SnipeThis
Share |
Zestycookie
General Member
Since: Dec 31, 2006
Posts: 148
Last: Oct 19, 2009
[view latest posts]
Level 4
Category: CoD4 Scripting
Posted: Sunday, Mar. 8, 2009 05:01 am
I'm not much of a scripter but I do have some experience in programming, something seems odd with your "for loop". It doesn't do anything, it just adds 1 to "i" until it reaches the size of your array. Is it suppose to do something?
Share |
Snipethis
General Member
Since: May 31, 2007
Posts: 59
Last: Apr 4, 2009
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Sunday, Mar. 8, 2009 05:23 am
Wow ok i really messed up some reason my editor didnt updat my file so it wasent even right Script Here is the Correct script im trying to debug.

Code:
 main() 


 maps\mp\_load::main();
 thread moveslider(); 
{
moveslider()
   {
     hoist = getentArray("slide","targetname");
     if(isdefined(hoist))
	 for(i=0;i< hoist.size;i++)
    } 
     trig = getent ("slide_triger", "targetname"); 
   
   while(1)
      { 
	  trig waittill("trigger");
      hoist movey(199,10);
	  hoist waittill("movedone");
      wait(5);
      trig waittill("trigger");
      hoist movey(-199,10);
      hoist waittill("movedone");
      wait (5);
      }
} 


Zestycookie i am still learning with the Scripting its verry possible i left something out.

{S-K)SnipeThis

edited on Mar. 8, 2009 12:26 am by Snipethis
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Sunday, Mar. 8, 2009 05:31 am
your whole script is messed up. brackets in wrong places, function definitions inside other functions, missing for-body, maybe logical problem with the trigger entity* and bad usage of an entity array.

i suggest you redo the whole script yourself or explain what you try to do*, so that anybody else offers working code.

*Do you really want to have a single trigger for many script_brushes?
Share |
_INSANE_
General Member
Since: Nov 7, 2008
Posts: 352
Last: Jul 10, 2011
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Sunday, Mar. 8, 2009 05:36 am
This would be more of what it should look like, Snipethis.
You had missing brackets, reversed brackets, a for loop in which i saw no use for. I did see the getentArray ..but still.. I have no idea what you are trying to do.

Code:
main()
{
	maps\mp\_load::main();
	thread moveslider(); 
}

moveslider()
{
	hoist = getent("slide","targetname");
	trig = getent("slide_trigger", "targetname"); 

	while(1)
	{
		trig waittill("trigger");
		hoist movey(199,10);
		hoist waittill("movedone");
		wait(5);
		trig waittill("trigger");
		hoist movey(-199,10);
		hoist waittill("movedone");
		wait (5);
	}
}
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Sunday, Mar. 8, 2009 05:40 am
Quote:
but still.. I have no idea what you are trying to do

me neither, so i tried to keep the original semantics as good as possible (but don't really like it):
Code:
main()
{
	maps\mp\_load::main();
	thread moveslider_thread();
}

moveslider_thread()
{
	hoist = getentArray("slide","targetname");
	if(isdefined(hoist))
	{
		for(i=0;i< hoist.size;i++)
		{
			hoist[i] thread moveslider();
		}
	}
}

moveslider()
{
	trig = getent ("slide_triger", "targetname");
	
	while(1)
	{ 
		trig waittill("trigger");
		self movey(199,10);
		self waittill("movedone");
		wait(5);
		
		trig waittill("trigger");
		self movey(-199,10);
		self waittill("movedone");
		wait (5);
	}
}


Quote:
i am still learning with the Scripting

you better say you started learning
Share |
Snipethis
General Member
Since: May 31, 2007
Posts: 59
Last: Apr 4, 2009
[view latest posts]
Level 3
Category: CoD4 Scripting
Posted: Sunday, Mar. 8, 2009 05:56 am
ok Sorry what i am Trying to do is

Have this Item wich i made in Radiant of a Overhead Crain , then made a origin brush selected all and made it into a:

- script brushmodel -

with targetname, slider1
placed said item into a map conected it to a Trigger-Multiple - targetname, slider_triger - target, slider1

So all i am trying to do is move the Crain cariage back and forth on the "Y" axis.

everything i have read says if have more than one brush your moving it must be in a Array format.

As i said i am still learning or trying to

Thanks again

{S-K}SnipeThis

Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Sunday, Mar. 8, 2009 06:34 am
Quote:
more than one brush your moving it must be in a Array format

that's not right, you have to use entity arrays if you name (targetname) more than one entity, e.g. script_brushmodel, the same way.
Share |
Restricted Access Topic is Locked 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

»