Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,103 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Multiple Script Files #310948
02/17/10 20:16
02/17/10 20:16
Joined: Jan 2010
Posts: 9
A
AkorA Offline OP
Newbie
AkorA  Offline OP
Newbie
A

Joined: Jan 2010
Posts: 9
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.

Last edited by AkorA; 02/17/10 20:17.
Re: Multiple Script Files [Re: AkorA] #310951
02/17/10 20:35
02/17/10 20:35
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
#include "scriptname.c"

Re: Multiple Script Files [Re: Lukas] #310952
02/17/10 20:47
02/17/10 20:47
Joined: Jan 2010
Posts: 9
A
AkorA Offline OP
Newbie
AkorA  Offline OP
Newbie
A

Joined: Jan 2010
Posts: 9
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!

Re: Multiple Script Files [Re: AkorA] #310953
02/17/10 20:54
02/17/10 20:54
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
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;
}




Visit my site: www.masterq32.de
Re: Multiple Script Files [Re: AkorA] #310954
02/17/10 20:56
02/17/10 20:56
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
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.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1