Introduction
Licensing
Release notes
online demo
download
Example stacks

Webtalk (alpha v159)

Webtalk is a web-implementation of HyperTalk. That doesn't mean you have to be online to run it. You can download it and run it from a computer with no internet connection.

What's HyperTalk?

That's another topic, which I'll expand upon a bit further down. If you never had a chance to get into the hypertalk language, you really are missing out. HyperTalk was the scripting language used in HyperCard. There's lots of ways you can experience what HyperCard was (is) today.

So what does webtalk do?

Webtalk is loosely based on the HyperTalk scripting language, and the goal is to be compatible in most major respects. There are additions to it and perhaps things missing from it. The boring bit is I'm not implying it's fit for any particular purpose, and there's no guarantees implied or otherwise about how it might run on your system. (Being based on Javascript and CSS, it heavily relies on what your browser is capable of).

The point of it is it's a programming language that's easy to type and understand. For example, If I wanted to output the current date in javascript, I'd have to type:

Code:

const now = new Date();
 const days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
 const dayName = days[now.getDay()];
 const dateTimeString = now.toLocaleString();
 document.getElementById('datetime').textContent = `${dayName}, ${dateTimeString}`;

Result:

And although to do that in Python is simpler, it's not as readable:

Code:

from datetime import datetime
 now = datetime.now()
 formatted = now.strftime("%A, %d/%m/%Y, %H:%M:%S")
 print(formatted)

Which again, gives us this:

Result:

Whereas, if I want to do that in HyperTalk, I'd be able to use:

Code:

put item 1 of the long date & "," && the date & "," && the time

Result:

 

HyperTalk script

HyperTalk was the programming language created in 1987 by Dan Winkler, and used in the HyperCard application, created by Bill Atkinson. Creating programs in HyperTalk was known as "scripting". HyperTalk scripts were much more similar to written English than many languages available at the time.

Webtalk script

A simple example of webtalk scripting:

This gives you an idea of what I'm aiming for here, to have something that is platform-agnostic which is capable of running HyperTalk scripts.

I'm trying to give a comparable set of features that were available in Hypertalk, but in Webtalk - so they are available to everyone. As such, there won't be specific Mac-only, Windows-only or Linux-only features implemented on this project. If I add a feature, it will be supported across all platforms.

Current progress:

The current documentation containing the release notes are here, as a PDF

You might also want to read the license agreement on that last page of the documentation too.

Download

You can download a copy of webtalk, (current version), from here. You don't need anything special to run it. Just a recent browser (if you are using Safari, needs to be version 17 or above)

Alternatively, if you prefer, you can try it as an online live demo here. You might also want to check out the testing pages, which give you a list of commands and handlers that are currently implemented.

Overview

A project overview (text file) is also available, which covers how this all works at a quick glance.

I should really mention, you can load JSON stacks with:

load stack "" -- if it can't find the file, it will ask you

Example stacks

all-shapes.jsonStandard shapes test
  star.jsonGenerating a custom star shape.
  8-point-star.jsonGenerating a custom 8-point star shape.
  datetests.jsonExample stack showing dateitems conversion.
  functiontest.jsonExample stack showing the use of custom functions.
  imagecopy.jsonThis stack shows how to duplicate image data to another image object.
  toggle-palettes.jsonA stack which shows how to toggle the message box and tools palettes.
  mouseup-test.jsonShows possible mouseup variants.
  webtalk-logo-vid.jsonAn example video 'player' object showing various logos.
  arrowkey-tests.jsonThis shows how to intercept the arrowkeys when pressed on the keyboard.
  opencard.jsonThis is a demo showing the opencard handler in action.
  light-or-dark.jsonAn example of how to adjust your stack for light or dark appearance.
  keyheld-test.jsonExample of using the keyheld message with no keyrepeat delays.
  rawkeyup.jsonA stack which uses the rawkeyup message in the card script.
  rawkeydown.jsonA stack which uses the rawkeydown message in the card script.
  multiple-keyup.jsonA stack showing how to test if a specific key is 'up'
  multiple-keydown.jsonA stack showing how to test if a specific key is 'down'
  keydown-test.jsonStack showing more traditional keydown messages.
  pendingmessages.jsonShows the concept of pendingmessages.
  pendingmessages-cancel.jsonShows how to cancel individual pendingmessages.
  move-example.jsonGraphical demo of the move command.
 
  spin.jsonGraphical demo of the spin command.
  spin-video.jsonGraphical demo of the spin command, but with a random amount and a video.
  musical-note-btns.jsonPlaying musical notes by clicking buttons, using a 'send to' function, and also via keyboard inputs.
  count-test.jsonCounting the number of objects, and examples of referencing lines of fields and variables.
  lineheight.jsonDemo stack showing setting variable line heights of fields.
  fonts.jsonLoading, unloading custom fonts. Getting the font list, and setting fonts of fields.
 

Recent additions:

v140

Redesigned the way the shapes are scaled when you resize with the shift-key held (proportionally) to remain accurate when they've been pulled about. I also put together a standalone SVG-to-webtalk path converter. You can select an SVG and it'll output what you need to create that shape in webtalk.

SVG Converter

Also added the ctrl-E shortcut for editing the script of a selected object.

v141

Having now finished adding shapes for a while, I have implemented an inspector. At the moment, this is only used to get what properties you might have applied to an object. I will modify this in future so that you can also set properties with it as well. You can invoke the inspector either by double-clicking an object with the edit tool / edit mode, or pressing ctrl i when you have an object selected with resize handles shown.

v142

Added additional field tools, modified the tool icons (now use SVG images instead of emojis).

v143

Updated the "Testing" page to show all the current syntax that webtalk can handle. I also added a "Test Pages" button on the tools palette, so it's easy to get to for quick reference (handy if you want to look up how to do something).

v144

Made the script editor window resizable, tweaked the format button in the script editor, and made the webtalk online demo work for mobile devices.

Well, works on Android at least.

On iOS, I can't hold down my finger on an object to invoke the popup menu (it currently tries to select the text of the button, so I have to run the command to edit the script via the message box).

v145

Fixed a few auto-correct issues for iOS and Android in the script editor. Made the "Run tests" button on the "Testing page" reset before each click, and added a new isuppercase() function. (see documentation).

v146

You can now create an image object using:

create image "imagename"

Or you can use the "Add Image" icon on the Tools palette.

You can currently set the image filename (the actual image used in the image object) using:

set the filename of image "imagename" to "filename.png"

If you proportionally scale the image, or even resize it so it's distorted, this does not affect the data of the image object in any way.

v147

Too many changes to list here. Please see the documentation. :)

v148

Major fix to the object model renaming, and continued work on the inspector.

v149

Most notable fix is the addition of the "video" button on the tools palette (now supports player objects).

Please see the documentation for more info.

v150

Quick overview of changes: Fixes to the script editor involving comments, you can now move a selected object around the card using the arrow keys in edit mode, the card now detects the arrowkeys, added support for custom functions, added 'clear message box' function, added more shapes to the tools palette.

v151

Expanded upon the key events. (keydown, keyup, rawkeydown, rawkeyup, and a new one - keyheld) Please read page 54 of the documentation.

v152

I've added support for the pendingmessages and webtalk now also supports the 'move' command. Please see the documentation for further details (page 56).

v153

I added the 'spin' command. (made sense since we have a move command). I also corrected a rename issue with the inspector (which I'll detail more about in the documentation).

v154

Today I expanded the play note range (note frequencies in documentation), and I also expanded on sending function handlers to other objects.

on mousedown
   send playSound("E",120) to this card in 400 milliseconds
 end mousedown"

This will send that command, along with it's variables, to the playSound function handler in the card, after 400 milliseconds. (non-blocking). In your card script, all you then need is:

on playSound thenote,theTempo
   put thenote into tNote
   put theTempo into tTempo
   play tNote tempo tTempo
 end playSound"

musical-note-btns.json

v155

Expanded upon the put, and lines function... It can now support a lot more 'fuzzyness' - I'll detail that in the release notes. I'm now making test stacks as that's the best way to find what webtalk is missing.

count-test.json

See the 'Example Stacks' on the left-navigation panel.

v156

I've added a HyperTalk-Extender module. The HyperTalk-Extender (hte), is a way to add new functions to the interpreter, so that they are available to any stack.

The idea is you'd add them to hypertalk-extender.js -- here's one I added to line 28 to test it:

// myCommand sample script
 HyperTalkExtender.registerScript('myCommand', [
     'get item 1 of the long date',
     'put it into tResult'
 ]);

Then, to run it, create a new button and use this script:

on mousedown
    get hte_myCommand -- prefix all HyperTalk-Extender commands with "hte_"
    put it
 end mousedown

The output from this is:

(This would vary depending on the day of the week).

This way, people can write their own scripts which can be called from any other stack, just by customising the hypertalk-extender.js

v157

Added variable line heights to fields, with the commands:

set the lineheight of field "a" to 32
 set the lineheight of line 1 of field "a" to 10

lineheight.json

As always, more information can be found in the documentation.

v158

Added the baseURL function:

put the baseURL

Outputs the current address the webtalk interpreter is loading from:

https://www.tsites.co.uk/sites/webtalk/progress/live-demo/

or

file:///home/user/webtalk/index.html

..for example. This might be handy for finding out if you are in an online instance of the interpreter or in a locally-downloaded copy.

v159

Webtalk now supports some font commands and functions:

put the fontNames
 start using font "myfont.ttf"
 put the lastLoadedFont -- returns the internal font name of the last loaded font
 set line 1 of field "text" to "myfont Regular"
 stop using font "myfont Regular"

fonts.json