08-25-2014, 05:35 PM
Looks like I have really messed things up after adding nesting for
, because
is broken now and I don't really know how to easily fix it. This situation raises some questions I want to discuss.
First, let me explain the problem. I believed that
is something very similar to
, however they are in fact very different.
is safe and neat, because commands from the scene are pushed to stack only when interpreter is ready. However, this is extremevy uninteractive for the same reason. Example: let's say we put something like
inside, and triggered keypress during some looooong movement animation. Alert will appear seconds after keypress, when interpreter is ready to enter the subscene.
is different, it is executed in parallel with the game routine. This is not perfectly safe for that reason, because two stack operations can be done at the same time, two transforms can be casted on the same image, fadeout started for a sound while it is being fadein, etc. This mode may be perfect for very simple zero-time non-interactive stuff like
, for instant layer hiding or for showing something completely unrelated to the game like an options menu of some sort, but it is not that good for allowing user to call just any command from
.
Those two triggers seems to be quite the same, but you would see the difference once you push a button several times not .
And here comes my nested version of
, adding a stackframe to execute the right branch. This behaviour is really nice, i'm very satisfied with things you can do with it (see
for example). This version of
compatible with
, but you can't use it with
.
A possible workaround may be in passing flag of some sort into
to let it know if it is called from trigger by user or from scene by interpreter. To make things even more complicated easier, you can even make two different command implementation lists for triggers and for scenes, with the same functions for stuff like
and with different for
, so that zero-time commands would be executed separately.
And here comes another interesting topic: is any of those two behaviours right? Is it OK to do stuff while other commands is running? Is it OK to do stuff after waiting several seconds for running commands to finish? Let's take a look at
. It triggers next statement after waiting for rinning commands to finish, without cancelling any of them. Recently I have tried converting to WSE a RenPy's game (http://cf.ichan.ru/games/vn/SpeedAddict/www/ , in russian language only), whose author loves to use 4second pauses. This looks like the game is not responding, when you left-click and nothing happens. So you click another time, and another. And after those 4 second wait is finished, some lines become skipped because of multi-clicking. Thi
As a result, I need a way (maybe optional, maybe not) to stop ongoing commands. This automaticly would also give us an interpreter which would be able (after cancelling background tasks) to start a subroutine by trigger both instantly and safe. In this case execute function for triggers can be just rewritten to add another frame to call stack and the old variant may be removed completely (execute may be also used in
, but there is no point to do so, because it is no different from running the commands directly).
Sorry for lots of text, I just thought a lot about it and I really want to hear your opinion on it.
Code:
<with ...>
Code:
tests/move_command
First, let me explain the problem. I believed that
Code:
<trigger ... function="execute">...
Code:
<trigger ... scene="..."/>
Code:
<trigger ... scene="..."/>
Code:
<alert/>
Code:
<trigger ... function="execute">...
Code:
<var .../>
Code:
out.functions.execute.allowedCommands
Those two triggers seems to be quite the same, but you would see the difference once you push a button several times not .
Code:
<trigger name="alert1" event="keyup" key="E" function="execute"><alert /></trigger>
<trigger name="alert2" event="keyup" key="R" scene="alert" />
...
<scene name="alert"><alert /></trigger>
And here comes my nested version of
Code:
<with ...>
Code:
tests/var_choice_commands
Code:
<with ...>
Code:
<scene ...>
Code:
<trigger ... function="execute">...
A possible workaround may be in passing flag of some sort into
Code:
out.commands["with"]
Code:
<var>
Code:
<with>
And here comes another interesting topic: is any of those two behaviours right? Is it OK to do stuff while other commands is running? Is it OK to do stuff after waiting several seconds for running commands to finish? Let's take a look at
Code:
<trigger ... special="next"/>
As a result, I need a way (maybe optional, maybe not) to stop ongoing commands. This automaticly would also give us an interpreter which would be able (after cancelling background tasks) to start a subroutine by trigger both instantly and safe. In this case execute function for triggers can be just rewritten to add another frame to call stack and the old variant may be removed completely (execute may be also used in
Code:
<fn>
Sorry for lots of text, I just thought a lot about it and I really want to hear your opinion on it.