#INCLUDED constant for @IF prepocessor

Feature requests for future versions of Hollywood can be voiced here
Post Reply
User avatar
lazi
Posts: 580
Joined: Thu Feb 24, 2011 11:08 pm

#INCLUDED constant for @IF prepocessor

Post by lazi »

Larger scripts are of course easier to handle in separate scripts which can be joined together by @INCLUDE at runtime.

I would like to test and write the individual parts separated from the main scripts which @includes them.
So the include script has to be complete with for example a waitevent loop.

If the @IF preprocessor could know if the script runs as a main script or as an included part then some parts could be automatically ignored if it is included, and could contain parts that needs to be run the "include" script individually.

Of course I can make a script with the waitevent loop and etc. and @INCLUDE the include script, but with something like an #included constant the include script could be self hosted.

What do you think?

User avatar
lazi
Posts: 580
Joined: Thu Feb 24, 2011 11:08 pm

Re: #INCLUDED constant for @IF prepocessor

Post by lazi »

Sorry this topic is created to wrong place. The correct would be Hollywood/Wishlist.

User avatar
airsoftsoftwair
Posts: 4606
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: #INCLUDED constant for @IF prepocessor

Post by airsoftsoftwair »

lazi wrote:
Tue Feb 02, 2021 11:51 am
If the @IF preprocessor could know if the script runs as a main script or as an included part then some parts could be automatically ignored if it is included, and could contain parts that needs to be run the "include" script individually.
Hmm, maybe I'm not understanding everything here but couldn't you just set a constant that signals whether there's is a main script or not? i.e.

Code: Select all

; this is the main script
Const #MAINSCRIPT = 1
@INCLUDE "subscript.hws"

Code: Select all

; this is the subscript
@IF #MAINSCRIPT
...
@ELSE
...
@ENDIF

Post Reply