GetUserProp broken when property set to L or P?

GetUserProp broken when property set to L or P?

Anonymous
Not applicable
1,165 Views
2 Replies
Message 1 of 3

GetUserProp broken when property set to L or P?

Anonymous
Not applicable
This is odd, has anyone else noticed that if you set a user defined property to the letters L or P you'll end up with incorrect data getting returned using GetUserProp?

Try making a box, set variable "test" to "P" then run the following in the listener:

GetUserProp $ "test"



Does anyone know a work around for this? I tried submitting a bug but the form breaks when you hit "submit" 😄
0 Likes
1,166 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
I can confirm this. It looks like it's using a reseverd keyword or it's simply a bug! As a workaround I would prefix my values "_" and remove the prefix upon fetching them, seems cleaner then making an exception function or something.

-Johan
0 Likes
Message 3 of 3

Anonymous
Not applicable
This is odd, has anyone else noticed that if you set a user defined property to the letters L or P you'll end up with incorrect data getting returned using GetUserProp?

Try making a box, set variable "test" to "P" then run the following in the listener:

GetUserProp $ "test"



Does anyone know a work around for this? I tried submitting a bug but the form breaks when you hit "submit" 😄


This is a known bug - GetUserProp does not return a string but calls execute() on the string to get the actual MAXScript value, for example if the value was 10 or 10.0 it would return an integer or a float instead of a "10" or "10.0" strings like getINISetting would.

P is a reserved symbol for denoting Pointers. L stands for "Long".
Same trouble with Time values. "s" returns 0f because "s" denotes "Seconds" in MAXScript. "t" also returns 0f because it denotes "Ticks". "f" means "Frames" and also returns 0f.

One way to avoid this is to make the value a string to start with:

SetUserProp $ "test" "\"f\"" --stores as string
OK
execute (GetUserProp $ "test") --gets back the string
"f"

It was reported last year but has not been fixed yet (there might be larger issues under the hood when fixing this than meet the eye).
0 Likes