GetUserProp Issues (not relating to L or P)

GetUserProp Issues (not relating to L or P)

Anonymous
Not applicable
461 Views
2 Replies
Message 1 of 3

GetUserProp Issues (not relating to L or P)

Anonymous
Not applicable
Hi, being new here i HAVE searched about this, i have read all the documentation i could find but alas, this still is broken.
Maxscript is not new to me, but using it in max 9 is. What i found is that it executes things on the getUserProp function instead of fetching them or have i misinterpreted.

What i am trying to achieve is the following :

Lets say i have Entity information for a game such as :

EntityVersion = 2.0

This is in the user defined properties tab (and was created by a max 7 tool which is obsolete) so, my understanding of the system and the maxscript function dictates that i can say :


if selection.count == 1 then
(
ver = getUserProp selection "EntityVersion"

if ver != "undefined" then
(
lblEntityVersion.text = "Entity Version : 1.0"
lblEntityInformation.text = "Old Version (MAX7)"
) -- otherwise its a version 2 entity and can be exported
)


Now, it gets to the undefined code, because using print and debugging ALWAYS returns OK.
When i have no entity information at all (ie, blank user properties) is still returns ok. The docs say that it returns a string so perhaps i am confused. I tried EntityVersion = "2.0" as someone mentioned elsewhere, and i tried a good number of alternative ideas on getting the properties. Including a textstream and using getUserPropBufffer (as this also returns OK.

Any help is appreciated. I am currently working in Max 9.0 (no SP atm, about to install SP2) , so i will post if that works but i doubt it.

Thanks.
FuzzYspo0N
0 Likes
462 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
I think the problem is you're checking selection, which is an objectset, not an object. Try adding to the end, like this:

if selection.count == 1 then (
ver = getUserProp selection "EntityVersion"
format "ver = %\n" ver
)
0 Likes
Message 3 of 3

Anonymous
Not applicable
You see, the eyes of another in time of stupidity 🙂

Been in and out of other maxscripts seeing the same "pattern" but the smallest bug is the one that trips me 🙂

Thanks a ton for the response, it works great now.
0 Likes