Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Quad, 1 invisible), 721 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 5 1 2 3 4 5
Re: i've done everything i can think of [Re: MrGuest] #276219
07/03/09 21:00
07/03/09 21:00
Joined: Jun 2009
Posts: 148
G
gamingfan101 Offline OP
Member
gamingfan101  Offline OP
Member
G

Joined: Jun 2009
Posts: 148
basically what im doing with my scripts is i have a main menu script, with three buttons on it. When i click on the credits button for example, it takes me to the credits script. So basically i have four scripts.
1) main menu
2) credits
3) main game
4) endurance (just another game type)


Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
Re: i've done everything i can think of [Re: gamingfan101] #276222
07/03/09 21:10
07/03/09 21:10
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
just include all the script (though i don't know why you're seperating them all into seperate files?)

Code:
#include "main_menu.c"
#include "credits.c"
#include "main_game.c"
#include "endurance.c"

//then show your panel

PANEL* mainbutton1 =
{
  bmap = gonorm;
  pos_x = 10;
  pos_y = 100;
  button (0, 0, goclicked, gonorm, goover, robotswitch, NULL, NULL);
  flags = OVERLAY | SHOW;
}

then in each file have an init function

so //credits.c

function credits_init(){
  //do whatever you want done from here
  //probably start with hiding the panel?
  reset(mainbutton1, SHOW);
}

and change the name of your functions and structs so you'll be able to easily identify them later

hope this helps

Re: i've done everything i can think of [Re: MrGuest] #276225
07/03/09 21:18
07/03/09 21:18
Joined: Jun 2009
Posts: 148
G
gamingfan101 Offline OP
Member
gamingfan101  Offline OP
Member
G

Joined: Jun 2009
Posts: 148
ok, i almost have it. The only thing is that i want it to completely switch scripts, and im not sure how to call that in the function. There are no panels i want hidden, there are just 2 completely different c. scripts. (and i wanted the scripts seperated just for organization, that way if something in my credits messes up, ill go to that script, and so on.)


Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
Re: i've done everything i can think of [Re: gamingfan101] #276242
07/04/09 00:16
07/04/09 00:16
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
you can't switch scripts. The script that starts is the one with the "main" function in. When you include other scripts the engine knows what's in them, so you can call functions and use resources in them, just by specifying their name, and the engine will automatically know where to find them.

Re: i've done everything i can think of [Re: DJBMASTER] #276244
07/04/09 00:38
07/04/09 00:38
Joined: Jun 2009
Posts: 148
G
gamingfan101 Offline OP
Member
gamingfan101  Offline OP
Member
G

Joined: Jun 2009
Posts: 148
ok, in that case, i would have to do everything in one script, would i use a goto function? when this button is pressed it goes to that part of the script?


Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
Re: i've done everything i can think of [Re: gamingfan101] #276247
07/04/09 00:54
07/04/09 00:54
Joined: Jun 2009
Posts: 148
G
gamingfan101 Offline OP
Member
gamingfan101  Offline OP
Member
G

Joined: Jun 2009
Posts: 148
ok, im really am sorry, i can tell im beginning to get annoying, so heres what i want to do, flat out. I have two scripts so far. "mainmenu.c" and "credits.c" when i click on this button below from the main menu, i want it to run the credits. Now considering i cant switch scripts, what would be the best way to do this? Thanks

PANEL* creditbutton3 =
{
bmap = goclicked;
pos_x = 10;
pos_y = 300;
button(0, 0, goclicked, gonorm, goover, NULL, NULL, NULL);
flags = OVERLAY | SHOW;
}


Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
Re: i've done everything i can think of [Re: gamingfan101] #276251
07/04/09 01:44
07/04/09 01:44
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
In the button definition, just use the name of the function in the "credits.c" as if it were in the same script. Seperating scripts doesn't do anything apart from help you organise your code. They all get merged together when the game is ran as if it was all one big script.

So if in your "credits.c" script you have a function called StartCredits(), then just use "StartCredits", in your button definition and the engine will automatically find the function in the other script and run it.

Re: i've done everything i can think of [Re: DJBMASTER] #276253
07/04/09 02:04
07/04/09 02:04
Joined: Jun 2009
Posts: 148
G
gamingfan101 Offline OP
Member
gamingfan101  Offline OP
Member
G

Joined: Jun 2009
Posts: 148
ok, now there seems to be another problem, when i #include <credits.c> it tries to combine both scripts, so they both run at the same time, but the buttons dont work. ok heres both scripts, can you please tell me what im doing wrong? Probably a lot. Hopefully this will resolve the problems. I apologize for all of this.

menu:
///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <boxiecredits.c>

/////////////////////////////////////////////CURSOR////////////////////////////
BMAP* my_cursor = "gold_cursor.bmp";

/////////////////////////////////////////////MENU DEFINITIONS//////////////////
BMAP* headpic = "boxieheader.bmp";
BMAP* gonorm = "gonorm.bmp";
BMAP* goover = "goover.bmp";
BMAP* goclicked = "goclicked.bmp";
STRING* gameheader = "BOXIE";
STRING* main_str = "MAIN GAME";
STRING* endu_str = "ENDURANCE MODE";
STRING* cred_str = "CREDITS";
STRING* exit_str = "EXIT";
FONT* header_font = "ariel#80b";
FONT* options_font = "Bauhaus 93#40b";

//////////////////////////////////////////////PANELS//////////////////////////////

PANEL* menupicture =
{
bmap = headpic;
pos_x = 425;
pos_y = 230;
layer = 1;
flags = OVERLAY | SHOW;
}

PANEL* mainbutton1 =
{
bmap = gonorm;
pos_x = 10;
pos_y = 100;
button (0, 0, goclicked, gonorm, goover, NULL, NULL, NULL);
flags = OVERLAY | SHOW;
}

PANEL* endubutton2 =
{
bmap = goover;
pos_x = 10;
pos_y = 200;
button(0, 0, goclicked, gonorm, goover, NULL, NULL, NULL);
flags = OVERLAY | SHOW;
}

PANEL* creditbutton3 =
{
bmap = goclicked;
pos_x = 10;
pos_y = 300;
button(0, 0, goclicked, gonorm, goover, ???????, NULL, NULL);
flags = OVERLAY | SHOW;
}

PANEL* exitbutton4 =
{
bmap = gonorm;
pos_x = 10;
pos_y = 400;
button(0, 0, goclicked, gonorm, goover, quit_program, NULL, NULL);
flags = OVERLAY | SHOW;
}

/////////////////////////////////////////TEXTS///////////////////////////////
TEXT* headertxt =
{
pos_x = 300;
pos_y = 20;
string = gameheader;
font = header_font;
flags = SHOW;
}

TEXT* maintxt =
{
pos_x = 75;
pos_y = 110;
string = main_str;
font = options_font;
flags = SHOW;
}

TEXT* endurancetxt =
{
pos_x = 75;
pos_y = 210;
string = endu_str;
font = options_font;
flags = SHOW;
}

TEXT* creditstxt =
{
pos_x = 75;
pos_y = 310;
string = cred_str;
font = options_font;
flags = SHOW;
}

TEXT* exittxt =
{
pos_x = 75;
pos_y = 410;
string = exit_str;
font = options_font;
flags = SHOW;
}


/////////////////////////////////////////FUNCTIONS///////////////////////////

function main()
{
video_mode = 7;
mouse_map = my_cursor;
mouse_mode = 4;
media_loop("mainmusic.wav",NULL,100);
}

function quit_program()
{
while (key_any) { wait (1); }
sys_exit(NULL);
}




credits:
///////////////////////////////
#include <acknex.h>
#include <default.c>

//////////////////////////////////////////////CURSOR///////////////
BMAP* cursor = "gold_cursor.bmp";

////////////////////////////////////////////////////////////SOUNDS/////////////////////
SOUND* credits_snd = "credits.wav";

/////////////////////////////////////////////BMAP DEFINITIONS////////////////////////////
BMAP* creditbground = "creditsbground.bmp";
BMAP* creditbutt = "creditback.bmp";

/////////////////////////////////////////////PANELS//////////////////////////////////
PANEL* credbground =
{
bmap = creditbground;
pos_x = 20;
pos_y = 10;
layer = 1;
flags = OVERLAY | SHOW;
}

////////////////////////////////////////////////STRING/FONT DEFINITIONS////////////////////
STRING* backbutton = "BACK TO MAIN MENU";
STRING* opening = "AN ATARI TODAY PRODUCTION";
STRING* boxieopen = "BOXIE";
STRING* owner = "OWNER: CHARLES BAILEY";
STRING* character = "CHARACTER DESIGN: CHARLES BAILEY";
STRING* level = "LEVEL DESIGNER: CHARLES BAILEY";
STRING* object = "PROGRAMMER: CHARLES BAILEY";
STRING* instru = "HIT 'BACK TO MAIN MENU' TO RETURN";
FONT* header_font = "ariel#20b";
FONT* options_font = "Bauhaus 93#40b"; //used for both main menu options and the credits opener
FONT* credits_font = "Bauhaus 93#30b"; //used for all other texts in the credits
FONT* boxiestarter_font = "ariel#100b"; //used for the boxieopener only

//////////////////////////////////////////////////////TEXTS////////////////////////////
TEXT* opening_txt =
{
pos_x = 90;
pos_y = 175;
string = opening;
font = options_font;
layer = 3;
}

TEXT* boxieopener_txt =
{
pos_x = 200;
pos_y = 250;
string = boxieopen;
font = boxiestarter_font;
layer = 3;
}

TEXT* owner_txt =
{
pos_x = 100;
pos_y = 300;
string = owner;
font = credits_font;
layer = 3;
}

TEXT* character_txt =
{
pos_x = 250;
pos_y = 150;
string = character;
font = credits_font;
layer = 3;
}

TEXT* level_txt =
{
pos_x = 275;
pos_y = 400;
string = level;
font = credits_font;
layer = 3;
}

TEXT* object_txt =
{
pos_x = 220;
pos_y = 50;
string = object;
font = credits_font;
layer = 3;
}

TEXT* instructions_txt =
{
pos_x = 90;
pos_y = 175;
string = instru;
font = credits_font;
layer = 3;
}
////////////////////////////////////////////////////BUTTONS////////////////////////////////
TEXT* back =
{
pos_x = 275;
pos_y = 20;
string = backbutton;
font = header_font;
layer = 2;
flags = SHOW;
}

PANEL* backbutt =
{
bmap = creditbutt;
pos_x = 275;
pos_y = 10;
button(0, 0, creditbutt, creditbutt, creditbutt, quit_program, NULL, NULL);
layer = 3;
flags = OVERLAY | SHOW;
}


////////////////////////////////////////////////FUNCTIONS////////////////////////
function main()
{
video_mode = 7;
mouse_map = cursor;
mouse_mode = 4;
snd_play(credits_snd, 100, 0);
media_play("mainmusic.wav",NULL,90);
wait(-5);
opening_txt.flags = SHOW;
wait(-4);
boxieopener_txt.flags = SHOW;
wait(-4);
opening_txt.flags = 0;
boxieopener_txt.flags = 0;
wait(-2);
screen_color.red = 135;
screen_color.green = 62;
screen_color.blue = 36;
owner_txt.flags = SHOW;
wait(-4);
owner_txt.flags = 0;
screen_color.red = 0;
screen_color.green = 62;
screen_color.blue = 36;
character_txt.flags = SHOW;
wait(-4);
character_txt.flags = 0;
screen_color.blue = 0;
screen_color.green = 88;
screen_color.red = 88;
level_txt.flags = SHOW;
wait(-4);
level_txt.flags = 0;
screen_color.red = 177;
screen_color.green = 239;
screen_color.blue = 135;
object_txt.flags = SHOW;
wait(-4);
object_txt.flags = 0;
screen_color.blue = 0;
screen_color.red = 0;
screen_color.green = 0;
instructions_txt.flags = SHOW;
}

function quit_program()
{
while (key_any) { wait (1); }
sys_exit(NULL);
}


Thanks a lot!



Last edited by gamingfan101; 07/04/09 02:06.

Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
Re: i've done everything i can think of [Re: gamingfan101] #276262
07/04/09 03:56
07/04/09 03:56
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
PANEL* creditbutton3 =
{
bmap = goclicked;
pos_x = 10;
pos_y = 300;
button(0, 0, goclicked, gonorm, goover, ???????, NULL, NULL);
flags = OVERLAY | SHOW;
}

That will give you errors, replace '???????' with NULL or a different function.

Apart from that i can't see much wrong with it. Which button is causing the problem?

Re: i've done everything i can think of [Re: DJBMASTER] #276266
07/04/09 04:12
07/04/09 04:12
Joined: Jun 2009
Posts: 148
G
gamingfan101 Offline OP
Member
gamingfan101  Offline OP
Member
G

Joined: Jun 2009
Posts: 148
no, i was trying to ask what should go in the ????? place. Im sorry, i didnt make that very clear. And the button works ok, the problem is the function. I want the credit script to run when i press the button in the main menu script. But since i cant switch scripts i need to know how to set up the functions from the scripts above. Thanks you


Sorry, im new. I have a tendency to ask really simple questions, so please be patient.
Page 3 of 5 1 2 3 4 5

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