Posts tagged LiveCode

LiveCode is a modern day HyperCard

This post is a reply to Why HyperCard had to Die — by Stanislav. I’m not saying the post is wrong, I am just presenting an alternative that is alive and working well. LiveCode is a modern day HyperCard and everyone who used HyperCard will feel at home at it.

LiveCode runs on macOS, Windows and Linux and can generate standalone binaries for all those platforms plus Android and iOS. You can get it from https://www.livecode.com or you can get a GPL version of it from https://www.livecode.org.

In this post, I will recreate the demo that Stanislav created on their post which was a simple four operation calculator. I hope readers will notice how familiar the environment is and yet how modern it became.

Disclaimer: I work for LiveCode.

Created a Leanpub helper Desktop App

I’ve been having a lot of fun with my new book LiveCode Advanced Application Architecture (available on this site and on Leanpub). To make my life easier, I set aside some hours today to create a little desktop helper application for Leanpub. I wanted an app that could show me some quick information about my sales, allow me to generate new previews and publish new versions of the books.

Leanpub Quickboard running on Windows 10

Leanpub Quickboard running on Windows 10

I’ve written a new book about LiveCode

I’ve just written a new LiveCode book. It explores the best practices used by seasoned LiveCode developers from around the world and also how to apply insights from the MVC pattern into that platform. Along the book you work through a simple address book application while learning all the tips and tricks from our community.

LiveCode Advanced Application Architecture

LiveCode Advanced Application Architecture

The book is available for GBP 15 and can be purchased with the button below, or you can read more and learn about the unique bundle I am offering.

Read more for learning about the bundle and also about the experience of writing another book.

A simple publisher/subscriber library for LiveCode

This is a simple library I made to use in a game we’re making where we needed a way for objects to interact with each other without hard coded object references. This pattern is known as the publisher/subscriber pattern or the observer pattern.

In this pattern objects can register themselves as listeners for specific events. Once an object triggers an event, all objects that we’re listening for such event will receive a callback message. You can use this pattern to allow controls to react to events in your program without the need to hard code dispatch/send messages. A good example is a progress bar that listens for a message that is triggered by a download operation. The download routine would trigger this message without the knowledge of the progress bar, it is just broadcasting it like: “hey, I am downloading something” and the progress bar will listen for this broadcast and react to it. The code could be like:

on openCard put the long id of scrollbar "progress" into tTarget addEventListener "downloadProgress", "downloadProgressCallback", tTarget libURLSetStatusCallback "urlstatus" load URL myURL with message "downloadComplete" end openCard on urlstatus pURL, pStatus switch item 1 of pStatus case "loading" put 0 into tDataA["start"] put item 3 of pStatus into tDataA["end"] put item 2 of pStatus into tDataA["progress"] trigger "downloadProgress", tDataA break end switch end urlstatus on downloadComplete ## this is just cosmetic to guarantee that ## the progress bar goes to 100% once the download ## is completed. put 0 into tDataA["start"] put 100 tDataA["end"] put 100 into tDataA["progress"] trigger "downloadProgress", tDataA end downloadComplete

In the given scrollbar script:

on downloadProgressCallback pDataA set the startValue of me to pDataA["start"] set the endValue of me to pDataA["end"] set the thumbpos of me to pDataA["progress"] end downloadProgressCallback

This way we can change the UI that reacts to the download without touching the urlstatus message implementation. We could have many controls listening for the downloadProgress event. Also check out how both the urlstatus message and the downloadComplete message trigger the downloadProgress event. None of these messages have any prior knowledge of whom is receiving this event and nothing is hardcoded.

Using such patterns, you can decouple your user interface from the inner workings of your application easier than before. In our little game we have stuff such as objects broadcasting events like “exploded” and “died” so that other objects can react. Since in games you tend to create and destroy objects at runtime a lot, this library makes our life easier.

This library is released in the public domain. Use it as you see fit, can’t sue me. To download this library, use the link on the sidebar (or link below if you’re using a mobile device).

Mentions