WoW-Like Quest Text v2.1

This bundle is marked as high quality. It exceeds standards and is highly desirable.
Overview

A simple, light-weight system to create a pretty text for an RPG that softly fades in as it is being written, similar to the quest texts in World of Warcraft when Instant Quest Text is disabled. Can also be used for dialog or exposition text, of course.

You can define text windows attached to any parent frame, so if you have a quest or dialog menu, you can use WoW-Like Quest Text to write text into their text fields.

Installation

Copy the QuestText script and its requirements into your map. These are:
Make sure TotalInitialization is above the other scripts in your map script.

Getting Started

Create a text window with QuestText.CreateWindow as laid out in the API section. If you don't know what to use a the parent frame, use BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0). Save the window to a variable. Then do QuestText.New to write a text into that window.
Contents

WoW QuestText (Map)

WoW QuestText (Binary)

Reviews
Wrda
I already can imagine the deep and dark stories just from this animated text, thirst for lore. There's that whichWindow or windows[1] repetition but it is no concern. High Quality
Major update:
  • Integrated Frame Recycler so that the unsafe BlzDestroyFrame function isn't used.
  • You now define text windows and write the text into those windows. If you have your own UI system. you can use one of the frames as the parent and the quest text will be written into the parent's text field, be hidden when the parent is hidden etc. Each window can hold up to one text. The texts can be displayed asynchronously.
  • Integrated ALICE / MINACE so that all functions can easily be called asynchronously.
 
Updated to Version 2.1
  • Fixed scaling and kerning issues when setting the font size to large values.
  • Added the optional kerning parameter for text windows.
  • The entire text is now allocated on creation. This allows the QuestText.New function to return the required height of the text window.
 
Lua:
    self.length = text:len()

    local char
    local beginningOfWord = 0
    for i = 1, self.length do
        char = text:sub(i, i)
        if char == " " or char == "\n" then
            self.words[#self.words + 1] = text:sub(beginningOfWord, i-1):gsub("\n", "")
            beginningOfWord = i
        elseif i == self.length then
            self.words[#self.words + 1] = text:sub(beginningOfWord, i):gsub("\n", "")
        end
    end


It seems like this approach will only work correctly for strings composed of single-byte characters. If the text string contains multi-byte characters (e.g., characters from non-Latin alphabets), string.sub() and string.len() will produce unexpected results because they operate on bytes, not characters. Also, since the loop iterates byte-by-byte (for i = 1, self.length do), multi-byte characters will be split into separate bytes rather than whole characters.
 
Last edited:
Just curious if Alice is only available for LUA-based maps, how can I use a system like this for my vJass map if at all? (asking since MINACE is a dependency here)
Edit: Nvm just realized this is all LUA, so guessing there's no way to use this with JASS maps without converting them first

So if possible, a JASS version would be something I would totally use in my map. :thumbs_up:
 
ALICE is not really necessary for this system. It just makes handling the callbacks easier. If you remove it as a dependency, you just have to replace it with regular timers and be careful about not creating timers asynchronously.

Sorry, I did't notice I still said I would do a JASS version in the description. I don't want to do this at this time - at least not alone. Like I said, you can give it a try and I will help out where I can.
 
Level 19
Joined
Oct 17, 2012
Messages
859
Positioning the text is somewhat tedious. I am trying to place the text in the center of the screen, but I can't get it just right after playing so long with numbers.
Lua:
        local frame = BlzCreateFrameByType("BACKDROP", "", 
                                           BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0),
                                           "", 0)
        BlzFrameSetAbsPoint(frame, FRAMEPOINT_CENTER, 0.4, 0.3)
        BlzFrameSetSize(frame, 0.3, 0.3)
        BlzFrameSetTexture(frame, "ReplaceableTextures\\CameraMasks\\Black_mask.blp", 0, true)
        local mainWindow = QuestText.CreateWindow({
            parent = frame,
            yBottom = 0 - 0.1,
            xLeft = 0 - 0.005,
            yTop = 0 - 0.05,
            xRight = 0 + 0.1,
            isAbsolute = false,
            isAsync = true,
            maxCharacters = 1000,
            fontSize = 60,
            lineSpacing = 0.3,--0.012,
            writeSpeed = 10,
            fadeInTime = 0.6,
        })
        QuestText.New("Eternal Odyssey", mainWindow, Player(0))
 
Top