Hi, welcome!
Firstly, yeah, I'd like to see a much more comprehensive list of example scripts on the wiki. Lots of useful scripts get posted to the forums and then forgotten because of the extra work that creating an article is. "Read through the plotscripting dictionary" is no longer as good advice as it used to be, as there are a huge number of commands now. And I think the dictionary really needs sections explaining topics like menu item handles, NPC references, the party order, etc. Hmm, I see that the documentation for the menu commands is particularly lacking in details...
If you want to search these forums (and also of course castleparadox.com, which has a decade of useful material) do a
Google search prefixed with "site:slimesalad.com"
Now, menu item handles. A menu item handle is a meaningless number that refers to a specific item in a specific menu. To convert it to the slot number in the menu you want
menu item true slot ("menu item slot" gives you a slot number that depends on which items are visible due to tags, so often best to avoid).
You also want a while loop to continually update to the right textbox. But you don't want to call 'show textbox' every tick either! See the script.
And make sure that the "Allow gameplay & scripts" menu bit is on for menu 1, otherwise the script will pause until the menu is gone.
Finally be warned that interaction between textboxes and menus is a bit odd in places; there are unfixed bugs and missing features around this. If you have a textbox and a menu open at once, pressing enter will close the textbox, and pressing Esc closes the menu. So I had to add some more complication to the script for this. It probably still won't work right in all circumstances, so just ask! What you are asking for is unforunately much more complicated than it should be.
Code: Select all
plotscript, first town, begin
suspend player
suspend box advance # prevent the player from closing the text boxes
show backdrop(0)
variable (menu, prev slot, slot)
menu := open menu(1, false)
prev slot := -1
while (menu is open(menu)) do (
if (top menu == menu) then (
# Future proofing: if another menu is openned on top of this one, the script stops updating
slot := menu item true slot (selected menu item)
if (slot <> prev slot) then (
# Continually calling 'show text box' will prevent the line-by-line display of the textbox from ever finishing
if (slot == 0) then (
show text box(1)
) else (if (slot == 1) then ( # After Beelzebufo is released, you can use 'else if' instead
show text box(2)
) else (if (slot == 2) then (
show text box(3)
)))
)
prev slot := slot
)
wait
)
# If the player presses Esc to close the menu, close the box too
advance text box
resume player
resume box advance
end
As for the yes-no option: well, that's difficult. You can't use textbox choice boxes, because you can't control them with scripts in order to make the left+right keys control them. But you can't use two menus open at once either, because only one menu at a time is active, and the others don't highlight their current selection. So either you could show the yes/no prompt after you press Enter, or you need to script something with slices.