just wanna ask some basic technical stuffs,
can I create a single file that only filled with logics and not included in the *scene_list?
let’s say I have three files, two of them are displaying narratives and choices, but they will do some “gosub_scene” to the third file that only has logics to do some calculations and another “invisible” stuffs.
it does run on IDE, but will it run when it becomes a released game?
the file is not included in the scene_list because it has no part of the story, it only serves as logic library to make things neat and trackable.
Probably not. When you compile a game unless it has changed, it only loads and includes files contained in the scene list. I’m not sure why it would be a problem to put it in the scene list? The average player won’t look at any of the coding.
To add to what @Jacic said, even if you can/do call subroutines from an unlisted file, anyone who code-dives will be able to see the file name when you *goto_scene even if it’s just for a quick calculation. Ultimately, anything in the code is accessible. But I wouldn’t stress over it.
@Jacic@Kuwa
nope, it’s not about hiding my codes from people.
it’s about reusability issue, by putting logic in one dedicated file, I can re-access them many times from any chapters of the story and I only have to write once.
or maybe I don’t quite understand how *scene_list works
let’s say I have a *scene_list like this:
chapter_1
logic
chapter_2
chapter_3
my concern on putting logic file in the scene list is:
it’s possible that I mistakenly let program to access logic file improperly,
I want logic file to be accessed via *gosub_scene and not accessed after *finish of the previous file
on above example, logic file will be accessed right after I finished chapter_1, which is not my intention and might break the game somehow.
please let me know if my understanding of scene list is wrong and how would you place a logic file on the scene_list
or to be more precise, how would you treat codes that reusable many times on all chapters throughout gameplay ( example: inventory, battle encounter, stats upgrade, equipment management, etc )
Ohh, gotcha! Thanks for clearing up the misunderstanding. So, one way to accomplish your goal is to write your logic code into subroutines, then copy-paste those into each file you need them accessed. Another potential way (I think, though I haven’t tried) is to write those subroutines into your startup.txt file and call them up from there.
You could put the logic file as first or last one on the list, then you’d only need to remember to goto_scene from the startup (instead of finish) if it’s the first one, or use the proper ending command if it’s the last one. If I understood you correctly.
(The order of the files in the list matter only if you move from one to another with the *finish command. If you use *goto_scene instead, it doesn’t matter at all.)
Agree. The order of the startup list doesnt matter at all if you use goto commands instead of *finish. You can access it as many times as you need from as many different scene files as you want using a *Goto/gosub scene command.
I’ve got one project that needs to reroll, set and record various variables at each round and revisits files containing those command from different files without issues.
I’ve been doing something similar in my own WIP. However, my solution may seem a lot of work compared to the idea you have.
Simply put, I’ve just copy-pasted each reusable scene at the bottom of each file, underneath the *finish, so that they are never accessed without a specific *goto.
This way, you only have to write out the scene once, but you eliminate the headache of the logic file you are trying to create. All you’ll have to do for each subsequent file is paste them in. It seems a lot of work, but to be honest, it doesn’t take that long to copy-paste once you have the actual scenes you want.
I usually just keep all my non-chapter files listed beneath my ‘ending’ file (where I keep my endings), which doesn’t contain any *finish commands.
So those files only gets accessed with *gosub_scene, whenever I need them, even though I use *finish between chapters.
They are all at the bottom of the *scene_list and have the *finish command on the first line to ensure that the code is not executed directly. Additionally they are after the endings, just like @The_Lady_Luck explained.
As a programmer, I am a fan of code reuse (mainly because if we have to execute the same code from several scenes, when it has to be changed we only have to do it once, minimizing the effort and the probability of errors).
This.
This is the only reason to include the file names on the scene list at all: so your game knows where to go after a *finish
If it’s just some logic you want to use from time to time or a scene that can be accessed from one of many different chapters, feel free to use a different file not on the list. For example: in my Werewolves 2 game, all the sex scenes are in a different, non declared file. Why? No particular reason other than to group content. The system is as flexible as you need it to be.
I like to list everything anyway, just because I personally like when that is done, when I beta-test. It’s nice to have that list of files available, when you code-dive.
It also helps as a check-list, to make sure I’ve uploaded every necessary file for each WIP build, since I have multiple files in my CSIDE projects that is notes for my self, and random snippets and scenes for later than the build contains.
Ah Modularity! The balm of structured programming!
B-but, isn’t this the way CS_lib scenes already work with choicescript? Though I guess the author should allow implicit control flow to use it without declaring in the scenes list. Right?
Or did I mess up and all you have to do is paste it on your myscenes folder?
Yes, this is how cslib works. Though whilst implicit control flow is required that has nothing to do with *finish or *scene_list, or anything being discussed in this thread.
Some more thoughts on scene_list, I do believe it’s often used (and could be useful) to detect what scenes are part of a game. For example, a common request in CSIDE is to support having normal note-like .txt files in the project folder. This isn’t possible at the moment because CSIDE will try to compile every .txt file in your folder, and will fail on non choicescript files. I had toyed with the idea of requiring a scene to be in the scene_list in order to be included in compilation, but as we can see here, that has it’s own set of downsides.
I think in general people don’t rely on the scene_list much, which is why I haven’t changed CSIDE’s behaviour. I’m not sure what CoG actually intend.