Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

[SugarCube 2.7.2] Creating A Dialog Menu Similar To The Save Menu

Hello,
My terminology is probably off here, but I'm looking to create a 'dialog' popup, similar to that which is displayed when the player clicks the Saves button in the UI Panel, but populated with custom content (passage links). Is this possible without an entirely custom implementation? Thank you for your help.

Comments

  • I suggest you look at the Dialog API, in particular the Dialog.setup method.
  • greyelf wrote: »
    I suggest you look at the Dialog API, in particular the Dialog.setup method.

    This looks great, thank you!
  • You want to look at the Dialog API—in particular, the methods Dialog.setup() and Dialog.open().

    As an example, put something like the following in the StoryMenu special passage to put a link into the story menu (in the UI bar):
    <<click "My Menu Item">>
    	<<script>>
    	var dialog = Dialog.setup("My Dialog Title", "my-dialog-class");
    	new Wikifier(dialog, Story.get("My Dialog Passage Name").processText());
    	Dialog.open();
    	<</script>>
    <</click>>
    
    Hopefully, that all makes sense.

    PS: While specifying a class to Dialog.setup() is optional, doing so allows you to easily style the contents of the dialog if you so desired.
Sign In or Register to comment.