Information updated as return value of operator""() does not update within Stat() on each new refresh.
Numbered Steps to Reproduce Problem:
Code provided, Also video: https://cdn.discordapp.com/attachments/1003179942818877480/ 1137918019293692005/2023-08-06_21-19-33.mp4
Code Snippet (if applicable) to Reproduce Problem:
macros.dms
macro
ANY return "keyDown \[\[*]]"
ANY+UP return "keyUp \[\[*]]"
test.dm
player
var/keyboardHandler/keys
New()
keys = new/keyboardHandler()
spawn(10) //Made only as a test to see if a straight stat(name) call would update the other cell
for()
name = pick("Inu","Gads","Mew","Mow");sleep(10)
..()
Stat()
statpanel("Keys")
stat(keys.keys) //displays as changed
statpanel("Move")
stat(keys) //displays when exited tab, entered tab again
stat("[keys]") //displays as changed
stat(name) //displays as changed
client
verb
keyDown(_key as text)
set instant=1
set hidden =1
mob:keys+=(_key)
keyUp(_key as text)
set instant=1
set hidden =1
mob:keys-=(_key)
keyboardHandler
var/list/keys = list()
proc
operator+=(_key) keys[_key] = TRUE
operator-=(_key) keys[_key] = FALSE
operator[](index) return keys[index]
operator""() return json_encode(keys)
Expected Results:
both stat( keys ), and stat( "[keys]" ) to update simultaneously.
Actual Results:
stat(keys) updates only when statpanel is switched, and then switched back.
Does the problem occur:
Every time? Or how often? Every time.
In other games?
In other user accounts?
On other computers?
When does the problem NOT occur?
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Workarounds:
stat("[keys]")