123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|414|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> JSE -> JSE vs Source Files

Wed, 16 Jul 2025, 12:49
realtime
Does jse support multiple files? I want to put some of my code into a separate file that I want to use later

-=-=-
BASIK
Wed, 16 Jul 2025, 12:49
Jayenkai
Nope, 'fraid not. Everything goes in one big box!

-=-=-
''Load, Next List!''
Wed, 16 Jul 2025, 15:04
Dan
It is fairly easy to export the entire JSE library and to extract the single game from there.
Thu, 17 Jul 2025, 00:40
Pixel_Outlaw
Global variables would probably stomp each other too between files.
You might be able to do package/module scope though with a prefix on the globals...
The idea would be that you generate new globals with a different name and the user's variables get silently prefixed for that module.

So if you have a package foo and a package bar, you get foo:a and bar:a.
If the user just had "a" it first gets looked up in the package it's in.
Otherwise they can explicitly use prefixes from other packages.
Thu, 17 Jul 2025, 02:59
Jayenkai
Not the reason. I couldn't give a rats arse about the fact that everything's a global.
The reason is..

1. JSE was designed to be easily portable to forums, hence why everything, from code to graphics to sound, is all code based. So it's all inside one script, and that can be copy+pasted directly to a forum post.

2. If you use 2 scripts, just two.. You get this..

-=-=-=-

Main.jse


Second.jse


To use this, save Main.jse as Main.jse and then Second.jse as Second.jse

-=-=-=-

And then the end user has to go through their own stuff, make sure nothing's already Main and Second, rename if necessary, then copy two lots of code over, ensure they're the right names, and THEN finally get around to clicking the run button.

That's NOT the ease of use that JSE was designed for, and that's exactly why this doesn't happen.

It was Pakz trying to show us a "quick" example in Godot's Online version, where we had to download the code and the image, package it into a zip with the right filenames, then upload the zip, then hit run, which inspired me to make JSE function like this.


...Anyway...

I left this bobbling about in my head overnight, and the concept of "Folding" seemed somewhat appropriate to this methodology. Now, whether that copy+pastes well, that's a whole other matter. (See also, syntax highlighting)
Maybe I'll have to interject when the browser receives a "Copy", and do my own thing, and perhaps folded code could have a symbol on the left of the lines or something..?
Could be doable, I think

-=-=-
''Load, Next List!''
Thu, 17 Jul 2025, 04:11
realtime
You can add command something like:
Import from "http:/yourcode"

You can then combine it and work as usual
I think this is good when you have reusable code.

I don't mind with everything global.
You can use tag to separate things.

-=-=-
BASIK
Thu, 17 Jul 2025, 04:32
Jayenkai
That's a nice solution, but how do you do that without having to host it yourself?
And what do you host it as?
And how do we secure the javascript so it isn't importing something that can easily hack the user?

-=-=-
''Load, Next List!''
Thu, 17 Jul 2025, 06:19
realtime
It is a jse code. There is no harm with it.
You can parse it and it Will fail if it is not a jse code.
You can do like separate the image, or data.

For hosting, we can upload it here like we upload image as usual.

-=-=-
BASIK