MemWrite/Read MouseVPos

Hey guys Happy New year)
Basic question about memblocks, I think it was asked before but I can’t find it.

I need one macro to get current Mouse V Pos and store it in a memblock and the second one to read that Mouse V Pos value.
I tried MemRead and MemWrite, but I get wrong values, at least they don’t always equal to [MouseVPos]
Is there somewhere a simple example how to MemRead and MemWrite such values as MouseVPos?

It seems this works for my task:
IButton, ???, “”,

[VarSet, mv, [MouseVPos]]
[VarDef, read_from_mem, -1]

[MemCreate, mv_mem, 5, 0]
[MemWrite, mv_mem, mv,4]

[MemRead, mv_mem, read_from_mem,4]

[Note, mv] // current mouse v pos
[Note, read_from_mem] // mouse v pos from mem

]

Is it ok to write this way?

Still don’t quite understand why doesn’t work for example
[MemWrite, mv_mem, mv,3]


[MemRead, mv_mem, read_from_mem,3]

Yes, it looks as though MemWrite is broken for some data formats.

Float is the standard format used by zscript variables and that will work OK. But I generally use MVarDef, MVarSet and MVarGet when I need memory blocks in zscript as they are simpler to use.

[MemDelete, mv_mem]//just getting rid of previous mem block

[VarSet, mv, [MouseVPos]]
[MVarDef, mv_mem, 1, 0]
[MVarSet,mv_mem,0,[MouseVPos]]

[Note, mv] // current mouse v pos
[Note, [MVarGet,mv_mem,0]]// mouse v pos from mem