Hypercard Simulator

A place to discuss any and all xTalk implementations, not just LC LCC Forks, but HyperCard, SuperCard, MetaCard, Gain Momentum, Oracle MediaTalk, OpenXION, etc.
Forum rules
Please limit any bashing/harping on any commercial interests to a minimum, thanks!
User avatar
OpenXTalkPaul
Posts: 2836
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Hypercard Simulator

Post by OpenXTalkPaul »

Playing around with the styling of various parts of HC sim at the moment.
Sort-of testing if I can transform it into more of a 'OXT Community' Simulator (I've added a few compatibility 'synonyms' and things) while I'm studying how the Sim is constructed.

I'm trying to ditch the macOS System 6/7 appearance of Window titlebars, going for slightly 'OS-generic' with the gradation.
Screenshot 2025-04-18 at 10.00.17 PM.png
Screenshot 2025-04-18 at 10.00.17 PM.png (123.57 KiB) Viewed 1200 times
There's several things I'm still not sure about how they work exactly. Like how to list and load imported assets, besides black & white ICONs ... there's Dialog, Palette, 'SND ', PICT 'resources'. I sort-of understand how 'parts' are defined in their 'template' sections, would like to add 'image', 'graphic' parts... 'groups' too, which act similar to a 'background' but it's actually a control/part that maintains a list of other controls. Currently the sim only allows to select one control/part at a time, so that would need to change to implement 'group/grp' controls.

One of main things I'd like to modify is file loading so we can load a 'stack' file from local disk. It appears that the 'Home' Stack that's embedded into the Sim .html gets stored in the users local browser cache as JSON (which can then be modified by user). It would also need to be modified so that it saves out to .json in addition to being able to export as HTML 'standalone' page (though it still requires 'script.js' to be functional as a 'stack').
User avatar
OpenXTalkPaul
Posts: 2836
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Hypercard Simulator

Post by OpenXTalkPaul »

dandandandan wrote: Thu May 05, 2022 9:05 pm https://hypercardsimulator.com/
I started making a tool to inspect and eventually import the HyperCard Sim exported stack.html format into the OXT/LC Community engine. But when I parse bitmap='data:image/gif;base64,... and Base64 decode the data, the result does not start with 'GIF' magic number. What's up with that? Is it actually some version of 'WOMBA' 1-bit graphics format that needs further processing to be rendered?
User avatar
OpenXTalkPaul
Posts: 2836
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Hypercard Simulator

Post by OpenXTalkPaul »

OK I'm starting to get the PICTure, all stack resources are being stored in JSON type structure in the <stack-part>'s attributes...

...and the binary data is base64Encoded AND DOUBLE escaped for special characters in a string, including forward slash:
{"click-sound":"data:audio\\/wav;base64,...
Note the double back-slash escaping, which probably needs to be undone before base64 decoding.

....and it seems any Mac-Roman extended characters such as 'Bullet" option+8 are escaped Unicode equivalents.
importedPICTs='{"25001":{"name":"\\u2022NotEnufMemDisplay"...
The PICT resource name here, extracted from the HTML, should be "•NotEnufMemDisplay")

EDIT: OK I just tested with JS's unescape(); (which is deprecated), and it didn't do anything for double-escape backslashes
I've come to understand that certain things, like line break \n in strings, need to be double-escaped for the HC Simulator (so \\n for the line-break)... so as a quick test I manually delete the double slashes from a string for a PICT resource and came out with a valid DataURI that produced an image (by pasting it into the address bar).

addColor PICT-as-PNG extracted from a HyperCard stack imported into HyperCard Sim and then exported as .stack.html:
Unknown.png
Unknown.png (215 Bytes) Viewed 804 times
That doesn't explain that card-image bitmap 'GIF' not beginning with a GIF8Xx 'magic number'. :?
User avatar
OpenXTalkPaul
Posts: 2836
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Hypercard Simulator

Post by OpenXTalkPaul »

Screen Shot 2025-04-29 at 2.17.44 PM.png
Screen Shot 2025-04-29 at 2.17.44 PM.png (194.69 KiB) Viewed 752 times
I've created an OXT stack that dices up a .stack.html exported from HC Sim and returns an OXT array that can be viewed in the 'Tree Widget'. It's not quite complete yet, but it parses most of the tags/attributes already.
Can't parse certain things yet, like WOBA, into format that's usable in OXT.
WOBA looks weird, it seems to start with THREE sets of rectangle coordinates (as opposed to 1), not sure why that is.
User avatar
OpenXTalkPaul
Posts: 2836
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Hypercard Simulator

Post by OpenXTalkPaul »

WOBA looks weird, it seems to start with THREE sets of rectangle coordinates (as opposed to 1), not sure why that is.
Talking to myself here :lol:
OK I finally took a closer look at the community created documentation for WOBA (reverse engineered by Rebecca Bettencourt and others) and Dan's JS scripts that encode, decode and then render them to a canvas element... Now I understand why Becky named the format WOBA, the Wrath Of Bill Atkinson :lol:

Good stuff, but I'm wondering why @dandandan made that part of the HyperCard sim's 'engine' and not exclusively a part of a separate conversion script that would convert a canvas with rendered WOBA into a web-friendly format like GIF or PNG and then never uses the WOBA again?

I was thinking of translating Dan's WOBA decode/render functions to OXT script, but that seems like a poor use of time,
Because:
A) somewhere in the OXT engine there's already a C++ function that decodes WOBA. Some versions of LiveCode can import HyperCard stacks so the code is in there (although HC import became broken with versions > 6.5.x ). If I can find the code in engine source for it then maybe I can make an extension builder wrapper for it.
B) I could just use Dan's JS function to do that in a Browser Widget (doesn't matter if it has focus problems on most Linuxes, it would only be using JS to render an image).

Anyway, I updated the converter stack to handle extracting files from the arrays importedPICTs (stored as normal PNG) images, importedWAVs ('SND ' stored as normal WAV sound format). Will add bulk resource extraction later.
User avatar
richmond62
Posts: 5288
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Hypercard Simulator

Post by richmond62 »

the code in engine source
I was unaware that "some people' actually took an Open Source licence seriously, and abided by it.

I wonder WHERE one can download the source code for ALL the Open Source versions of LiveCode (including the code for the engines).

In fact, despite Richard Stallman and all who sail in him, this shows up the whole Open Source & CopyLeft thing as effectively unenforceable.
https://richmondmathewson.owlstown.net/
User avatar
OpenXTalkPaul
Posts: 2836
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Hypercard Simulator

Post by OpenXTalkPaul »

richmond62 wrote: Wed Apr 30, 2025 5:17 pm
the code in engine source
I was unaware that "some people' actually took an Open Source licence seriously, and abided by it.

I wonder WHERE one can download the source code for ALL the Open Source versions of LiveCode (including the code for the engines).
I honesty have no clue who "some people' you are referring to might be.
The source code for LC Community Editions version 6.0.1 to 9.6.3 is all on GitHub still.
Anyone can look at the code, and I suppose if they really wanted to, could use that code for closed source stuff in violation of the code's license agreement... if they were unethical people (or an unethical generative AI created by unethical people)... and possibly even get away with it without lawsuit being filed against them.
User avatar
richmond62
Posts: 5288
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Hypercard Simulator

Post by richmond62 »

The source code for LC Community Editions version 6.0.1 to 9.6.3 is all on GitHub still.
Super!
https://richmondmathewson.owlstown.net/
User avatar
OpenXTalkPaul
Posts: 2836
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Hypercard Simulator

Post by OpenXTalkPaul »

In the browser HC Sim stores stacks as JSON in the browser cache/local storage
like the following:

Code: Select all

{
  "$": "stack-part",
  "name": "HyperSimTools",
  "width": "400",
  "height": "200",
  "script": "",
  "$$": [{
    "$": "background-part",
    "id": "1",
    "part": "background",
    "$$": ["\n\t\t\t\t", {
      "$": "button-part",
      "width": "48",
      "height": "38",
      "name": "New Card",
      "script": "on mouseUp\nvisual scroll left slow\n\t\tdomenu \"New Card\"\n\t\tend mouseUp\n\t\t",
      "topleft": "403,296",
      "showname": "false",
      "icon": "17481",
      "$$": [" "]
    }, {
      "$": "button-part",
      "width": "49",
      "height": "38",
      "icon": "27009",
      "showname": "false",
      "script": "on mouseUp\nvisual scroll left\n\t\tgo next\n\t\tend mouseUp\n\t\t",
      "topleft": "457,297",
      "name": "Next",
      "$$": [" "]
    }, {
      "$": "button-part",
      "width": "45",
      "height": "37",
      "name": "Stack Info",
      "script": "on mouseUp\n\tdomenu \"Stack Info\"\n\tend mouseUp\n\t",
      "topleft": "351,297",
      "icon": "8538",
      "showname": "false",
      "$$": [" "]
    }, "\n\t", {
      "$": "button-part",
      "width": "45",
      "height": "37",
      "textname": "Home",
      "script": "on mouseUp\n\tgo home\n\tend mouseUp\n\t",
      "topleft": "300,297",
      "icon": "13745",
      "showname": "false",
      "$$": [" "]
    }, "\n\t\t"]
  }, {
    "$": "card-part",
    "bkgndid": "1",
    "id": "1",
    "class": "current",
    "bitmap": "data:image/gif;base64, there was bad GIF data here",
    "color": "#c0c0c0",
    "script": "on idle\nif the hilite of btn TimingDisplay then\n-- OXT VERSION\n-- put \"Seconds: \" & the seconds & return & \"Ticks: \" & the ticks & return & \"Milliseconds: \" & the milliseconds into cd fld 1\nput \"Seconds: \" & the seconds & return & \"Ticks: \" & the ticks into cd fld 1\nend if\nend idle",
    "showpict": "false",
    "$$": [{
      "$": "div",
      "slot": "-1",
      "$$": [{
        "$": "div",
        "$$": [{
          "$": "br"
        }]
      }]
    }, {
      "$": "button-part",
      "id": "2",
      "topleft": "9,7",
      "width": "114",
      "height": "25",
      "name": "change size",
      "color": "#FFFFFF",
      "script": "on mouseDown\nset the height of this stack to 500\nset the backColor of me to Blue\nend mouseDown\n\non mouseUp\nset the height of this stack to 200\nset the backColor of me to Gray\n\nend mouseUp\n\n",
      "$$": [" "]
    }, {
      "$": "button-part",
      "id": "2",
      "topleft": "7,45",
      "width": "114",
      "height": "25",
      "name": "Palette",
      "color": "#FFFFFF",
      "script": "on mouseDown\nPalette \"HyperSimTools\"\nend mouseDown\n\n",
      "$$": [" "]
    }, {
      "$": "button-part",
      "type": "checkbox",
      "name": "TimingDisplay",
      "topleft": "6,79",
      "width": "118",
      "height": "32",
      "id": "5",
      "color": "#74a7fe",
      "bevel": "7",
      "textstyle": "bold",
      "class": "bold",
      "textalign": "center",
      "textfont": "Geneva",
      "textsize": "12",
      "autohilite": "false",
      "$$": [" "]
    }, {
      "$": "field-part",
      "part": "field",
      "id": "6",
      "topleft": "9,126",
      "width": "202",
      "height": "62",
      "name": "1",
      "type": "transparent",
      "$$": [{
        "$": "div",
        "$$": ["Seconds: 1746036828", {
          "$": "br"
        }]
      }, {
        "$": "div",
        "$$": ["Ticks: 104762209701"]
      }]
    }]
  }]
}
User avatar
OpenXTalkPaul
Posts: 2836
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Hypercard Simulator

Post by OpenXTalkPaul »

Today I got importedICONReources to parse/convert into OXT Image control containers, I already new the format for the 1-bit ICON resources, but still got tripped up because I forgot that function baseConvert(tByte,10,2) does not pad the 'bits' of ones and zeros to multiples of 8 bits so padding results with leading '0's is needed. Anyway that's working now, at least for 1-bit ICONs.

I'm not sure if the handler needs to work with cicn (color icon resources), I haven't seen any in any of the converted stack data I've looked at so far. I do recall there were a few XCMDs that could make use of color icon resources.

Also today started to look closer at what data the Simulator is storing in browser the localStorage.

These are JS introspection functions and the JS console output:

Code: Select all


localStorageListItems().flat()

localStorageListItems().entries()
localStorageListItems().entries("stacklist")

localStorageGetItem('shownfloatmenu')

localStorageGetItem('stacklist')
[{\"ID\":\"1\",\"visible\":true,\"x\":0,\"y\":0,\"width\":512,\"height\":342,\"tool\":\"Browse\",\"bgmode\":false,\"name\":\"Home\",\"user\":\"\",\"path\":\"\",\"mtime\":0,\"menubar\":\"\",\"stored\":false,\"current\":\"1\",\"recent\":[],\"neverleftfullscreen\":false},{\"ID\":\"1746149573815\",\"visible\":true,\"x\":211,\"y\":291,\"width\":512,\"height\":342,\"tool\":\"Field\",\"bgmode\":false,\"name\":\"Untitled\",\"user\":\"\",\"path\":\"\",\"mtime\":0,\"menubar\":\"\",\"stored\":false,\"current\":\"1\",\"recent\":[],\"neverleftfullscreen\":false}]" = $1

storage.stacklist
[{"ID":"1746149573815","visible":true,"x":272,"y":92,"width":512,"height":342,"tool":"Field","bgmode":false,"name":"Untitled","user":"","path":"","mtime":0,"menubar":"","stored":false,"current":"1","recent":[],"neverleftfullscreen":false},{"ID":"1","visible":true,"x":0,"y":0,"width":512,"height":342,"tool":"Browse","bgmode":false,"name":"Home","user":"","path":"","mtime":0,"menubar":"","stored":false,"current":"1","recent":[],"neverleftfullscreen":false}]

HC Sim doesn't have the 'the globals' property but similar globals-list can be had with localStorageGetItem('globals')

HC Sim creates a global 'isSimulator' which I'm guessing a script can use to tell if it's running in the HC Sim 'IDE' or as a 'standalone' page.
User avatar
uliwitness
Posts: 5
Joined: Sat Apr 26, 2025 9:34 am
Contact:

Re: Hypercard Simulator

Post by uliwitness »

FourthWorld wrote: Wed May 18, 2022 8:08 pm Serious question: what are the challenges in learning JavaScript?
No specific challenge. Like every other programming language, it redefines words that seem to have certain broad meanings in English to have a very specific meaning in that language, which differs from what you may know from HyperTalk, and it uses more symbols than HyperTalk. For example, instead of `put` it uses `=`, and instead of `is`/`=` it uses `==`.

Takes some getting used to.

Also, HyperTalk is special in that HyperCard stacks remember any changes you make. You can quit and restart a stack, and everything pretty much comes back the way it was before. Most other programming languages (like JavaScript) have complete amnesia if you shut them down and start them back up again. And you have to write code to create and define all the elements you want to have on screen, and code that saves any changes to disk, and reads them back out, and makes all the windows re-open again with the right data in them.

Also, JavaScript runs in the browser, not locally like HyperCard, which means you have a server that contains all the data and code, and that gets downloaded to the user's machine, which complicates a lot of things (not just when it's slow or suddenly gets interrupted because Wifi dropped out).

So in summary: If you managed to learn HyperTalk, you can learn JavaScript. You've already proven you have the needed skills. But still, there are reasons why there are folks like us who go "I want HyperTalk, JavaScript is not enough". They are different in ways that change the experience.
Cheers,
-- Uli
stacksmith.org
User avatar
OpenXTalkPaul
Posts: 2836
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Hypercard Simulator

Post by OpenXTalkPaul »

uliwitness wrote: Fri May 02, 2025 11:53 am Also, JavaScript runs in the browser, not locally like HyperCard, which means you have a server that contains all the data and code, and that gets downloaded to the user's machine, which complicates a lot of things (not just when it's slow or suddenly gets interrupted because Wifi dropped out).
I would say that it is not entirely accurate to say a server needs to be involved to run JavaScript code, there's V8 Engine and JavaScriptCore, Node, Bun and web-app to desktop app wrappers like Electron. Then there's JSX, and IIRC there's actually a full Linux desktop environment, window manager, file manager, etc. built with JS.
still, there are reasons why there are folks like us who go "I want HyperTalk, JavaScript is not enough". They are different in ways that change the experience.
Absolutely, it's not like other coding languages, it's easier.
Typically xTalk scripts are english-like readable enough that less code-commenting is needed.
There's nothing quite like the Chunk expressions for both picking apart sections of text strings:
word 1 of line 2 of paragraph 3 of card fld "Story"
and also for descriptive object references with some or all of the objects inheritance chain in the reference:
the name of button 1 of card "ClickScripts" of stack "/path/to/stackfile"
the inheritance chain is listed in the reverse of direction used in many other languages, where the above object reference example in JS would probably look something like:
stack("/path/to/stackfile").card('ClickScripts').button(1).name()
Which I guess that's the order a computer would want it in when it tries to locate the requested data, but it's the opposite of English left-to-right reading order. I prefer it to be that way that's natural for the human, not the computer.
The only (non-xTalk) language that I've seen with something similar to HyperTalk chunk expressions is AppleScript, although I think AppleScript is less readable and less English-like.
User avatar
tperry2x
Posts: 3522
Joined: Tue Dec 21, 2021 9:10 pm
Location: webtalk.tsites.co.uk
Contact:

Re: Hypercard Simulator

Post by tperry2x »

OpenXTalkPaul wrote: Sat May 03, 2025 4:38 am ...The only (non-xTalk) language that I've seen with something similar to HyperTalk chunk expressions is AppleScript, although I think AppleScript is less readable and less English-like.
Which of course, Apple are trying to presently kill off.
User avatar
richmond62
Posts: 5288
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Hypercard Simulator

Post by richmond62 »

Apple is trying to kill everything off and build its hermetically sealed thing that is no longer what most of us think of as a computer, but a plastic bath-toy for rich people.
https://richmondmathewson.owlstown.net/
FourthWorld
Posts: 466
Joined: Sat Sep 11, 2021 4:37 pm
Contact:

Re: Hypercard Simulator

Post by FourthWorld »

uliwitness wrote: Fri May 02, 2025 11:53 am Takes some getting used to.
Indeed it does.

I appreciate your thoughts, as always, and would not dispute matters of taste, especially where our preferences are the same.

There was a time when I held out hope that the xTalk Way would lead the charge in 21st century app development. But I see the world's preferences are not my own, and my question relates to why that may be.

Syntax aside, the two elements of the xTalk Way you mentioned are design choices, with a large and growing body of examples in the world outside xTalks.

Auto save has been around for a while, these days nearly ubiquitous on macOS as a HIG mandate. xTalk engines make it easier to do, but in ways that seem to me tradeoffs, as all things are. Separating data from the UI in which it's displayed became important to me way back when I as building HyperCard stacks for clients; Adding features to the UI meant having to impose an export/import scheme on the user experience with each version. I believe the modern separation of data, view, and the code that coordinates them has evolved to become the norm for useful reasons.

And as Paul noted, the web engine has had native packagers available for some time. Though the number of native desktop apps made with the web engine is relatively small, today it far surpasses apps delivered with xTalk engines. And on mobile it's so common to use the web engine packaged in native standalone format that we see it used by a very large number of the leading apps, and a good many besides. React Native, Electron, and others are still not as easy to use as xTalk standalone builders, but that's largely a UX priority for dev tools makers rather than an inherent limitation of the runtime engine.

--

For myself, this line of inquiry is part of a personal process for establishing workflows and methods for new works going forward.

I began my career in a world where we were given a powerful, scriptable rich media engine pre-installed on every GUI device (tho such devices in mainstream '87 were limited to Macs).

Today we have a world where we're given a powerful, scriptable rich media engine pre-installed on every GUI device (and such devices are plentiful, in a wide range of form factors).

While it eventually became useful for HC to make standalones, one of the great things about HC was the ease of sharing apps: they were small files, which could be shared easily with the confidence that the user already had the large engine needed to run them.

Today we have an Internet which makes delivery even simpler: we don't have to send the app at all, just a single line of text, the URL, describing its location.

MetaCard made Internet stack delivery trivial, but despite my best efforts to help popularize it as a general delivery option, it never really caught on beyond being an efficient way for standalones to update their components.

We never saw a general purpose stack browser with any popularity, despite some good efforts from Ken Ray and others in that direction.

--

That Internet component is perhaps defining of our modern world.

At the beginning of my computing journey, single-user single-computer apps were the norm, as they would remain until the Internet's privatization in '96.

Now nearly three decades out, I can hardly imagine trying to get thru the day if I had to manually sync my data across a phone, a tablet, a laptop, and three desktop computers. The prospect would be more daunting considering each of these runs a different OS.

For better and sometimes for worse, our world is now an interconnected flow across people and machines, with compute and data resources available and interoperable nearly everywhere except when I'm backpacking in remote regions of the Mojave beyond cell range.

This "flowy" quality of how we use data today has reshaped expectations beyond the silos of yesteryear.

We can still make single-user single-computer apps as needed (I've been considering one for filling out archeology site record forms), but as the Internet's availability has grown such use cases are ever fewer.

--

This has become quite the ramble; please forgive the length. I just have some apps to make, and while I see how the world has evolved, I still find a voice from my younger days poking and prodding me to try to justify doing new work in the paradigm I know best.

For legacy apps, keeping them with the engine they're written for makes business sense.

But for new works I wander the desert, tasting the waters at each oasis I come across, observing that these are the places where flora and fauna still thrive, so different from the rocky barrens where I record archeological artifacts.
User avatar
OpenXTalkPaul
Posts: 2836
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Hypercard Simulator

Post by OpenXTalkPaul »

I'd add that you don't need a server OR bundle in a wrapper .app to run a web app, most web browsers have built-in developer tools, and can load content from a folder on disk (with the appropriate developer options enabled). Not sure about doing that on mobile platforms, I know you can do load web from local storage on jail-broken iDevice (might require a 'tweak' ).

Anyway, as I was looking into decoding the WOBA (Wrath Of Bill Atkinson) bitmaps, I came across this informative comment from Becky: https://groups.io/g/HyperCard/message/50
(the whole thread is worth a read)

Maybe that explains why HyperCard stack importing into LiveCode would sometimes mangle some card images?
It was never a straight forward process to convert HC to LC, I just worked around it.

If anyone is interested the Document Becky links to ( http://www.kreativekorp.com/swdownload/ ... 202010.TXT ) has details on the format, which is not just a straight-forward grid o pixels sort of format, part of the compression is byte size reduction by using a set of line / pattern drawing commands.
http://www.kreativekorp.com/swdownload/ ... ention.gif
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests