Hi guys, I'm surprised I couldn't find this already to be honest, maybe it's hidden somewhere... Anyway, I don't like to give you too much reading to do, so here goes:
Problem:
When an event shows text and immediately shows choices after it, the text remains visible (it persists until a choice has been made). The problem is when either the text or the choices are within a conditional branch, the text no longer persists (doesn't remain visible with the choices).
Request:
Make the text persistent through conditional branches and (optionally) comments.
Here's an example of how I might use it:
Conditional Branch: Switch[Player_met_person] == OFF Text: "Hi, can I help you?"Else Text: "Hello again, was I not clear?"Branch EndShow Choices: Who are you?, I need directions.... etc. ...In the above example, when the choices appear, the text should still be visible.
I hope it's not too challenging, unfortunately I don't know enough about RGSS3 to figure this one out myself, though I'll probably still try.
It can be done by script call.
if $game_switches[1]$game_variables[1] = "Hi, can I help you?"else$game_variables[1] = "Hello again, was I not clear?"endThen, in message box, you just put
\V[1]And then show the choices. I do not try it yet. But I'm sure it will works
Hope it helps ~
That would be great if this problem came up once or twice, but dozens of times, it just isn't worth it. Thanks, but I would much, much rather a script fix that will make text persistent than have to write this every time the problem arises.
I know why this happens, and I know the work arounds, but I'm still after a script fix for it. I'm sure it's possible, it just takes a bit of know-how with the window classes.
I will continue to look for a fix myself, but I don't know which classes to look in besides window_message.
It's not on the window classes. Look inside Game_Interpreter.
There are two cases that I can think of (probably more but anyway):
Conditionals: You need to know if the conditional "says" true or false and do the check accordingly.
Labels: This is easier, you just need to check the command after the place where the label is pointing to.
Also remember, there are conditionals inside conditionals, and COULD be labels after labels (pretty stupid but yeah why not?). You can make the check inside a loop until it stops getting conditionals (or labels, or whatever else).
Could be fun to do,
Orochii Zouveleki
Actually, you don't need any knowledge of the window classes at all. What you need is a good algorithm for scanning through the event commands and determining whether the text should be shown on its own or with something else. The "is the next line a Show Choices" command needs to be made more clever.
Game_Interpreter is where you need to be looking. Specifically, the command_101 method, which is Show Text. THAT is what currently determines whether the message box has an accompaniment or not.
If I were doing this, I would consider one of two approaches:
1. Make the logic in line 261 more clever - next_event_code looks at the code on the very next line, not taking into account whether it's a command to be run, or a non-executing line like a branch or branch end, or a comment. Consider ALL the times you might want the very next line to be ignored, or what are the valid lines that you DON'T want to be ignored, and add the logic there instead of using next_event_code. This could be tricky, as if the next line was a condition, you would need to evaluate that condition and check what's in the true/false statements to see if either one had a choices list and whether that'd be the one that's going to be executed (and that's just one thing you'd have to fine-tune for).
2. Let the method do everything it's meant to EXCEPT actually show the message. When the next 'real' command runs, see if there's a message to be shown, and if there is, decide whether the command waiting to be run needs to be tacked on to the message, or whether the message should be shown first, then to wait for the message to disappear, THEN run the command.
The first one would be more difficult to implement, but less invasive on the rest of Game_Interpreter. The second one would be easier to implement, and is probably the approach I would be more inclined to attempt.
It's actually a very interesting challenge, and if you really struggle with it, and I can get a decent amount of my own work done this weekend, I might be tempted to experiment a bit myself.
edit: oops - that reply wasn't there when I posted this. Can't believe it took me 20 minutes to type that up! Must have been distracted
I'd set a flag using a comment
Comment: Start Preserve textIf true show text "something"else show text "something else"endComment: End Preserve textshow choices: ...Or something of that nature. While the flag is set, everytime you get a "show text" you would store the text somewhere for later. The actual implementation is up to how you want to script it.This is an easy way to do it and gives event developers full control over it without any strange effects due to unforeseen cases.
I'd rather not try to solve the problems Shaz mentions.
When it comes to something like event commands, I would suggest providing tools that allows you to add functionality with additional markup, rather than modifying existing commands themselves where the only way to disable it is to disable it globally.
But what if you have a few comments before the conditionals? Or if it's a Branch End after the text and not a conditional branch start?
Yeah well, there is a lot of cases in which that scriptlet doesn't works, but a lot of them are pretty easy to implement. For comments, you can just do a @index+=1. For any behaviour command (such as variable operations) you can raise one to the index, then do execute_command (this will execute the command before showing the message).
The most problematic part is managing the indent. When a command changes the indent (conditional branch start/end for example), you need to know what is the indent going to be, if not it will skip the entire branch (it's something that caused me several headaches while I was doing that scriptlet, until I put the @indent+=1 and voilà, everything works!).
I actually love the VXA event commands structure now because of this little exploration <3,
Orochii Zouveleki
I think Tsukihime's toggle persist idea is good, and probably should be implemented as well, but I think if there are just conditional branches and label definitions in the way, it should persist anyway. It seems logical to me.
Muramasa, I will test your script shortly.
Edit: It works when the choices are within a conditional branch, but it doesn't work when the text is in a conditional branch and the choices are below it (which was my original requirement). Any ideas how to include this into your script?
412 - Conditional Branch End
Would this script be worth adding to the Master Script list? Given a header explaining it of course.
If I have a voice on this, I don't mind. Credit to your heart's content, and throw whatever usage conditions you like (best if free for commercial and non-commercial ;D).
Asdf,
OZ
If you want it to be listed in the master script list, then you need to provide it as a properly formatted script in the VX Ace Scripts forum. Not as a response to a help request in a thread. Take a look at the thread that states what format they should be presented in - it's got a template that you can copy and paste and fill-in-the-blanks.
Added script topic.
Well I think this is solved so, thanks for the help everyone.