RPTools.net

Discussion and Support

Skip to content

It is currently Thu Sep 21, 2017 7:23 am 




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  [ 10 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Dragon
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 585
 Post subject: Is this possible?
PostPosted: Mon May 08, 2017 10:36 pm 
I have a "Done with Turn" macro that when the players are done, advances the initiative and handle a bunch of stuff (state checks, damage from bleeding, advances spell duration, etc, etc). Works just fine, except for one thing. I call switchToken during it but that means the players end up NOT having their token selected. And of course, that irritates them, since we use strict token ownership. So each time it goes from one of their turns to someone else's, that player has to re-select his token.

But, from a DM perspective, its great that it switches to the token with initiative because then I'm all set to perform the action for the next NPC.

So my question is...is there some way to switchToken for the DM...but for the players, keep selection on the token they're already on?

This is probably very wishful thinking but I thought I'd ask.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9377
Location: Netherlands
 Post subject: Re: Is this possible?
PostPosted: Tue May 09, 2017 1:42 am 
first of all switchtoken() is a temporary function that only applies to the macro its run in. It has nothing to do with selection of a token.

now just to be clear: you want a macro that does stuff and when it ends it:
1. selects the token of the user that pressed the button and
2. on the GM client it selects the token that is next in initiative?

is that correct?

that is possible. but not really easy.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7857
Location: Bay Area
 Post subject: Re: Is this possible?
PostPosted: Tue May 09, 2017 2:40 am 
Which tokens other players select are not effected by another players actions. Each client keeps a record of their own selections. But it's possible to force a selected token with Wiki: selectTokens(), but it has to be run from that client, not the person who ran the macro. This can be done by sending a link to chat to that client that makes the select command. You'll end up with some whitespace or you can someone incorporate it in to your end of turn macro.

pseudo-code:
player A selects end of turn
macro runs updating various things for that players token
link sent to player who controls token next in initiative with autoexecute on
macro runs beginning of turn functions including setting the currently token to be selected

_________________
Downloads:


Top
 Profile  
 
 Offline
Dragon
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 585
 Post subject: Re: Is this possible?
PostPosted: Tue May 09, 2017 11:42 am 
Maybe I need to look at my "Done with Turn" macro and see if I'm forcing the "selection" issue due to an error on my part. I had thought the "switchToken" was doing it but if that's not the case, then it must be something I'm doing in the code.


Top
 Profile  
 
 Offline
Dragon
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 585
 Post subject: Re: Is this possible?
PostPosted: Tue May 09, 2017 6:39 pm 
I did have a "selectToken" in there!

Okay, so I took that out and at the end of my "Done with Turn" macro, I added this...

[h, if(isNPC()), code : {
[h: selectText = macroLink("", "SelectInitNpc@Lib:PC_CombatMacros")]
[broadcast(selectText, "gm")]
}]

The "SelectInitNPC" is pretty simple just...

[h : selectTokens(getInitiativeToken())]

...however, nothing happens. I put in a broadcast in "SelectInitNPC", before the selectTokens, but that never displays either. So I must be doing something incorrect and I'd assume its in the macroLink stuff since I have limited experience with that.

Any ideas?


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7857
Location: Bay Area
 Post subject: Re: Is this possible?
PostPosted: Tue May 09, 2017 6:53 pm 
Make sure SelectInitNpc has autorun on. Also, you can't autorun your own macros. You can only autorun for other clients. If the player is the same then use execLink rather than broadcasting it to chat.

_________________
Downloads:


Top
 Profile  
 
 Offline
Dragon
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 585
 Post subject: Re: Is this possible?
PostPosted: Tue May 09, 2017 7:01 pm 
So, tried it like...

[h, if(isNPC()), code : {
[h: selectText = macroLink("", "SelectInitNpc@Lib:PC_CombatMacros")]
[h : execLink(selectText)]
}]

No luck, nothing happens.

And when you say, "Make sure SelectInitNpc has autorun on", I assume you're talking about the "Auto Execute" checkbox. With it checked or unchecked, doesn't work.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7857
Location: Bay Area
 Post subject: Re: Is this possible?
PostPosted: Tue May 09, 2017 10:20 pm 
Here's what I did:

Code:
@@ @Next

<!-- advance the initiative to the next token and change the selection to that token for the owner of that token -->

[
H: nextInitiative()]
[
H: id = getInitiativeToken()]
[
H: owners = getOwners("json",id)]
[
H, if(json.isEmpty(owners)): owner = json.get(getInfo("server"),"gm"); owner = owners]
[
H, if(json.isEmpty(owner)): owner = getPlayerName(); owner = json.get(owner,0)]

[
H, if(owner == getPlayerName()): selectTokens(id); broadcast("Select Token" + macroLink("","SelectNext@"+getMacroLocation(),"none",json.append("[]",id),id) + "...",owner)]


!!
@@
 @SelectNext

[H: id = arg(0)]
[
H: selectTokens(id)]

!!
 


It doesn't check all the possible situations like an owner that doesn't exist, but it works for me.

The test campaign allow you to check the owner of the token and it will change the selection when it's their turn. Defaults to the first gm of campaign if no owner selected. Does nothing if owner of token not in game.


test next select.cmpgn [422.45 KiB]
Downloaded 8 times

_________________
Downloads:
Top
 Profile  
 
 Offline
Dragon
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 585
 Post subject: Re: Is this possible?
PostPosted: Wed May 10, 2017 9:38 am 
I'll play around with this tonight, thanks!


Top
 Profile  
 
 Offline
Dragon
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 585
 Post subject: Re: Is this possible?
PostPosted: Wed May 10, 2017 4:47 pm 
You the man AM! Minor tweak and its working like a charm!

Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 10 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 3 users online :: 2 registered, 0 hidden and 1 guest (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: Google [Bot], Yahoo [Bot] and 1 guest





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

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman