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

basic script that im sure im doing wrong.

First, please excuse my grammar, I'm on a tablet Haha. Is there an easy way to get the _display name of a known I'd?
1377657392
Lithl
Pro
Sheet Author
API Scripter
var player = getObj('player', playerid); var playerName = player.get('_displayname'); This works. I assume this question is in relation to the whisper.target discussion going on at the moment? I've done a little bit of testing: /w gm test => msg.target == 'gm' /w brian test => msg.target == myID With a character named 'SYSTEM' and no controlling players: /w system test => msg.target == 'gm' With a character named 'SYSTEM' and I'm the only controlling player: /w system test => msg.target == myID With a character named 'SYSTEM' and I'm a controlling player along with Eric V.: /w system test => msg.target == myID,ericID msg.target might return the string 'gm', it might return a playerid (in which case the above code will function just fine), or it might return a comma-delimited array of playerids. It will not return a characterid.
XD I was using findObjs, and it wasn't able to use the .get function after. Now I know where my mild mess up is.
1377668489
Lithl
Pro
Sheet Author
API Scripter
findObjs always returns an array, even if only a single object was found. Array.get('_displayname') doesn't exactly work very well. =)
Yeah. I'd have known if I had just logged it XD. I feel like that guy building his first DND char haha.