Create account / Log in

Text labels in 3.2.0: bug or feature?

Discussion area for the development team.

Moderators: uckelman, Tim M

Re: Text labels in 3.2.0: bug or feature?

Postby Tim M » October 10th, 2012, 7:42 pm

for item 4 set a DP to 1 as the first step the button performs and configure the
action button to only work through a trigger that says if the DP = 0 then
execute

This works. Have done it many times

Another way to do it is to immediately destroy the button and replace it with an
identical non clickable button that when placed performs your setup routine and
once complete replaces itself (again) into a functional button (if needed). This
should also prevent 4 from happening



________________________________
From: barbanera
To: messages@vassalengine.org
Sent: Wed, October 10, 2012 2:30:27 PM
Subject: Re: [messages] [Developers] Text labels in 3.2.0: bug or feature?

I looked and noticed the following differences:

1) Your setup takes less than a second while mine takes much longer
(kudos to you!)

2) Your setup doesn't mess with text labels and layers, using report
actions instead

3) Your setup doesn't even bother storing the info that it was started
(it being so fast, I guess)

4) I wonder what would happen if your green, white, red etc players
would all happen to click on setup at the same time though..

I guess your setup happens fast enough not to bother about issue 4.
However, I do have that problem, as my setup takes 20 seconds.. Yes, I
could use report traits to let everybody know the setup is in progress,
but that means trusting everybody to pay close attention and not be
tempted to hit "start game"..
Moreover, it's difficult for me to understand why a layer or text label
will be updated whenever Swing feels up to it, while report traits would
be sent across the network right away..

_______________________________________________
Read this topic online here:
viewtopic.php?p=36548#p36548
_______________________________________________
messages mailing list
messages@vassalengine.org
http://www.vassalengine.org/mailman/listinfo/messages
Tim,
Vassal Uber Geek/Guru

Problems? post your OS, Physical Mem, version of Vassal and Java plus the Module in question.
No developer can help with out that info, thx!
User avatar
Tim M
 
Posts: 1816
Joined: December 8th, 2007, 12:22 pm
Location: Earth

Re: Text labels in 3.2.0: bug or feature?

Postby barbanera » October 10th, 2012, 10:18 pm

Tim M wrote:for item 4 set a DP to 1 as the first step the button performs and configure the
action button to only work through a trigger that says if the DP = 0 then
execute

This works. Have done it many times

Another way to do it is to immediately destroy the button and replace it with an
identical non clickable button that when placed performs your setup routine and
once complete replaces itself (again) into a functional button (if needed). This
should also prevent 4 from happening



Unfortunately, this is just what I have been talking about and doesn't work. The DP (or GP) will get updated for the local user only (the one clicking the start button) and as I mentioned I do have restrict commands to forbid a second click when the DP=1. However, the change won't propagate to the remote users till the very end (20 seconds), same as any visual clues using layers or text labels (but reports might be faster).

Same when using the Replace with Other method: it happens for the local player (but the display refreshes 20 seconds later anyway, if I recall correctly from my tests time ago), but it definitively only happens 20 seconds later for the remote ones so that they have those crucial 20 seconds available to launch another setup..
barbanera
 
Posts: 395
Joined: January 12th, 2012, 2:27 pm

Re: Text labels in 3.2.0: bug or feature?

Postby Brent Easton » October 10th, 2012, 10:45 pm

Yes, the reason for this is that we now guarantee that all Commands issued as part of a single action are bundled up as a single Undoable action at the other end. The only way this can happen is that the single batched command is sent at the very end of a an action sequence.

Essentially, you are trying to implement an animation (on-screen message changing at certain times) and have it visible to other players in the same way. As I said earlier, this will never be possible.

The only way I can see you getting this to work is to break the initialisation sequence into two parts. The first button says 'Take control of setup'. All this does is set a global property, change the button text and this gets sent to all other users and stops any one else from starting the initialisation. Then, initiate the actual initialisation with another button click.

Brent.
User avatar
Brent Easton
 
Posts: 3176
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: Text labels in 3.2.0: bug or feature?

Postby Brent Easton » October 10th, 2012, 11:09 pm

Brent, I wholeheartedly agree. Indeed, I made an attempt (back in January) to properly define offsets. However, and here is the catch, then there is a bug with offsets. Or maybe I don't understand how to use offsets..

Piece with multiple text labels:

1) first text label at default vertical offset 0

2) second text label at 10

3) third text label at -10

All the rest being equal (default selection for alignment etc) they should appear one on top of the other 10 pixels a part, correct? They don't. And they didn't work properly even in early builds of 3.2.0, that is before your fix to revert to 3.1.x automatic line feeding style.


Ah, but that's because of the 'bug' that causes multiple text Labels with no Key Command to appear with a line feed between them. Take away this 'bug', or add Command Keys to the text labels and your example works.

The way it is now is confusing and inconsistent, the labels behave completely differently depending on whether or not there is a Key Command attached, making it difficult to use offsets. There is no logical reason why separate text Labels should be related in any way.

Having offsets specified in pixels is not really so much of a problem surely, it's something you set up once and it's done.

A much better way to do a multi-line text label is to use html in the label.
User avatar
Brent Easton
 
Posts: 3176
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: Text labels in 3.2.0: bug or feature?

Postby barbanera » October 11th, 2012, 12:54 pm

Ok, so maybe I was remembering incorrectly, because I thought that even in early builds of 3.2.0 (=no line feeds) defining offsets like -10, 0 and 10 was not working as expected.

Assuming that's the case (i.e. removing the line feeds offset work as expected), what's the take now? Are you going to remove the line feeds again or are we sticking with line feeds (and then potential issues like #4 and maybe #5 in my original list) in the 3.2.0 final release? Thanks.

P.S. As you might remember I am happy to add text labels ad libitum to a single piece with no image, to monitor values of GPs and DPs for debugging purposes (my "Debug" screen). Using HTML to do that sounds really cumbersome, when you have a single line prompt and markup 20 lines long.. Ideally this would not be a problem if there was a "debug" or "inspect" or "trace" mechanism in the engine to allow inspection of variables during a run (in edit mode).. Vassal 4? :)
barbanera
 
Posts: 395
Joined: January 12th, 2012, 2:27 pm

Re: Text labels in 3.2.0: bug or feature?

Postby barbanera » October 11th, 2012, 1:02 pm

Brent Easton wrote:The only way I can see you getting this to work is to break the initialisation sequence into two parts. The first button says 'Take control of setup'. All this does is set a global property, change the button text and this gets sent to all other users and stops any one else from starting the initialisation. Then, initiate the actual initialisation with another button click.


Yes, I am now scratching my head trying to come out with an elegant way of achieving that without brutally telling everybody only player C can start the game (which would sound a bit bizarre).. But that should be the way to go, thanks for the hint!

Is the playerName/playerSide of the player originally starting the game exposed in a GP, by any chance?
barbanera
 
Posts: 395
Joined: January 12th, 2012, 2:27 pm

Previous

Return to Developers

Who is online

Users browsing this forum: No registered users and 2 guests