I'm making a bestiary menu for my game with enemy info, here's a quick mockup I did to test the script.
However in order to have the text box show immediately instead of after the main menu closes, I had to enable the "Allow gameplay & scripts" bitset which allows for NPCs and other scripts to continue running. Thing is, this isn't normal menu behavior and I'd really like to not have to do that. And what I need to do is run a script based off of the selected menu item's extra data to put some string sprintf stuff together, before then displaying a text box. So I can't just display a text box and still have the data ready to show.
Any suggestions on how to get around this? Also, ideally I'd like to have a two part menu where one menu is where the player selects a monster's name, and a separate box instantly updates with the enemy info when another enemy is selected. Is there any way to do this with menus, or would it need to be built from scratch?
Need to have a menu item run a script and display text
Moderators: marionline, SDHawk
- Bob the Hamster
- Lord of the Slimes
- Posts: 7660
- Joined: Tue Oct 16, 2007 2:34 pm
- Location: Hamster Republic (Ontario Enclave)
- Contact:
It's unavoidable that you need to use a script to update the display, so you need the "Allow gameplay & scripts" bitset. Then suspend everything else: the player, NPCs, timers.
Unfortunately there's no command to stop NPCs/heroes in midstep. Tihis certainly isn't the first time I've seen the need for a "suspend walkabouts" (or "suspend movement"?) command. Hmm, a "suspend tile animation" command would be good too.
If you want the info to update immediately, then you should use a text slice instead of a textbox, because the textbox rolls in a line at a time, and the embed codes are expanded when the textbox is opened, not every tick after that. Actually, both are things I really want to change... Oh great. Now I've started working on it.
Anyway, to make the textbox/text slice update continuously is straightforward:
Unfortunately there's no command to stop NPCs/heroes in midstep. Tihis certainly isn't the first time I've seen the need for a "suspend walkabouts" (or "suspend movement"?) command. Hmm, a "suspend tile animation" command would be good too.
If you want the info to update immediately, then you should use a text slice instead of a textbox, because the textbox rolls in a line at a time, and the embed codes are expanded when the textbox is opened, not every tick after that. Actually, both are things I really want to change... Oh great. Now I've started working on it.
Anyway, to make the textbox/text slice update continuously is straightforward:
Code: Select all
plotscript, bestiary, begin
variable(extra)
while (top menu) do ( # While a menu is open
extra := get menu item extra(selected menu item, 0)
# Update the display...
wait(1)
)
end