Text in window prompt type window (or whatever they're called) OR opening a popup without clicking?

CheeseMyBaby
14 May 2018, 19:56

I want my help 'area' to be within a separate window.
I get the type of window I want by:

1.

show menu ("Game help", Split("Interface;Commands;Gameplay;Credits",";"), true) {
  player.option_thing = result
  switch (result) {
    case ("Gameplay") {
      msg ("gameplay information goes here.")
    }
  } // etc etc etc
}

(Thanks KV for this!)

The thing is: When I select gameplay(or whatever) I want that text to be displayed in the same (or one just like it) window, instead of being printed in the game area.

(I like to keep my game in one place and I'm generally against popups but in a parser game I feel the "help text" is too intrusive when it takes place right there amongst the story)



2.


If this (above) is not doable I wonder if it's possible to trigger a popup by choosing from the choices within the show menu script?


K.V.
14 May 2018, 20:51

Oh, you're going to like this!!!

https://textadventures.co.uk/forum/quest/topic/yk6mhadniums1r4cfnpnbg/help-pop-up-window


Be warned: You will be playing with this for HOURS!


And here is a link to some documentation concerning dialog popups:
http://docs.textadventures.co.uk/quest/ui-dialogue.html


K.V.
14 May 2018, 21:06

I wonder if it's possible to trigger a popup by choosing from the choices within the show menu script?

What'chu talkin' 'bout, Willis?

Just a normal popup, with an 'Okay' button?

if (result = "whatever"){
  JS.alert("BLAH, BLAH, BLAH!")
}

OR

switch (result){
  // ...
  case("whatever"){
    JS.alert("BLAH, BLAH, BLAH!")
  }
  // ...
}

CheeseMyBaby
15 May 2018, 06:58

Just a normal popup, with an 'Okay' button?

if (result = "whatever"){
JS.alert("BLAH, BLAH, BLAH!")
}

Actually this is exactly what I was looking for!!!

Edit:
Question: Do you know if it's possible to change "JavaScript Alert - res://local" to something more descriptive?

Either way; thaaaaaaahahahahahaaaanks...!!!!

Edit2: ... and possibly if there's a way to format the text within the popup?

:)


K.V.
15 May 2018, 12:31

Simple version:

http://textadventures.co.uk/forum/samples/topic/awxso7qzhk6vws2c5vtt1a/custom-alert


K.V.
15 May 2018, 12:53

Javascript functions (these will be included in Quest 5.8):

function showPopup(title, text) {
    $('#msgboxCaption').html(text);

    var msgboxOptions = {
        modal: true,
        autoOpen: false,
        title: title,
        buttons: [
			{
			    text: 'OK',
			    click: function () { $(this).dialog('close'); }
			},
        ],
        closeOnEscape: false,
    };

    $('#msgbox').dialog(msgboxOptions);
    $('#msgbox').dialog('open');
};
function showPopupCustomSize(title, text, width, height) {
    $('#msgboxCaption').html(text);

    var msgboxOptions = {
        modal: true,
        autoOpen: false,
        title: title,
        width: width,
        height: height,
        buttons: [
			{
			    text: 'OK',
			    click: function () { $(this).dialog('close'); }
			},
        ],
        closeOnEscape: false,
    };

    $('#msgbox').dialog(msgboxOptions);
    $('#msgbox').dialog('open');
};
function showPopupFullscreen(title, text) {
    $('#msgboxCaption').html(text);

    var msgboxOptions = {
        modal: true,
        autoOpen: false,
        title: title,
        width: $(window).width(),
        height: $(window).height(),
        buttons: [
			{
			    text: 'OK',
			    click: function () { $(this).dialog('close'); }
			},
        ],
        closeOnEscape: false,
    };

    $('#msgbox').dialog(msgboxOptions);
    $('#msgbox').dialog('open');
};


Example:

JS.showPopup("This is the popup title!", "This is what gets displayed!")

image


CheeseMyBaby
15 May 2018, 17:17

Well that is nice indeed.
The good thing is that since I've CCS'ed everything it's already formatted and done.
Thanks!


K.V.
15 May 2018, 20:03

Rock and roll!