# Defold Typewriter

**URL:** <https://forum.defold.com/t/defold-typewriter/72078>\
**Category:** The Defoldmine\
**Created:** [November 16, 2022, 10:13pm UTC](https://forum.defold.com/t/defold-typewriter/72078 "2022-11-16T22:13:57Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![WhiteBoxDev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/whiteboxdev/32/36080_2.png) [@WhiteBoxDev](https://forum.defold.com/u/WhiteBoxDev)\
**Post date:** [November 16, 2022, 10:13pm UTC](https://forum.defold.com/t/defold-typewriter/72078/1 "2022-11-16T22:13:57Z")

</div>

Hello everyone,

Many RPGs and other genres of games use a scrolling textbox to display dialog. This is a very common desire for game developers, so I decided to create dtypewriter to handle this task.

![dtypewriter](https://forum-defold.b-cdn.net/uploads/default/original/3X/6/e/6e8b96abd181b4a72c6be1fceede493d6bc16cd9.gif)

**Defold Typewriter provides text scrolling and styling in a Defold game engine project.** It uses HTML-style markup for specifying character colors, speeds, new lines, new paragraphs, etc. New features are easy to add, so I expect this extension to grow as I continue using it in my own projects.

Here is an example of how the above gif was formatted with raw text:

```
"Just like the classic RPG dialog systems, <color=green>dtypewriter<color=default> is a fantastic dialog solution!<paragraph>It can do all kinds of neat things, like <color=green>colors<color=default>, <speed=3>speeds<speed=default>, and <speed=instant>instant text display<speed=default>, among other things!"

```

Check it out here:

[https://github.com/whiteboxdev/library-defold-typewriter](https://github.com/whiteboxdev/library-defold-typewriter)

Happy Defolding!

---

<div class="post-metadata">

**Author:** ![MasterMind](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mastermind/32/31839_2.png) [@MasterMind](https://forum.defold.com/u/MasterMind)\
**Post date:** [November 17, 2022, 12:41am UTC](https://forum.defold.com/t/defold-typewriter/72078/2 "2022-11-17T00:41:39Z")

</div>

This is very nice. Would be a great addition to the asset portal. Thanks for sharing.

---

<div class="post-metadata">

**Author:** ![WhiteBoxDev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/whiteboxdev/32/36080_2.png) [@WhiteBoxDev](https://forum.defold.com/u/WhiteBoxDev)\
**Post date:** [November 17, 2022, 2:38am UTC](https://forum.defold.com/t/defold-typewriter/72078/3 "2022-11-17T02:38:33Z")

</div>

No problem, thank you. I do put my stuff on the asset portal, but it takes a while because the GitHub pull request needs to be approved. 🙂

---

<div class="post-metadata">

**Author:** ![Phoebe](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/phoebe/32/26906_2.png) [@Phoebe](https://forum.defold.com/u/Phoebe)\
**Post date:** [February 3, 2023, 3:09pm UTC](https://forum.defold.com/t/defold-typewriter/72078/4 "2023-02-03T15:09:55Z")

</div>

Hi, this library looks perfect for what I want to do! I’ve added it into my project and it’s sending all the start, type messages etc but not doing anything on the screen, and I’m not quite sure where I’ve gone wrong. Would it be possible to provide an example of working code I could look over?

---

<div class="post-metadata">

**Author:** ![WhiteBoxDev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/whiteboxdev/32/36080_2.png) [@WhiteBoxDev](https://forum.defold.com/u/WhiteBoxDev)\
**Post date:** [February 3, 2023, 3:16pm UTC](https://forum.defold.com/t/defold-typewriter/72078/5 "2023-02-03T15:16:46Z")

</div>

Sure, I will include an example project in the repo later this week.

---

<div class="post-metadata">

**Author:** ![Phoebe](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/phoebe/32/26906_2.png) [@Phoebe](https://forum.defold.com/u/Phoebe)\
**Post date:** [February 6, 2023, 10:12am UTC](https://forum.defold.com/t/defold-typewriter/72078/6 "2023-02-06T10:12:28Z")

</div>

Thanks so much!

---

<div class="post-metadata">

**Author:** ![Phoebe](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/phoebe/32/26906_2.png) [@Phoebe](https://forum.defold.com/u/Phoebe)\
**Post date:** [February 6, 2023, 2:43pm UTC](https://forum.defold.com/t/defold-typewriter/72078/7 "2023-02-06T14:43:19Z")

</div>

I found the issue, turns out I just forgot to change the default colour so the text was transparent. Works great!

---

<div class="post-metadata">

**Author:** ![WhiteBoxDev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/whiteboxdev/32/36080_2.png) [@WhiteBoxDev](https://forum.defold.com/u/WhiteBoxDev)\
**Post date:** [February 6, 2023, 2:53pm UTC](https://forum.defold.com/t/defold-typewriter/72078/8 "2023-02-06T14:53:20Z")

</div>

Awesome. I will make an update to set defaults, I suppose that would be a good idea.

I will still upload an example project, been extremely busy the past few weeks. Sorry about that.

---

<div class="post-metadata">

**Author:** ![Jowlfleas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jowlfleas/32/34330_2.png) [@Jowlfleas](https://forum.defold.com/u/Jowlfleas)\
**Post date:** [January 22, 2025, 6:24pm UTC](https://forum.defold.com/t/defold-typewriter/72078/9 "2025-01-22T18:24:19Z")

</div>

Hey I love your project, and it works just as advertised in Defold 1.9 EXCEPT (you knew there’d be an except)

It does not build into a functional HTML5 AFAICT. When I build it, it hangs on a black screen and stays there, doesn’t matter whether I do a test build within the IDE or bundle it and run it remotely.

Windows builds work fine.

I get no build errors.

Any suggestions? I know this is an old project.

---

<div class="post-metadata">

**Author:** ![Jowlfleas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jowlfleas/32/34330_2.png) [@Jowlfleas](https://forum.defold.com/u/Jowlfleas)\
**Post date:** [January 22, 2025, 8:01pm UTC](https://forum.defold.com/t/defold-typewriter/72078/10 "2025-01-22T20:01:01Z")

</div>

Update: Here are the errors in Firefox

ERROR:SCRIPT: Error running script: dtypewriter/dtypewriter.lua:108: ’ \< name \> ’ expected near ‘:’  
ERROR:SCRIPT: error loading module 'dtypewriter.dtypewriter’from file ‘dtypewriter.dtypewriter’:  
dtypewriter.dtypewriter

---

<div class="post-metadata">

**Author:** ![Jowlfleas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jowlfleas/32/34330_2.png) [@Jowlfleas](https://forum.defold.com/u/Jowlfleas)\
**Post date:** [January 22, 2025, 8:41pm UTC](https://forum.defold.com/t/defold-typewriter/72078/11 "2025-01-22T20:41:22Z")

</div>

Digging around, it looks like you’re using Lua 5.2 syntax with :: notation and goto. When I try to run your code internal to Defold’s IDE, it crashes, informing me that it’s not compatible with 5.1.

It builds if I turn off linting (as suggested for other 5.2 problems).

Considering that the HTML5 build appears to be crashing on the :: notation, it seems like the issue is somehow to do with 5.1 vs. 5.2?

---

<div class="post-metadata">

**Author:** ![Jowlfleas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/jowlfleas/32/34330_2.png) [@Jowlfleas](https://forum.defold.com/u/Jowlfleas)\
**Post date:** [January 22, 2025, 8:50pm UTC](https://forum.defold.com/t/defold-typewriter/72078/12 "2025-01-22T20:50:35Z")

</div>

Looks like this is a known issue, based on this discussion? HTML5 builds use Lua 5.1 AFAICT and so your code won’t work w/ them?

Am I getting this right?

> [@GOTO not working on html5 (SOLVED)](https://forum.defold.com/t/goto-not-working-on-html5-solved/2074/20):
>
> It’s isolated and built per platform. See the packages folder of the repo. LuaJIT is widely accepted as the Lua version to use in games. We use Lua JIT 2.10-beta with support for arm 64. The openresty version has diverged even more from Lua 5.1 so I don’t really see it as a viable option for Defold. Fengari is a reimplementation of Lua 5.3 in JavaScript. It’s not really an option and I don’t see how it could work with native extensions for instance.
