[messages] Edit: [Developers] Re: question about delete and order

Michael Kiefte mkiefte at dal.ca
Thu Jul 29 06:34:45 MST 2010


> In each those four different entry points, which of the 34 traits are
> involved?


It doesn't matter which entry point. And almost all of them are involved
depending on the keystroke.


> For a particular entry point, and the traits that are
> involved in that entry point, in which order are the traits executed?
>

If you're looking at the list of traits in the editor, it goes from bottom
up.  There are some exceptions, however.  Triggers are always done last and
I believe that Reports are done last.


>
> Not knowing the answer to these questions makes it hard to program in
> VASSAL.  It sounds like you are recommending determining the answer to
> my question by trial and error, "learn by building modules".


Experience is invaluable.  Also looking at other people's examples.


>
> From what I've seen working with it so far, I get the sense there are
> two distinct pathways through a piece.  If the entry point is mouse
> clicking (selecting), then it behaves in the way described in that post
> you sent me.  If, however, the entry point is a keystroke, then I get
> the sense a completely different set of rules apply.
>

There is no difference.


>
> You mention TriggerAction and ReportAction as being exceptions, but I
> count at least 9 different traits that listen for keystrokes.


Actually, almost all of them do.  Off the top of my head, I can't think of
one that doesn't.


> Some of
> those determine whether a keystroke makes it to another trait, and in
> those cases order could matter (or it could be that those "Restrict"
> type traits apply to all other traits in the piece irrespective of
> order).  From trial and error, so far I've determined that ReportAction
> and GlobalKeyAction both fire before Delete actions, but TriggerActions
> fire after delete actions.


Triggers are usually fired last.  All the others are triggered from the
bottommost in the list to the topmost in that order.


> This suggests that there is a list.  A list
> that determines the order in which key listening traits fire when there
> are multiple traits on the same piece listening for the same keystroke. I
> confirmed that Delete happens before TriggerAction by moving the
> Delete above TriggerAction and then below TriggerAction and in both
> cases the Delete prevented the TriggerAction.


Triggers are an exception to the rule.


> But when I removed the
> Delete alltogether, then the TriggerAction happened.  Why did Delete
> take precedence over TriggerAction in this case?  Why is Delete higher
> than TriggerAction on the list?  ("The list" being the order in which
> key-based traits are executed when multiple traits on a single piece
> listen for the same key.)
>

Trigger is last.  This is because it waits for the state of the change to be
finalized before checking whether the trigger can be fired.

Hope this helps.

- M.


>
> I hope that this clarifies my question.  I am probably making a number
> of mistakes in the way I formulate my question because I am still
> learning how VASSAL works.  I look forward to further enlightenment.
>
> _______________________________________________
> Read this topic online here:
> http://www.vassalengine.org/forum/viewtopic.php?p=18944#p18944
> _______________________________________________
> messages mailing list
> messages at vassalengine.org
> http://www.vassalengine.org/mailman/listinfo/messages
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vassalengine.org/pipermail/messages/attachments/20100729/ec8115b5/attachment-0001.html>


More information about the messages mailing list