Topic: Automatic Text Display

PunBB bbcode test

Here's an example for automatic text displaying, there's three levels :

1) Simple text typing
It will start displaying text when you launch the scene, nothing fancy

2) IOread example
Will read text in an external text file when you press 1 or 2 or 3 or 4
WARNING, you must edit the script IOread.lua and set the correct path for the .txt file

3) Text Input
Press any keyboard letter to write text (only letters, space, backspace and delete)
It will switch to a new line when you entered 15 characters

• Project : TextDisplay
• Lua script only (Simple) : SimpleText
• Lua script only (IOread) : IOread
• Lua script only (Text Input) : TextInput

ps. the text displayed doesnt make sense, i was just on a chiptune site then copied random lines

Feel free to edit/improve smile

Re: Automatic Text Display

Cool!!! Thanks Vegas!

Re: Automatic Text Display

No problem smile got some more stuff coming, just need time to make the scripts
less ridiculous, that's the major difficulty to me tongue

Re: Automatic Text Display

I moved some stuff around in the automatic text display script to make it more dynamic to use, but I still am struggling to understand what string.sub does in layman terms, or even what those lines of code does, its a very light script (thanks for that) but that part gets me.

--This is a text object
Text0 = getObject("Text0")

--This is a text object
Info = getObject("Info")

--time variable
t = 0

--initialize counter variable
count = 0

--Text you want printed
-- \n is to switch line
SampleText = "MOS Technology SID" .. 
"\nGeneral Instrument AY-3-8910" ..
"\nAnalog-digital hybrid Atari POKEY" ..
"\nYamaha YM2149 on the Atari ST"

--Alternate text that can be displayed
myText = "Welcome to the Renderer"

function TypeText(text_name)
    setText(Text0, T1text)
    
    --increment timer
    t = t + 1
    
    -- Change 5 to a different value to increase or decrease typing speed
    if t == 5 then
        count = count + 1
        t = 0
    end
    
    -- it's that string.sub thing who's writing letter one by one
    for i=1, count do T1text = string.sub (text_name, 1, 0+i) end
    
    -- Stop counting when we are at the end of the line
    if count == string.len(text_name) then t = 0 end
    
    Infotext = "Line Lenght :: " .. count
    setText(Info, Infotext) 
end


function onSceneUpdate()

    TypeText(myText)

end

Oops, I re-read your initial post, I guess you had a time trying to figure out how it works too. hehe.

Last edited by Tutorial Doctor (2014-02-10 05:32:28)

Re: Automatic Text Display

Basically the first example works as follow :
PunBB bbcode test
The red rectangle represent what will be displayed on screen

here's for stringsub info : http://www.gammon.com.au/scripts/doc.php?lua=string.sub

By the way i updated the post, added another level in the example

Re: Automatic Text Display

I started a thread called "Code Snippets" I wonder if I should put my snippets on the wiki. That way, if people want a certain effect, they can just grab the code from there. These scripts would be nice as little snippets too.

Re: Automatic Text Display

I just tried out the text input script. THANK YOU SO MUCH! These scripts will come in so handy. I might be able to find a way to make the text delete when you press a key (put them into an array?)

Last edited by Tutorial Doctor (2014-02-10 15:52:06)

Re: Automatic Text Display

I started a thread called "Code Snippets" I wonder if I should put my snippets on the wiki

Sure, the snippet section on the wiki is quite empty, plus your formatting perfectly matches the wiki style wink

I just tried out the text input script. THANK YOU SO MUCH! These scripts will come in so handy. I might be able to find a way to make the text delete when you press a key (put them into an array?)

np smile

Edit : I've done the backspace, updated the post

Re: Automatic Text Display

You are TOO cool. haha. You added backspace and delete. nice.

Re: Automatic Text Display

I just did something really catchy with your text display script. I put in my own text and put a voice narrator with it. I also add some ominous background music. It looks cool. I just need to add a background.

Re: Automatic Text Display

I realized I still had a Box account that I could upload stuff to. Here is the project file for the narration I did using your text display script. Right now it works best in fullscreen until I use the EnableCameraLayer() function to make it work better.

https://app.box.com/s/g45efbwrf53lnz09rjcf

Re: Automatic Text Display

Tutorial Doctor wrote:

I realized I still had a Box account that I could upload stuff to. Here is the project file for the narration I did using your text display script. Right now it works best in fullscreen until I use the EnableCameraLayer() function to make it work better.

https://app.box.com/s/g45efbwrf53lnz09rjcf

Curious, where on earth did you find a voice narrator ? wink)

thx
vd

Re: Automatic Text Display

Hehe. That is actually a text-to-speech software called Speak It (for iPad)

Last edited by Tutorial Doctor (2014-03-25 20:12:39)

Re: Automatic Text Display

Pretty nice, the voice is better than expected (i tried some text 2 speech apps on my side, it was awful)