RPTools.net

Discussion and Support

Skip to content

It is currently Sun May 19, 2013 8:59 pm 




Forum rules


PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)



Reply to topic  [ 8 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Giant
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 213
 Post subject: GetPlayerName...from token?
PostPosted: Tue Apr 17, 2012 8:53 pm 
I want to create a macro where I can send a Whisper to any selected player token but I don't see a way to extract the token "ownership" (the player's name) from the token.

Is there a way to do this that I'm not seeing? Or a better way to accomplish this? Thanks!


Top
 Profile  
 
 Offline
Giant
 
Joined: Mon Apr 20, 2009 8:31 pm
Posts: 231
 Post subject: Re: GetPlayerName...from token?
PostPosted: Tue Apr 17, 2012 10:26 pm 
xavram wrote:
I want to create a macro where I can send a Whisper to any selected player token but I don't see a way to extract the token "ownership" (the player's name) from the token.

Is there a way to do this that I'm not seeing? Or a better way to accomplish this? Thanks!

To get a list of owners, use getOwners.


Top
 Profile  
 
 Offline
Giant
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 213
 Post subject: Re: GetPlayerName...from token?
PostPosted: Wed Apr 18, 2012 10:36 pm 
Well, that will work just perfectly, thanks!

But maybe I'm approaching this wrong. The way I was visualizing this was to select the player tokens that I wanted, then click a macro, have an input screen pop up with an edit box and whatever I type in there is whispered to the selected players.

However, if I do it that way, that input box is going to show up for EACH selected token, right? I just want to type in what I want to whisper once, then have it broadcast to each selected player.

What's the best way to tackle that?


Top
 Profile  
 
 Offline
Giant
 
Joined: Mon Apr 20, 2009 8:31 pm
Posts: 231
 Post subject: Re: GetPlayerName...from token?
PostPosted: Fri Apr 20, 2012 12:05 am 
If you have the 'apply to selected token' box checked, then it will put up a dialog for each token selected. If it isn't, it won't.

If that option is not checked, then you will need to use getSelected to get a list of which tokens are selected.

Also, questions about the macro language will receive more through and faster replies when posted in the Macros subforum of this board.


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Tue Aug 23, 2011 10:41 am
Posts: 770
Location: Cornwall, UK
 Post subject: Re: GetPlayerName...from token?
PostPosted: Fri Apr 20, 2012 2:07 am 
Akodo Makama wrote:
Also, questions about the macro language will receive more through and faster replies when posted in the Macros subforum of this board.


Yep, it'll become your second home.

Wiki: getSelected() will return the results as a string list, unless you specify "json" as the parameter. This means you can use it with [foreach:]:

Code:
[h: input("message")]
[
h: selectedList = getSelected()]
[
h, foreach(selectedID,selectedList): broadcast(message,getOwners(selectedID))] 


This is a rather simple macro, it will send the message to all owners of every token you have selected. It will send duplicate messages if a player owns more than one of the tokens selected, but this should get you started.

Note that the documentation wiki is _very_ useful for budding macro-writers like yourself. I still have to refer to it every few lines of code I write.

_________________
I'm working on adapting the Alternity game for MapTool, but it's on the back burner unless anyone shows any interest except for me. Current release & support thread: [Alternity] v0.2 *BETA*


Last edited by Bone White on Mon Apr 23, 2012 4:30 am, edited 1 time in total.

Top
 Profile  
 
 Offline
Giant
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 213
 Post subject: Re: GetPlayerName...from token?
PostPosted: Sun Apr 22, 2012 6:58 pm 
This macro looks like exactly what I was looking for! Great1

But...(isn't there always a but?) When I try to run it, I get this message back in the chat window.

Error executing "getOwners": there is no impersonated token.

I have a player token selected when I try the macro, so I thought it would work...but apparently, no dice.


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Tue Aug 23, 2011 10:41 am
Posts: 770
Location: Cornwall, UK
 Post subject: Re: GetPlayerName...from token?
PostPosted: Mon Apr 23, 2012 4:29 am 
Code:
[hinput("message")]
[
hselectedList getSelected()]
[
h, foreach(selectedID,selectedList): broadcast(message,getOwners(",",selectedID))]  


Sorry, I forgot the parameters in Wiki: getOwners().

Just remember to assign each token you select an owner, else you'll get an error.

_________________
I'm working on adapting the Alternity game for MapTool, but it's on the back burner unless anyone shows any interest except for me. Current release & support thread: [Alternity] v0.2 *BETA*


Top
 Profile  
 
 Offline
Giant
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 213
 Post subject: Re: GetPlayerName...from token?
PostPosted: Tue Apr 24, 2012 7:09 pm 
Thanks a bunch, with a couple of tweaks, this suited my purpose beautifully!


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 8 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 5 users online :: 1 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: reonZ and 4 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman