Multiple Script Files

Posted By: AkorA

Multiple Script Files - 02/17/10 20:16

Hello!

I'm setting up a level with several models, and each model has its own script, and should be controlled individually.

What I've tried is something like this:

Code:
if(key_x == 1)
{
   include scriptname.c
}



or

Code:
include <scriptname.c>;

function scriptswitcher()
{
	if(varname == 1)
	{
		goto scriptname.c;
	}
}



Both of the above given examples didn't work.

There are like 8 models, each have ALOT! of functions assigned to keys, so they should be activated one at a time, so there is only 1 model controllable whenever its clicked (for example)

Thanks in advance.
Posted By: Lukas

Re: Multiple Script Files - 02/17/10 20:35

#include "scriptname.c"
Posted By: AkorA

Re: Multiple Script Files - 02/17/10 20:47

Originally Posted By: Lukas
#include "scriptname.c"


Ye i already knew that.

What I mean is:

I have 8 rollercoasters, each coaster is controlled the same way, and all are in one big level, and each coaster has its own script as they use the same keys.

Problem is, there should be 1 script running at a time, otherwise nothing moves!
Posted By: MasterQ32

Re: Multiple Script Files - 02/17/10 20:54

whats about a switch-statment??
Code:
int id = 0;
...
switch(id)
{
	case 0:
		//id = 0
		break;
	case 1:
		//id = 1
		break;
	default:
		//id is no one of the upper values
		break;
}


Posted By: Damocles_

Re: Multiple Script Files - 02/17/10 20:56

include is a precompiler directive
(meaning, it gets copies into the code, before the
compiler compiles the game-code, thus you cant import scripts at runtime of the program)

You need to solve your rollercoster problem in the program.

For example letting all costers wait in a while(my.notactive){wait(1);} loop.
© 2024 lite-C Forums