Hey there, welcome to the forums!
What do you mean about this calling functions mod? I think you can all any j/s function from any file in the directory by default. O.o
Sorry for my unclear wording. I’m running off less then 5 hours of sleep. What I meant was I programmed (or hacked, cause of how sloppy it likely is) functionality for a global Scene file, eg: “choicescript_global.txt”, so you can reuse common ChoiceScript functions across different chapters/scenes without having to copy and paste them into every file.
So I could call a *label subroutine in scene 1 whilst the game has scene 2 displayed?
That WOULD be VERY useful :0
Sweet, if you wouldn’t mind sharing I’d love to plug it into my game tonight, I have a perfect example of a routine I need to copy/paste so would be happy to help you test it!
The only problem I foresee is if people have a label in the global scene that matches the current scene, otherwise that does seem like a pretty solid method (without looking at the code).
Hello and welcome. I to would like to see if that would work in mine.
Sorry about the lateness of my reply. I have been rather ill lately and haven’t been able to drag myself to an internet source.
That would be a problem, yes. I didn’t really take the time to proof the system against such things, as I felt it beyond my current scope, and for my particular needs, unnecessary.
As I’m really tired and drugged up on painkillers, I tossed the entire mod into a zip file. It’s a copy of the ChoiceScript zip with the examples, and of course the modified code. When I’m feeling a bit better, I’ll take a second look at the code and try to make it more modular.
Off the top of my head, if you want to peek at the code, I made the following changes/additions:
-Added a line to the end of the “mygame.js” file
-In the file “scene.js”, I modified the function loadScene()
-Also in the “scene.js” file, I added the function loadGlobalScene(), which is located directly below the normal loadScene() function
-Added the file “choicescript_global.txt” to the “scenes” folder
-Modified the file “startup.txt” in the “scenes” folder to test/showcase the global scene usage
-Also modified the file “animal.txt” in the “scenes” folder to prove that it does actually work in all scenes
Also, I feel I should note that using global ChoiceScript calls within the stats screen is probably a bad idea, though I’ve not tried to do so. I’ll probably add a check later to see if the current scene being loaded is the stats screen and make it not load the global scene info.
Let me know how it works for you, and sorry about the lazy upload. As I said, when I’m feeling better, I’ll spiff it up and make it look pretty. Have fun!
Hey no problem man, thanks for thanks for the share! I’ll have a tinker later.
Rest easy and get better soon man
Sorry you are sick hope you feel better soon, great work so far.
Works a treat, and it’s fairly easy to implement too, bravo man. This is great. The only thing you could probably do is combine the loadscene and loadglobalscene functions but in all honesty it makes it easier to bugtest and later remove the mod if they’re seperated. I can’t fault it, nor can I express just how useful this will be.
Welcome, @stainedofmind, hope you’re feeling better soon, and thanks for the contribution. I’ve downloaded it, and will try it out after work this evening. I’ve a few CS subs that I’d love to have global access to, and if this works, I’ll have a lot more. B-)
@stainedofmind Impressive potential, this. Welcome to the forum, and thanks for sharing. I’ve had to abandon some pretty decent ideas for lack of the functionality to implement them properly (i.e. without excessively bloating each & every scene.txt file, anyway) so I have very high hopes for this.
Get well soon! Also, if I may suggest, perhaps when you’ve recovered enough to tweak this some more as planned, it would probably be a good idea to start a new “Game Development” thread exclusively for this, just so it’s easier for others to find in future. It’s too useful to see it drift away and be lost among the dross as a “General” topic.
This is a wonderful idea! I detest the current necessity of having to recopy and paste the same commonly used subroutines into multiple text files. It’s easily one of my biggest pet peeves with Choicescript. Among other things, this makes for a great place to put inventory functions.
I’ve been using it for the best part of the day, absolutely no problems. I’d consider pitching this to CoG to be included in the official package.
Only thing is the variable inside mygame.js - You don’t seem to require it, unless it’s defined somewhere else. Either way, it works fine without my adding of it.
First off all, thanks for all the greets and “get betters”. Also, I’m glad my mod is working so well thus far. I think I’ll open up a new thread for the mod in a few hours when I’m on my lunch break. Til then…
I hope it works well for you. From the sounds of it, it’s working well for everyone else.
To reiterate what I said above, I’m definitely going to open a new thread when I get a moment. I had the same doubts about ChoiceScript when I first glanced through it, which is why I created the mod to begin with, so hopefully it’ll help you out!
I had the same thoughts for using it as a dumping ground for an inventory system as well!