//Put HELP in an iframe
findCmd("MetaHelp").script = function(){
msg("<iframe style='width:75%' class='helpDiv'/>");
setTimeout(function(){
$('.helpDiv:last-child').contents().find('body').html(processText(settings.helpMsg));
}, 500);
};
Hello!
function setUpHelpDialog(){
var dia = `<div id="dialog_window_1" class="dialog_window" `+
`title="Help" style="display:none;"><p id="page0" style="display:none">Welcome to <i>UI Example</i> help system. Click the buttons at the bottom`+
` to see different stuff!</p><p id="page1" style="display:none;">Click on an object or person in the lists`+
` on the right to see what actions you can perform with them.<br/><br/>If you are reading this, you probably`+
` already found the <i>HELP</i> command, with <i>LOOK</i> and <i>WAIT</i>.</p><p id="page2" `+
`style="display:none;">Just try clicking stuff. Seriously, how hard can it be?</p>`+
`<p id="page3" style="display:none;">Created by The Pixie.<br/><br/>Thanks to Alex Warren for creating Quest,`+
` and to members of the forum for various bits of code, in particular The Pixie for this interface stuff `+
`(bits of which originate with Jay Nabonne).<br/><br/>Feel free to use and abuse this in your own games!`+
`</p></div><script>function setPage(page) {$('#page0').css('display', 'none');`+
`$('#page1').css('display', 'none');$('#page2').css('display', 'none');`+
`$('#page3').css('display', 'none');`+
`$('#page' + page).css('display', 'block');};`+
`$(document).ready(function () {`+
`$('#dialog_window_1').dialog({`+
`autoOpen: false,height: 400,width: 640,buttons: {"Intro": function() { setPage(0);}`+
`,"Commands": function() { setPage(1);}, `+
`"Hints": function() { setPage(2);}, "Credits": function() { setPage(3);}, "Done": `+
`function() { $(this).dialog("close");} }});});</script>`
$("body").append(dia)
$("#page0").show()
}
function openHelpDialog(){
$("#dialog_window_1").dialog("open")
}
function closeHelpDialog(){
$("#dialog_window_1").dialog("close")
}
function setHelpPageZero(s){
$("#page0").text(s)
}
function setHelpPageOne(s){
$("#page1").text(s)
}
function setHelpPageTwo(s){
$("#page2").text(s)
}
function setHelpPageThree(s){
$("#page3").text(s)
}
I just haven't implemented it yet.
I stole this from these threads (but I was involved in some of them):
https://textadventures.co.uk/forum/samples/topic/5111/how-to-modify-the-user-interface#top
https://textadventures.co.uk/forum/quest/topic/yk6mhadniums1r4cfnpnbg/help-pop-up-window
http://textadventures.co.uk/forum/quest/topic/zuv9rkcnwe6ybavxd8htkg/help-dialog-box-revisited
* The last link has the code I've currently got in the game.
I suggest you create an issue on Github to creator to adding in QuestJS. It needs to get the text from language file. :)
Maybe adding an option : true / false to define if we want the popup or not.
I suggest you create an issue on Github to creator to adding in QuestJS. It needs to get the text from language file. :)
Oh, The Pixie is keeping an eye on this thread. I promise.
...and that is Pixie's code from an old thread, anyway.
Plus, I'd rather not create too many issues on GitHub unless they are actual bugs (or issues). I use this thread for suggestions and mods and such.
Maybe adding an option : true / false to define if we want the popup or not.
That's a good idea.
Maybe an option to add the option, though. I'd rather mine just pop up. The player would have to do the same amount of work to close it as they would answering "yes" or "no" when prompted if they want it to pop up.
<sarcasm>
Automatically popping it up might frustrate the player, but frustrating the player is what text adventures are all about!</sarcasm>