Chat-Simulation for LiaScript: Bring Dialogues to Life in Your Course

Chat-Simulation for LiaScript: Bring Dialogues to Life in Your Course

Sometimes the most effective way to present information is not as a list or an explanation, but as a conversation. The Chat-Simulation template lets you embed animated chat dialogues directly in your LiaScript course — complete with typing indicators, speech bubbles, and support for full Markdown and LiaScript elements inside every message.

A simple JSON array of participants and messages is all you need. No server, no external service, no configuration beyond a single import line.


What is @CHAT?

The @CHAT macro renders a JSON array of {name, message} objects as a live chat window. Messages appear one by one with a simulated typing delay, just like a real chat.

The first participant is always aligned to the left (the “main” voice). All other participants appear on the right. You can have as many participants as you like — they are distinguished by name and color automatically.

Messages support:

  • Standard Markdown (bold, italic, links, lists)
  • LaTeX math ($...$ and $$...$$)
  • LiaScript multimedia — images, videos, audio, even embedded charts

This makes the template useful far beyond simple role-play scenarios. You can embed a full Socratic dialogue about a mathematical topic, with formulas, visualizations, and video references, presented entirely as a chat exchange.


Quick Start

Add this import line to your course header:

<!--
import: https://raw.githubusercontent.com/LiaTemplates/Chat-Simulation/main/README.md
-->

For a version-stable import (recommended for published courses):

<!--
import: https://raw.githubusercontent.com/LiaTemplates/Chat-Simulation/0.0.1/README.md
-->

That’s it — the @CHAT macro is now available throughout your document.


Basic Conversation

Here is a minimal example: two students discussing what LiaScript is.

``` javascript @CHAT
[
  { "name": "Alice", "message": "Have you tried LiaScript yet?" },
  { "name": "Bob",   "message": "Not yet — what is it exactly?" },
  { "name": "Alice", "message": "It's a Markdown extension that turns plain text into **interactive courses** — quizzes, code, animations, all in the browser." },
  { "name": "Bob",   "message": "So no LMS required?" },
  { "name": "Alice", "message": "Exactly. You write in a `.md` file, share a link, and anyone can open it — even offline. 🎉" }
]
```

Try it live:


Multi-Participant Chats

There is no limit on the number of participants. The first name in the array is always the “main” voice (left side). All others appear on the right, labeled by name.

``` javascript @CHAT
[
  { "name": "Tutor",   "message": "Good morning everyone! Today's topic: **version control with Git**." },
  { "name": "Maria",   "message": "I always mix up `merge` and `rebase` 😅" },
  { "name": "Jonas",   "message": "Same — what's the actual difference?" },
  { "name": "Tutor",   "message": "`merge` preserves history as-is and adds a merge commit. `rebase` rewrites commits onto the target branch — cleaner log, but rewrites history." },
  { "name": "Maria",   "message": "So `rebase` is risky on shared branches?" },
  { "name": "Tutor",   "message": "Exactly. Golden rule: **never rebase a branch others are working on.**" },
  { "name": "Jonas",   "message": "Got it. `merge` for public branches, `rebase` for local cleanup. ✅" }
]
```

Rich Content in Messages

Because LiaScript processes the message field as HTML with Markdown support, you can embed nearly anything — math formulas, images, videos, even inline charts.

A message with LaTeX:

{ "name": "Maya", "message": "The vertex form is $f(x) = (x-2)^2 - 1$, so the minimum is at $S(2 \\mid -1)$." }

A message with a video link:

{ "name": "Lena", "message": "Found a great explainer: !?[Quadratic functions](https://www.youtube.com/watch?v=B_PtpvhnNg0)" }

A message with an image:

{ "name": "Tom", "message": "Here's the parabola: ![Parabola sketch](https://upload.wikimedia.org/wikipedia/commons/b/b9/Parabeln-var-s.svg)" }

This means you can use Chat-Simulation not just for simple dialogues, but for annotated worked examples, peer discussion reconstructions, and case study walkthroughs where domain content lives inside the conversation.


Full Template Demo

The full Chat-Simulation README is itself a self-documenting LiaScript course — explore all features live:


Use Cases

Language learning — Present a dialogue between native speakers. Students follow the conversation and encounter vocabulary, idioms, and sentence structures in context. Combine with audio links or pronunciation guides inside the messages.

Social and ethical scenarios — Simulate a conversation around a dilemma, a historical debate, or a professional situation. Learners observe different perspectives before reflecting or deciding.

Peer learning and Socratic dialogue — Reconstruct how a concept is worked out step by step through questioning. Formulas, sketches, and references appear naturally inside the chat flow.

Onboarding and process walkthroughs — Walk new team members or students through a process as a simulated support chat, with links and screenshots embedded in the messages.

Case studies — Present a client-consultant or doctor-patient exchange as context for a case-based learning activity. The simulated conversation sets the scene before a quiz or reflection task follows.


Technical Facts

Runs in browserYes — no server, no backend
External APINo
ParticipantsAny number; first = left (main), others = right
Message formatJSON array of {name, message} objects
Markdown supportYes — bold, italic, links, math, multimedia
LiaScript elementsYes — charts, videos, images, formulas
Typing animationYes — animated indicator with randomised delays
Offline capableAfter first load (assets cached)
LicenseMIT
MaintainedYes (latest version 0.0.1, active)
Version-stable importYes (0.0.1 tag available)

Try It

Try in LiaScript Open in LiveEditor View on GitHub

Related Posts

DragAndDrop Template for LiaScript: Order and Multiple-Choice Drag Quizzes

Build drag-and-drop quizzes in LiaScript with the DragAndDrop template — sortable order exercises and pool-based multiple-choice selection, both graded automatically.

Read More

SpreadSheet for LiaScript: Excel-Style Interactive Tables in Your Course

Embed fully interactive spreadsheets with formulas, dropdowns, checkboxes, and multiple worksheets directly in LiaScript — powered by JSSpreadsheet, no backend required.

Read More

TextAnalysis for LiaScript: Readability Scores and Text Complexity Metrics

Analyze text readability in LiaScript using the TextAnalysis template — compute Flesch-Kincaid grade, Gunning Fog, SMOG, reading/speaking time, and more, with inline interpretation tables.

Read More