Page 1 of 1

Clarification Needed....

Posted: Wed Oct 13, 2004 6:00 am
by GBeebe
Ok, I think I have this right.

In the main.pb file of my game I have

Code: Select all

IncludeFile "Title.pb" 
(it has code to display the title screen).
The title screen will appear when that command is reached.

At the bottom of my main.pb I have

Code: Select all

End

IncludeFile "Keys.pb"
(it handles keyboard events).
During the game I can Gosub linenames that are inside Keys.pb.

So far I can replace them with XIncludeFile and it works the same way.
In the help file it says:
XIncludeFile is exactly the same except it avoids having to include the same file many times.

Example :

XIncludeFile "Sources\myfile.pb" ; This will be inserted.
XIncludeFile "Sources\myfile.pb" ; This will be ignored along with all subsequent calls..
So my questions are:

1) If I want to be able to go back to the title screen in mid-game, I should be using IncludeFile, right? The compiler just kinda takes the code from title.pb and inserts it where the IncludeFile statements are.

2) If #1 is correct, does having multiple IncludeFile statements for the same file increase the EXE file size? Would the file size look as if it has multiple instances of title.pb for every time the IncludeFile for it appears?

Thanks guys, you've already been a great help.

Re: Clarification Needed....

Posted: Wed Oct 13, 2004 6:27 am
by TheBeck
GBeebe wrote: 2) If #1 is correct, does having multiple IncludeFile statements for the same file increase the EXE file size? Would the file size look as if it has multiple instances of title.pb for every time the IncludeFile for it appears?

Thanks guys, you've already been a great help.
Yeah, I am pretty sure that's how it works.

Do this:

Code: Select all

Procedure ShowTitle()
IncludeFile "Title.pb"
EndProcedure
Now just put...

Code: Select all

ShowTitle()
Whenever you want to show the title.

Procedures...

Posted: Wed Oct 13, 2004 6:49 am
by GBeebe
Can I have Procedures in another file and call them just like your example, as long as that file is Included?

Posted: Wed Oct 13, 2004 8:12 am
by blueznl
yes