Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Include Files Question

Author
Message
Kyle Katarn
17
Years of Service
User Offline
Joined: 7th Jun 2007
Location: Central Coast, Australia
Posted: 28th Jul 2007 12:42 Edited at: 28th Jul 2007 15:51
Hey, sorry if it seems like I'm pestering you guys.

A quick question on the Include Files on the IDE, how do I run files after another in a sequence and not all at once?

Do I run functions one after the other in the main source file? i.e.


Or do I run the first included file then the next file in the sequence, within the first included file? i.e.


Or is there another way? I havent tried this out yet (as I have not got enough source files to include), but it's good to know now instead of in a time when it could be a problem.

Thanks in advance.
~Kyle_Katarn
Kyle Katarn
17
Years of Service
User Offline
Joined: 7th Jun 2007
Location: Central Coast, Australia
Posted: 28th Jul 2007 12:43
... Sorry for the non code snippets. I did include them, but they didnt work for some reason.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Jul 2007 15:54
Fixed your code snippets for you - the word 'code' needs to be in lowercase.

Whenever you include an extra file, either using the IDE or the #INCLUDE command, that code is simply appended to the main code before being passed to the compiler.

When the code is run, it starts at the top of the main code and runs from there.

Kyle Katarn
17
Years of Service
User Offline
Joined: 7th Jun 2007
Location: Central Coast, Australia
Posted: 28th Jul 2007 20:45
Yes but how would I run them one after the other?
Say for example, I have a Source file for the Opening Credits and one for the Main Title Menu. How would I arrange it in a sequence which will display the opening title credits and then the opening menu?
Commander in Chief
18
Years of Service
User Offline
Joined: 15th Apr 2006
Location: Carbondale, PA, USA
Posted: 28th Jul 2007 20:54
I would put the Credits and Menu in a function, then just load the functions after each other.

Best.

---PlasmaArts---
www.plasmaarts.co.nr - www.plasmaarts-games.co.nr
Kyle Katarn
17
Years of Service
User Offline
Joined: 7th Jun 2007
Location: Central Coast, Australia
Posted: 28th Jul 2007 21:04 Edited at: 28th Jul 2007 21:05
Thats what I've been trying to do, I've got them as two seperate functions, but it skips the Opening Credits and Goes straight to the menu.

This might Help. (Its a bit long, but easy to read)

Main Source File


Opening Credits Source File


Source Code for Menu


Thanks in advance.
~Kyle Katarn
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 29th Jul 2007 10:59
^off topic, but you are using a float to refer to an image or at least point to an image (an integer's job). you should use integers for this because floats are only accurate to 7 digits, so that means 10 could become 9.99999, which when turned into an integer becomes 9

when you want to open a title then menu, do this:

REM Ini
sync on
`et cetera

REM Title
do_title()

REM Main Menu
do_menu()

then, in your title include file, have the do_title() function, and likewise for the menu include

have your do-sync-loop inside the do_title() function and inside the do_menu() function

another note, in your program, you aren't syncing after displaying each image in your image sequence
Kyle Katarn
17
Years of Service
User Offline
Joined: 7th Jun 2007
Location: Central Coast, Australia
Posted: 29th Jul 2007 12:05
Hey, I'm really sorry, but where have I used floats instead of integers? I've scanned the code and the only thing that comes close is when I'm defining the STEP value of my Alpha and AlphaOut Variables. Unless they are what you mean.

I'm sorry if I'm being annoying and probably a touch ignorant, but I'm trying, I really am. I appreciate the help you've all given me so far... I'm just having a dumb day I guess :p

Now, onto another problem. I've taken out the MainMenu() function to try and get the OpeningTitle() to work. When I try to run the program, the game crashes... well not so much crashes as freezes up.
Kyle Katarn
17
Years of Service
User Offline
Joined: 7th Jun 2007
Location: Central Coast, Australia
Posted: 30th Jul 2007 11:51
Holy crap! It worked! Thanks heaps guys. The OpeningTitle funtion works perfectly. But I have run into another problem.

Breaking out of loop. How do I do it? I've tried setting up a DO UNTIL value, but it appears that I cant work Booleans yet lol. I've tried setting a value within the loop to trigger an event uotside, but it doesnt register (because I guess it cant do anything outside the loop boundaries). I've even tried searching for a BREAK FROM LOOP type command but to no avail.

Thanks heaps in advance, and thanks heaps again to all those who've helped me as far.
vorconan
17
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 30th Jul 2007 12:38
Thats easy, it's just EXIT to break from a do loop.


Kyle Katarn
17
Years of Service
User Offline
Joined: 7th Jun 2007
Location: Central Coast, Australia
Posted: 30th Jul 2007 14:13
Thanks heaps mate.

It all works perfectly now. I've no further enquiries... except this one. Can I execute an Include file within another one?

Say I include a file with the intro to the game, can I execute the intro file function within the MainMenu() function? Or would I have to set a global variable to on which'll execute the function within the main source file?

Again, thanks a crapload.

Login to post a reply

Server time is: 2024-09-27 02:24:38
Your offset time is: 2024-09-27 02:24:38