-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: changes via javascript token.setProperty is not propagated to clients #4237
Comments
The bug occurs also with MapTool 1.14.0 Alpha 3 (Pre Release). |
I don't see this reported yet; thanks for the bug report. It's been discussed on the Discord a couple times already. In the
but I haven't had time to test it. |
Is the token property synchronization with the clients already possible with another JS call? |
No, I thought about setting it up so that returning from the GraalVM interpreter would cause a So that means either (The history of |
The same problem occurs for |
I've had a crack at fixing this and unless I've done something strange, a simple putToken() call didn't fix it. Further debugging getting into the server->client message handling seems to show that when doing the MTScript 'setProperty()' a message is sent from client to server informing of the property change. A second message for the chat output (since Doing the JS 'setProperty()' (with This is where my knowledge is failing, as I can't figure out where the message is ultimately coming from and why the JS one isn't generating a message. All assuming I've made no mistakes in my debugging. |
I found a solution - copied what I don't know if it's a good solution, but it seems to work... |
Describe the Bug
I am setting a property on a token while the server is running and a client is connected via a javascript-UDF. The property is set on server side correctly, impersonating the token and calling
[getProperty("test")]
returns "newValue". But on the client it returns whatever old value it had before.To Reproduce
setTest macro on Lib:js:
init macro on Lib:js:
[setProperty("test", "oldValue")]
. Impersonate the same TestToken on the client. Now[getProperty("test")]
called on server and on client returns "oldValue" in both cases, as expected.[js.setTest(currentToken())]
.[getProperty("test")]
on the server returns "newValue" (correct), a call to[getProperty("test")]
on the client returns "oldValue", which is the bug.Additional Info:
Writing the javascript as a workaround like this, i.e. calling a macro for setting the property, works as expected:
Hint from Azhrei on in the discord channel:
Inside the Java code, changing a token property requires calling zone.putToken(token) on the token. It may be that the MapTool.tokens API in JS doesn't automatically do that — I don't know, just offering up ideas.
Expected Behaviour
Token property changes in javascript on the server should be propagated to the clients, i.e. in step 5
[getProperty("test")]
should return "newValue" on server and client.Screenshots
No response
MapTool Info
Version 1.13.2, New Install, Gentoo Linux using the debian package.
Desktop
Gentoo Linux: Linux omikron 6.1.41-gentoo #1 SMP Tue Jul 25 19:39:42 CEST 2023 x86_64 Intel(R) Core(TM) i7-5930K CPU @ 3.50GHz GenuineIntel GNU/Linux
Additional Context
==== MapTool Information ====
MapTool Version: 1.13.2
MapTool Home...: /home/stephan/.maptool-rptools
MapTool Install: /home/stephan/Anwendungen/maptool_1.13.2-amd64/data/opt/maptool/lib/app
Max mem avail..: 15 GB
Max mem used...: 560 MB
Custom Property: -DMAPTOOL_LOGDIR=/home/stephan/.maptool-rptools/logs
Custom Property: -DMAPTOOL_DATADIR=.maptool-rptools
==== Java Information ====
Java Home......: /home/stephan/Anwendungen/maptool_1.13.2-amd64/data/opt/maptool/lib/runtime
Java Vendor....: Eclipse Adoptium
Java Version...: 17.0.1
Java Parameters:
-Djpackage.app-version=1.0
-Xss8M
-Dsun.java2d.d3d=false
-Dsentry.environment=Production
-Dfile.encoding=UTF-8
-Dpolyglot.engine.WarnInterpreterOnly=false
-XX:+ShowCodeDetailsInExceptionMessages
--add-opens=java.desktop/java.awt=ALL-UNNAMED
--add-opens=java.desktop/java.awt.geom=ALL-UNNAMED
--add-opens=java.desktop/sun.awt.geom=ALL-UNNAMED
--add-opens=java.base/java.util=ALL-UNNAMED
--add-opens=javafx.web/javafx.scene.web=ALL-UNNAMED
--add-opens=javafx.web/com.sun.webkit=ALL-UNNAMED
--add-opens=javafx.web/com.sun.webkit.dom=ALL-UNNAMED
--add-opens=java.desktop/javax.swing=ALL-UNNAMED
--add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED
--add-opens=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED
-Djpackage.app-path=/home/stephan/Anwendungen/maptool_1.13.2-amd64/data/opt/maptool/bin/MapTool
==== OS Information ====
OS Name........: Linux
OS Version.....: 6.1.41-gentoo
OS Architecture: amd64
PATH...........: /usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/opt/cuda/bin
Number of Procs: 12
==== User Information ====
User Name: stephan
User Home: /home/stephan
User Dir.: /home/stephan/Anwendungen/maptool_1.13.2-amd64/data/opt/maptool/bin
==== Network Interfaces ====
Display Name..: eno1
Interface Name: eno1
Address...: 192.168.14.6
Display Name..: lo
Interface Name: lo
Address...: 127.0.0.1
Host Address...: 192.168.14.6
Default Gateway: 192.168.14.1
==== Locale Information ====
Country.: Germany
Language: German
Locale..: German (Germany)
Variant.:
==== Encoding Information ====
Default Locale: de_DE
Default Charset: UTF-8
file.encoding: UTF-8
sun.jnu.encoding: UTF-8
Default Encoding: UTF8
==== Display Information ====
Number of Displays: 3
Display 1: 5120x1080(-1)
Display 2: 1280x1024(-1)
Display 3: 1920x1080(-1)
==== Internet Gateway Devices ====
No IGDs Found!
The text was updated successfully, but these errors were encountered: