Clarification Needed....

Advanced game related topics
GBeebe
Enthusiast
Enthusiast
Posts: 263
Joined: Sat Oct 09, 2004 6:52 pm
Location: Franklin, PA - USA
Contact:

Clarification Needed....

Post 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.
TheBeck
User
User
Posts: 39
Joined: Mon May 12, 2003 6:04 am
Location: the far west
Contact:

Re: Clarification Needed....

Post 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.
Nathan Beckstrand -- XPSP2, AMD Athlon XP 3000+, GF2 GTS, 512MB RAM
GBeebe
Enthusiast
Enthusiast
Posts: 263
Joined: Sat Oct 09, 2004 6:52 pm
Location: Franklin, PA - USA
Contact:

Procedures...

Post by GBeebe »

Can I have Procedures in another file and call them just like your example, as long as that file is Included?
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

yes
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply