Picking up where you left off.

Is there a way to puck up where you left off in the game if you leave the session? If not, is there a way to move to a specific room if you input text into the text field?


You need to SAVE the game, by typing in that word.
If you're using the Quest app (which is the best experience), then you simply go back to your game afterwards and LOAD.
If you're using the website to play in your browser, then go to the game listing. Underneath the description and above the comments, the play button will have been replaced by two others - restart and resume.

If you clear your cookies / saved data, make sure to ignore textadventures.co.uk, or you'll LOSE that data. This of course isn't a problem if you use the Quest app.


you are the best! Do you possibly know how to use the typewriter function and have a pause between line break in gamebook? Im having some troubles getting it to work correctly. I would like typewriter effect to print all of line 1 before it starts line 2, and once line 2 is finished start line 3.

Line 1
Line 2
Line 3.


The typewriter text is a little flaky. A while back I think I posted some updated javascript to change it, but doing that requires using either inituserinterface (not available for gamebooks) or editing InitInterface (not possible on the web editor).

You'll be using javascript, in any case.

You would need to either replace the javascript function $.fn.typewriter, or wait for the previous one to finish before starting (which would be a pain if you're doing it often, but should work)

For example, the code:

TextFX_Typewriter ("Here is some text", 100)

ends up being broken down into:

JS.TextFX.Typewriter("Here is some text", 100, GetCurrentFontFamily(), game.defaultforeground, game.defaultfontsize)

which is a shortcut for:

JS.eval("TextFX.Typewriter(\"Here is some text\", 100, '" + GetCurrentFontFamily() + "', '" + game.defaultforeground + "', " + game.defaultfontsize + ")")

So you could do something like:

JS.eval("TextFX.Typewriter(\"Here is some text\", 100, '" + GetCurrentFontFamily() + "', '" + game.defaultforeground + "', " + game.defaultfontsize + ")")
JS.eval("setTimeout(function () {TextFX.Typewriter(\"And here's a second line\", 100, '" + GetCurrentFontFamily() + "', '" + game.defaultforeground + "', " + game.defaultfontsize + ")}, 1800)")

Which (off the top of my head; there could be a mistake there) should start the second line of text 1.8 seconds after the first. 18 characters in the first message with speed 100 means that the second line starts at about the same time the first ends.

This isn't really a good way to do it; it's probably better to replace the typewriter function with one that waits for the previous line to finish. But if you're only doing this a few times, working out the time delay shouldn't be too much of a problem.

If you're doing a lot of typewriter text, you might want to do something like:

    $.fn.typewriter = function (speed) {
        this.each(function () {
            var $ele = $(this), str = $ele.text(), progress = 0;
            $ele.text('');
            if (window.typewriters && window.typewriters.length) {
                window.typewriters.push({ele: $ele, str: str, speed: speed});
            } else {
                window.typewriters = [{ele: $ele, str: str, speed: speed}];
                var timerFunction = function () {
                    $ele.text(str.substring(0, progress++) + ((progress & 1) && progress < str.length ? '_' : ''));
                    if (progress >= str.length) {
                        clearInterval(timer);
                        window.typewriters.shift();
                        if (window.typewriters.length) {
                            var nextTypewriter = window.typewriters[0];
                            $ele = nextTypewriter.ele;
                            str = nextTypewriter.str;
                            progress = 0;
                            timer = setInterval(timerFunction, nextTypewriter.speed);
                        }
                    }
                };
                var timer = setInterval(timerFunction, speed);
            }
        });
        return this;
    };

Still off the top of my head, but I think it might work. If not, someone can probably spot the bugs.
If you're using the desktop editor, you should be able to put that in a javascript file and include it in your Quest project. I've still not used the desktop editor, so I'm not so sure on the details of how you do that.

Alternatively, this version of the function is compressed and wrapped up in Quest code, so you can use it in a normal game.
You would either have to put it into the User Interface Initialisation script (on the "Advanced Scripts" tab for text adventures), edit it into the function InitInterface (only possible on the desktop editor), or make sure that if the player loads a saved game, this is run before using the typewriter:

JS.eval("$.fn.typewriter=function(a){return this.each(function(){var b=$(this),c=b.text(),d=0;if(b.text(""),window.typewriters&&window.typewriters.length)window.typewriters.push({ele:b,str:c,speed:a});else{window.typewriters=[{ele:b,str:c,speed:a}];var e=function(){if(b.text(c.substring(0,d++)+(1&d&&d<c.length?"_":"")),d>=c.length&&(clearInterval(f),window.typewriters.shift(),window.typewriters.length)){var a=window.typewriters[0];b=a.ele,c=a.str,d=0,f=setInterval(e,a.speed)}},f=setInterval(e,a)}}),this};")

Thank you mrangel I will have to play with this tonight. My game (Gamebook) is centered around a sort of linux terminal so I will be using a lot of the typewriter function. It looks to be a pain but I think I might be able to figure it out. My last question for now is if there is a way to use the get input from player, and only continue if what they type in is correct?


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

Support

Forums