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:
Javascript 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}`;
Javascript Result:
And although to do that in Python is simpler, it's not as readable:
Python 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:
Python Result:
Whereas, if I want to do that in HyperTalk, I'd be able to use:
Hypertalk Script:
put item 1 of the long date & "," && the date & "," && the time
Hypertalk Result:
However, the great thing about hyperTalk (and webtalk), is that it can also be quite flexible:
put item 1 of the long date & "," && dateFormat(the dateitems, "%d/%m/%Y") & "," && the time
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
Licensing
You might also want to read the license agreement on that last page of the documentation too.
Alternatively, you can run it in a wrapper. The wrappers are larger in size because they are akin to a standalone app version. The advantage of the wrapper versions is that they also allow use of the shell (download) command in Webtalk. Note, I don't update these as often as the non-wrapper versions - purely because it's a lot of work. They get updated sporadically.
Online version
Or lastly, 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.
put the selectedChunk of field "myfield"
-- would return char x to y of the selected text in the field
put the selectedText of field "myfield"
-- would return the actual string of selected text in the field
I then added the put the curve command curve example-2. This can be used to plot a curve from point A to point B, and you can vary the accentuation of the curve.
put the controlWithinRect(myRect) into myObjects
-- returns a list of all the objects within this rect.
-- filter out undesired objects with:
filter myObjects without "*Name*"
This is handy for interactive object types, or situations where you might want to use it for games.
Simulates a mouse click (mousedown, then mouseup). Added the copy and paste keyboard shortcut for objects when in edit mode. Added an 'Align' option. You can find this when in edit mode. (Right-click on an object and you will have alignment choices):
Extended support for other modifier keys, re-added and revised the AST expression parser (from v133 beta), and added the Among keyword (page 125 of the documentation).
Added functions to Webtalk. Also added the ability to apply image masks, and added support for text colouring in fields to mimic the script editor formatting
Fixes for the visual effect when a script error occurs, additions to sound playback abilites, fixes to autotab in fields, allowed custom handlers to be less restrictive with parameters, expanded the select command with synonyms, and lastly - introduced a direct shell.py through the cgi-bin localhost method (download that stack here, instead of live-demo'ing it).
This week, I've added these things in v243 (buttons with different types of borders, gradient fill for borders), and spinner progress dialog. You can also right-click in edit mode on a graphic, choose "Edit points", and edit the points of the graphic.
scalefactor and turtle graphics,peel and waterdrop. Also, the backscripts support simplified loading and setting up, so the whole process is easier. I've also increased the compression level when saving wts files. Please read the documentation notes on page 146 for further details regarding these changes.
I should mention, you aren't stuck with having to use a turtle. This stack demos how you'd swap it to a snake instead. Also, (almost forgot!): I updated the wrappers to version 244 as well.
v245
Added guides:
.
To invoke this, you simply run:
show guides
Oh, there's one more thing: I started working on a geometry palette too.
It's very beta at the moment, but gives you an idea. It has a few things I've yet to work out how to do, but I will refine this in the next couple of versions.
When you click on one of the lines, it first changes to red. This means it's fixed in position. If you click it again, it should change to be cyan. A Cyan line indicates that it will be resized proportionally with the stack window. You can also set the minimum width and minimum height too.
To open the geometry palette:
show geometry
v246
Modified the geometry palette further:
I've added tooltips and refined the UI slightly, while also fixing some bugs (objects shouldn't jump about now). This being a GUI feature, I've not really documented it yet, but I will mention it in due course. This is working towards fully adaptive layouts, so stack elements can be resizable based on the user's screen size. This version is more of a checkpoint release: just to give a point to regress to if I mess something up (I'll get onto version 247 fairly quickly).
v247
Most of this week, I've been working on the soundtrack system for webtalk:
There's lots to cover about this in the documentation, but the easiest way is probably just to try it out. Of course, it's fully scriptable and can be controlled via a set of webtalk commands and syntax. I also detailed those on the example stack.
dateFormat.json How to quickly reference any part of the dateItems for easy output.
backgroundPattern.json This stack is a simple demo of setting a backgroundPattern (a repeating pattern).
answer-colour.json This shows you how to use the answer colour function, but also how to convert between RGB and Web colour references (or back again).
repeat-until.json A graphical example of using 'repeat until' logic.