Using Unscramble & Typewritter with the Text Processor?

Greetings there!

This is more a thing i stumbled across out of curiosity/boredom, but i found the two TextFX script commands interesting.

However, their usefullness seems to be grossly limited by the fact they can only output plain text. No commands, no {random:}, not even italics or bold text. Or line breaks...

Has anyone ever put effort into tweaking this? In a way that would for example allow me to output a dialogue using typewritter? Probably even makes it possible to output this way in the middle of a page?

Also, is it possible to make the game wait till the output is finished?

And why can't you make a TextFX_Unscramble set to reveal 0 characters at a time to get a permanently shifting text?

I know these functionalities might be nichy, but if anyone knows something, i'd be glad to be helped.

Text processor commands are run when you call the ProcessText() function on a string.

msg() does this automatically, but some other functions don't. If you want to use the text processor with them, you need to call ProcessText() yourself.

The problem with making the game wait until the text animation has finished is that Quest sends the text to the browser, and the animation is done using Javascript. You could do it using more javascript, but it would probably be very inefficient. the best way would be to start a new section after the FX, and hide it until the FX has finished.

"And why can't you make a TextFX_Unscramble set to reveal 0 characters at a time to get a permanently shifting text?"
You can:
TextFX_Unscramble ("This is a secret message! " , 200, 0)
Just set the Reveal to expression 0 characters at a time...
I guess, if you set the random text first, then passed that to the TextFX_ function, it may work.
(Maybe for commands as well... checking now...)

M="This is a test... 1,2,3... " + DiceRoll("1d100")
TextFX_Typewriter (M, 200)
TextFX_Unscramble (M , 200, 1)

But, for a command IN a string???

Thanks for the replies.

DarkLizerd, you're right, your example works... But setting them to 0 with the graphic interface doesn't works? Or i just missed something when testing and should be emberassed now.

Regarding ProcessText(), i think i'm not using it correctly. When i use it, it returns plain strings bare of any markup/scripting, just like if someone copy'n'pasted it in there. Or it throws up an error (which interestingly has working command links).

Is there a way to make the TextFX scripts automatically run ProcessText() just like msg() does? Probably by directly editing the function? Afterall, i can't see how this would harm as a default.

Also, i figured out that making the game just wait a set amount of time before proceeding to the next step is the easiest method of syncing FXs. Afterall you can just multiply the ms per character with the number of characters + X.

I guess that if you want to show of, you could also use LengthOf() in an expression, but that's to convoluted for my taste.

When i use it, it returns plain strings bare of any markup/scripting

Not sure what you mean there. If you're using random (as in your original question), it should work fine.

If you're using text processor directives that generate HTML markup, it probably won't work because I think the FX functions operate on a text string, not an HTML string. Making them work with HTML would make those functions a lot more complex.

Ah, yeah, random works.

Well, as i said, it is like someone copy'n'pasted it, meaning that all markup is gone. This is especially true when i want to put {command:} or {page:}.

So, seems like i can't use coloured text or clickables in there, darn.

Yeah. You'd have to rewrite the FX functions, because they currently deal with the text one character at a time. Andthose text processor directives output HTML, which would become invalid if you add part of a tag, so it's just stripped.

You'd need to have the FX functions operate recursively, descending into HTML elements inside the one they're operating on. I think I can see how I'd structure it, but that's quite a complex mass of code.

Thanks for the input.

No need to get into anything to advanced and gimmicky, this was primarily something i started messing with out of curiosity.

Atleast you can get the text coloured by calling SetForegroundColour () before and after the TextFX, although it means you can't have coloured words in-line. (I was thinking of some RPG-esque way of marking important persons/things.)

Alt plan...
Is there a way to delete a line of text and replace it with a new line???
This is line 1
This is line 2
This line 3 is being decoded
(Delete line 3, replace with)
This line Link text is a replacement.
Short of a clear screen and re-print...

Is there a way to delete a line of text and replace it with a new line???


    $.fn.typewriter = function (speed) {
        this.each(function () {
            var $ele = $(this), str = $ele.text(), fullstr = $ele.html(), progress = 0;
            var timer = setInterval(function () {
                $ele.text(str.substring(0, progress++) + ((progress & 1) && progress < str.length ? '_' : ''));
                if (progress >= str.length) {clearInterval(timer); $ele.html(fullstr);}
            }, speed);
        return this;

Modified from the default typewriter code. Takes two copies of the element';s contents; a plain-text one in the JS variable str, to display one character at a time, and the HTML in the JS variable fullstr, to replace it with once the entire string has displayed.

Typing on my phone, so haven't tested it yet. But putting this chunk of javascript in your game might make the typewriter function behave nicely with formatting and HTML (even if it doesn't format text until it's finished)

This topic is now closed. Topics are closed after 60 days of inactivity.