[tw5] Custom export formats: TiddlyWiki available for study

See details in this blog post.

Try the features and go some TiddlyWiki code excavation/study with the latest version of BASIC Anywhere Machine.

  • BASIC Anywhere Machine’s File menu, click on the “Exit” menu item to get into the TiddlyWiki interface

  • Relevant tiddlers:

    • .BAS Exporter

    • .BAS.HTML Exporter

    • .BAS.JSON Exporter

  • Creating a custom export format

Cheers !

1 Like

BASIC Anywhere Machine follow-up video showing the usefulness of the TW-native export formats and the three additional export formats when exporting BASIC programs.

1 Like

This is of interest, not just for the custom exports (I home brewed a basic html export so I could build web pages independent of TW’s stylesheet, but with a custom stylesheet), but the BASIC anywhere. I saw that the code examples opened in console windows in FF-- could the code run (generate graphics) in html, like a iframe?

G’day, and thanks for your interest ~

The code is running in HTML in an iFrame now. (That BASIC console window is just a TiddlyWiki-generated window containing an iFrame to display the HTML needed to run the BASIC program.

If you export a program as .bas.html, that html file is then something you can display directly in a browser window by itself, or display in an iframe.

The .bas.HTML file will have the BASIC program embedded, and also have the BASIC interpreter (a modified version of wwwBASIC) embedded as well, translating the BASIC program into javascript on the fly.

Post-send-button-click thought:

I’m sure wwwBASIC can be customized to export the resulting javascript, but the javascript involved is way over my head.

Me, I would be much happier right-clicking on the console window and saving the image, and embedding that image in a web page, if not embedding the .bas.html export.

: ) You fooled me with those iframes, I thought they were FF dev tool popups!

But pre-generated images would be best for static images but it looked like some code had interactivity. I have operated TW’s along with web pages that had js I couldn’t run in TW, or another web app through iframes, so this would be along those lines.

I shall be delving into this Basic Anywhere further-- TY for you wiki!

I fooled you? Well, my occasional moments of sneakiness (blink and you’ll miss it) can be underestimated …

https://basicanywheremachine.neocities.org/BAM_IDE.html

Yeah, pick any of the programs already in there, and export to .bas.html. Then open in your browser to see running app.

Single html file with nothing but basic program and the goodies that run the BASIC program. All self-contained, just itching to be deployed.

Don’t mind me, that gets my geek mojo gooving something silly.

If you sneak a peak at wwwBASIC, you’ll see that a standard BASIC program in a deployable HTML file looks like this:

`

`

BASIC Anywhere Machine is a fully self-contained TiddlyWiki (my modified version of wwwBASIC.js is in a tiddler). The export .bas.html process just spits out the basic program like in the example above, but also embed all of the javascript from my version of wwwbasic right into the html file, so the html file has no external references.

Nothing revolutionary, but still pretty cool.

Yes this creation of yours is pretty cool. My main TW project is an interactive novel/pick your own adventure browser game that already uses TW core with multimedia resources, svg animations, vrml (x3d)-- so why not BASIC generated graphics?

Made with the methodically maddening haphazard KAOS theorems (M2HKT) of WikiWitchery…

i1,i2,i3,i4 = ideas
i1 + i2 = o.0
i1 + i3 = 0.o
i1 + i2 +i3 = >.<
i1 + i2 + i4 = 0.0

Once a TiddlyWiki fires up a BASIC program, that TiddlyWiki can’t directly feed anything to the BASIC program.

The only time a TiddlyWiki can “feed” anything to the BASIC program directly is upon dynamically building the HTML (BASIC program, javascript to interpret the program, and maybe some transcluded goodies that get wikified upon dynamically building that HTML) just before sending all of that to an iframe.

Anything that changes that HTML passed to the iframe causes the BASIC program to restart.

The way to get TiddlyWiki talking to the program while it is running: local storage !

So whatever widgets involved with, say, a game, in a TiddlyWiki tiddler set values in local storage.

The BASIC program regularly checks local storage, and processing gets triggered based on what the BASIC program finds in local storage.

The BASIC program can also provide values to the TiddlyWiki via local storage, but some kind of trigger needs to be setup in TiddlyWiki to check local storage (a manual trigger would involve a human pressing a button; an automated trigger would involve some kind of timer in TiddlyWiki to trigger check of local storage and retrieving values from local storage.)

TiddlyWiki to BASIC communication is ridiculously easy. The other direction is a bit of work.

Using BASIC for dynamic generation of good-enough graphics based on events happening in TiddlyWiki: awesome scenario.

1 Like

You can use https://tiddlytools.com/timer.html#TiddlyTools%2FTime%2Faction-timeout.js to set up an automatic periodic trigger to perform actions.

To do this, you would create a tiddler, tagged with $:/tags/StartupAction/Browser, containing something like this:

\define myActions()
... action widgets to check local storage and retrieve values goes here ...
\end
<$action-timeout interval="1000" actions=<<myActions>> />

enjoy,
-e

Thanks for bringing that up, Eric. I totally forgot about your very nice and tidy javascript macro.

For whatever reason, all I could think of is $:/plugins/OokTech/TimerActions, which I find heavy for simple enabling of bilateral communications (via local storage) between TiddlyWiki and a BASIC Anywhere Machine program , or between any two or more TiddlyWiki instances (all in the same domain to access the same area of local storage.)