ID:2790166
 
Resolved
The client sometimes sent the wrong mouse params, mistakenly using new-style params (for worlds compiled in BYOND 514 or later) with older .dmb files.
BYOND Version:514
Operating System:Windows 11 Home
Web Browser:Chrome 101.0.4951.67
Applies to:Dream Seeker
Status: Resolved (514.1585)

This issue has been resolved.
edit: current workaround, if you want the button that was pressed
proc/button_from_mouse_params(params)
var/list/info = params2list(params)
return info["button"] || (
info["left"] ? "left" : \
info["right"] ? "right" : \
info["middle"] ? "middle" : \
null)


https://cdn.discordapp.com/attachments/725458744711839873/ 974997127405121556/MouseButtons513_src.zip

Order of events:
1. Press LMB
2. Press MMB
3. Press RMB
4. Release RMB
5. Release MMB
6. Release LMB

513:
icon-x=1;icon-y=1;left=1;screen-loc=1:1,1:1
icon-x=1;icon-y=1;middle=1;screen-loc=1:1,1:1;drag=left
icon-x=1;icon-y=1;right=1;screen-loc=1:1,1:1;drag=left
icon-x=1;icon-y=1;right=1;screen-loc=1:1,1:1;drag=left
icon-x=1;icon-y=1;middle=1;screen-loc=1:1,1:1;drag=left
icon-x=1;icon-y=1;left=1;screen-loc=1:1,1:1

514:
icon-x=1;icon-y=1;left=1;button=left;screen-loc=1:1,1:1
icon-x=1;icon-y=1;left=1;middle=1;button=middle;drag=left;screen-loc=1:1,1:1
icon-x=1;icon-y=1;left=1;right=1;middle=1;button=right;drag=left;screen-loc=1:1,1:1
icon-x=1;icon-y=1;left=1;right=1;middle=1;button=right;drag=left;screen-loc=1:1,1:1
icon-x=1;icon-y=1;left=1;middle=1;button=middle;drag=left;screen-loc=1:1,1:1
icon-x=1;icon-y=1;left=1;button=left;screen-loc=1:1,1:1

In 514, the "left", "middle", "right" parameters are incorrectly all included in the MouseUp if they were just being pressed. Before, only the button that was pressed/released would be included. This change makes those parameters useless.
Also, the new "button" parameter is not documented, though it makes for a great workaround.
This affects behaviour in Hazordhu.
Update: this doesn't happen when joined through Dream Daemon, only when running directly in Dream Seeker. The mouse params match the old params, with no extra =1's and no "button" parameter.
The reason you aren't seeing this when hosting in DD is probably if you're running an old .dmb compiled before 514. The behavior change was tied to the .dmb version.

I think the new behavior is actually much better in that you know exactly which buttons are currently being pressed and know which is the button that triggered the event. In the past there was no way to know that. The new behavior actually was put in intentionally, but I forgot to document it.

I'll document the change so it's clearer.
Lummox JR resolved issue
In response to Lummox JR
This is definitely broken. Clients joined through Dream Daemon still get the old params. No "button" param, and only the left/right/middle of the button involved appears.
client build: 1584
world build: 1584
icon-x=15;icon-y=19;left=1;screen-loc=1:15,1:19
icon-x=15;icon-y=19;middle=1;drag=left;screen-loc=1:15,1:19
icon-x=15;icon-y=19;right=1;drag=left;screen-loc=1:15,1:19
icon-x=15;icon-y=19;right=1;drag=left;screen-loc=1:15,1:19
icon-x=15;icon-y=19;middle=1;drag=left;screen-loc=1:15,1:19
icon-x=15;icon-y=19;left=1;screen-loc=1:15,1:19

I like the button param. It saves a few if()s.

I don't think changing the behavior of the left/right/middle params is worth breaking every game that handles mouse buttons. Who asked for this change? How did you tell people about it?

you know exactly which buttons are currently being pressed and know which is the button that triggered the event. In the past there was no way to know that.
In the past, the way we kept track of all the pressed mouse buttons has been either to set flags or add to a set of buttons pressed, the exact same way we track button presses via macros. That's how we knew what buttons are currently pressed. As for which is the one that triggered the event, that would be the button (left/right/middle) that has the =1 in the params.
I can confirm that, (presumably) in a completely different game, with a freshly-built dmb and both client and server running on a computer that has never even had <=513 installed, it works exactly as Kaiochao described. Uses the old behavior when connecting through DD and the new when running directly in DS.
Hrm. It definitely should not behave differently between DD+DS and DS alone; it should be based only on the .dmb version. So if there's a discrepancy there that's bad for sure. I'll have to take a fresh look at this.

The new behavior is however objectively better, so as long as games compiled before 514 function correctly it should be okay. I'll do a test project Monday compiled with 513 and see if I can replicate this.
Lummox JR changed status to 'Open'
Lummox JR resolved issue with message:
The client sometimes sent the wrong mouse params, mistakenly using new-style params (for worlds compiled in BYOND 514 or later) with older .dmb files.
That resolution message doesn't exactly sound right, since at least the dmb I was using was compiled with 514
The problem was that it wasn't actually going by the .dmb version as it was supposed to, because it was looking at the wrong var.