How To: Try It Now!

Announcements by the development team or forum staff.
User avatar
Cyber
Posts: 482
Joined: Mon Apr 27, 2020 7:36 am

How To: Try It Now!

Post by Cyber »

We added "Try It Now!" feature to forum.
This feature allows launching a program in X16 web emulator in one click.
Here is a short "how to". (updated on 25 April 2023)

Preparing file for upload:
  • If your program is a single BAS or PRG file, the file is good to go, skip to: Creating "Try It Now!" link.
  • If your program consists of more than one file, pack all your program files into ZIP file. If your program has only one start file (BAS or PRG), no need to do anything else, skip to: Creating "Try It Now!" link.
    • If your program has more than one start file (BAS or PRG), you may use manifest file and specify default start file in "start_prg" or "start_bas" field (details below).
    • If you want to include additional files to ZIP, which are not needed for program to run (docs, examples, etc.) you may use manifest file and specify needed files in "resources" section (details below). Otherwise emulator will fetch all files from zip.
Example of optional "manifest.json" file.
You may include this file in ZIP if you need.

Code: Select all

{
    "manifest_version": "1.0.0",
    "name": "My Program",
    "author": "John Smith",
    "app_version": "1.0.0",
    "license": "GPL 3",
    "start_prg": "MYPROG.PRG",
    "resources": [
        "MYPROG.PRG",
        "FILE1.BIN",
        "FILE2.BIN"
    ]
}
  • "start_prg" (or "start_bas") may specify file to run your program, if your ZIP contains more than one start file. If not specified and ZIP contains more than one start file (or none), then emulator will drop to BASIC and let the user decide which file to LOAD.
  • "resources" may specify files needed for program, if your ZIP contains additional files (docs, examples, etc.). If not specified, emulator will fetch all files from zip.
  • Other fields are just for information and are not handled by emulator.

Creating "Try It Now!" link:
  • Create a new post or edit existing one. (We prefer you edit the top post of the program thread.)
  • Attach BAS, PRG or ZIP file to forum post.
  • Hover mouse over the attachment link and look for the number at the end (id=1218).
  • Click the "TRYIT" button in the editor toolbar.
  • Type the number from your URL into the "tryit" tag like this: [tryit]1218[/tryit]
  • Enjoy. :)
Here is how it should look: Try It Now!
Edmond D
Posts: 489
Joined: Thu Aug 19, 2021 1:42 am

Re: How To: Try It Now

Post by Edmond D »

Wonderful that you have made this work again!
mwiedmann
Posts: 70
Joined: Fri Jan 20, 2023 2:21 am
Location: New York City

Re: How To: Try It Now

Post by mwiedmann »

My game organized files into subfolders and loads them from there. Example:
sounds/sound1.zsm
sounds/sound2.zsm
levels/level1.bin
levels/leve2.bin
images/sprite1.bin
...etc...

Can the "resources" reference subdirectories like that?
OR do I have to flatten everything out and change my code to load everything from the main directory?
grml
Posts: 60
Joined: Sat Aug 13, 2022 8:31 pm

Re: How To: Try It Now

Post by grml »

This is too complicated and could be done better. Why make a list of files, the zip already has a list of all files. I'm not gonna do that. It should also just run a bare PRG without the zip shenanigans.

Where to submit PRs?
BruceRMcF
Posts: 224
Joined: Sat Jan 07, 2023 10:33 pm

Re: How To: Try It Now

Post by BruceRMcF »

grml wrote: Mon Apr 03, 2023 10:03 am This is too complicated ...
I'm not unhappy if people who find writing a manifest to be too complicated put up their hands to get help with that in the "help wanted" forum.
mobluse
Posts: 174
Joined: Tue Aug 04, 2020 2:16 pm
Location: Lund, Sweden
Contact:

Re: How To: Try It Now

Post by mobluse »

I got it working, but the name and author is not visible as it is in other posts with attachment inline, see viewtopic.php?p=26672#p26672

I have included name and author in the manifest. What should I do to get the name and author displayed.

I think one could have a default manifest for attachments without manifest, e.g. the first PRG file should be the start_prg, unless the file doesn't have a PRG file, in which case the first BAS file should be the start_bas. This would make many files in the archive work if one linked to them using the tryit tag. It's the responsibility of the one who links using the tryit tag to test that the program works in a useful way. All my old programs, except one, still works with R42. I don't have permission to edit my posts in the Archive.
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: How To: Try It Now

Post by TomXP411 »

mobluse wrote: Thu Apr 06, 2023 3:21 pm I got it working, but the name and author is not visible as it is in other posts with attachment inline, see viewtopic.php?p=26672#p26672

I have included name and author in the manifest. What should I do to get the name and author displayed.
I think that's just the comment field, to the right of the filename when you're editing the attachment list.
mobluse
Posts: 174
Joined: Tue Aug 04, 2020 2:16 pm
Location: Lund, Sweden
Contact:

Re: How To: Try It Now

Post by mobluse »

You're right. I thought the name and author came from the manifest.

Can one have files in the zip-file that are not needed by the program and that are not in the manifest? but are there for other reasons: e.g. a BAS file of the program even if the web emulator uses the PRG file, since BAS files often work with later versions, but takes longer time to load. PRG file for the iPhone version, which is still R38, I believe.

I found this useful for checking errors in JSON: JSONLint - The JSON Validator:
https://jsonlint.com/
Last edited by mobluse on Fri Apr 07, 2023 2:40 am, edited 3 times in total.
Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Re: How To: Try It Now

Post by Ed Minchau »

mwiedmann wrote: Mon Apr 03, 2023 12:40 am My game organized files into subfolders and loads them from there. Example:
sounds/sound1.zsm
sounds/sound2.zsm
levels/level1.bin
levels/leve2.bin
images/sprite1.bin
...etc...

Can the "resources" reference subdirectories like that?
OR do I have to flatten everything out and change my code to load everything from the main directory?
I tried it with subfolders and without, and for me it didn't work with subfolders but worked when everything was in the same directory.
grml
Posts: 60
Joined: Sat Aug 13, 2022 8:31 pm

Re: How To: Try It Now

Post by grml »

I've looked at the feature's code and have fixes for most of the issues, but I don't know what to do with them now. Let me know if anyone cares.
Post Reply