Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Wird error with Player Object

1626015668
GiGs
Pro
Sheet Author
API Scripter
Am I missing something obvious? This works const getPlayer = msg => getObj('player', msg.playerid).id; and returns the proper id. But this does not: const getPlayer = msg => getObj('player', msg.playerid).displayname; In fact every property I've tried other than id returns an undefined value. Is this a bug or am I missing something silly?
1626017137
timmaugh
Pro
API Scripter
Do you not have to use the get function for that property? const getPlayer = msg => getObj('player', msg.playerid).get('displayname');
1626020391
The Aaron
Roll20 Production Team
API Scripter
The only field on Roll20 Objects that is exposed as a property is id.  Everything else must be accessed via the .get() and .set() methods.
1626021670
GiGs
Pro
Sheet Author
API Scripter
ah of course, thanks. I'm pretty rusty after a few months not touching the API.