Is there a way to force client to the NPC view selected by the GM?
Moderators: dorpond, trevor, Azhrei
Forum rules
Posting now open to all registered forum users.
Posting now open to all registered forum users.
Is there a way to force client to the NPC view selected by the GM?
I run a game at my place using my PC to run the GM side of the campaign and one of the players laptop to cast the image to my TV via HDMI.
The players have no access to their client, I control everything from my PC. The thing is, when I select a player token, it shows its vision range on my PC. For example if they are in a dark room and I select a token with no darkvision, my screen only sees a small radius around the token. If I select a token with darkvision, I can see the rest of the room.
But this doesn't translate over to the image on the TV. I can only show individual views when I manually select the tokens on the laptop, which I can't do during the game since the laptop is located on the floor, next to the TV.
Can I somehow force the player side view to match the view of whatever token I have selected?
The players have no access to their client, I control everything from my PC. The thing is, when I select a player token, it shows its vision range on my PC. For example if they are in a dark room and I select a token with no darkvision, my screen only sees a small radius around the token. If I select a token with darkvision, I can see the rest of the room.
But this doesn't translate over to the image on the TV. I can only show individual views when I manually select the tokens on the laptop, which I can't do during the game since the laptop is located on the floor, next to the TV.
Can I somehow force the player side view to match the view of whatever token I have selected?
Re: Is there a way to force client to the NPC view selected by the GM?
Not within MT because it's on a separate computer. Actually, there may be a way, but it's very cheeky. You would need to send a link to chat which will tell the other client to select your selected token.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Is there a way to force client to the NPC view selected by the GM?
Code: Select all
@@ @selectMyToken
[H: mySelection = getSelected("json")]
[H: link = macroLink("","forceSelection@"+getMacroLocation(),"none",mySelection)]
[R: " " + link + " "]
!!
@@ @forceSelection
[H: selected = arg(0)]
[H: selectTokens(selected,0,"json")]
!!
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Is there a way to force client to the NPC view selected by the GM?
Thanks for your answer. It sounds really promising.
I'm really new to macros so I'm having some trouble with implementing the code
So I looked into lib tokens.
What I found out is I should first create them by dragging the tokens to any map (I chose my "settings/test" map)
Then rename the tokens to something like Lib:CharacterName
Make the tokens visible to players and set the type to NPC
NOPENOPENOPE Then I tried figuring out how to add macros to the tokens.
From what I understand I had to go to the Campaign properties and add a new Token Type where I could paste the code into the box below, I think?
From copy-pasting the code I got a bunch of errors though /NOPENOPENOPE
Okay, I got closer. I opened up the selection window, selected one of the tokens and added the macro through right-clicking and straight up pasting the code. Then did the same thing in the campaign window but only pasted @selectMyToken
So now in my test map, I have the five Lib:Name tokens for each of my players and I added actual PC tokens, same file, only the name is the PC name without the Lib: in front of it. Changed the type to PC and added vision. I selected one of the tokens, used the hotkey to change the view, the Chat box gave the notification that I selected the token but in my player program, nothing had changed
Did some more digging and found out I should remove the ability to let players edit macros. Did that for each of the lib tokens. Still not working yet.
So far I'm confused about:
What to write in the campaign macro?
Can I have my Lib tokens on one map as NPC's, named Lib:NAME and have them work for other tokens on a different map that have the same name without the "Lib:" part?
I'm really new to macros so I'm having some trouble with implementing the code
So I looked into lib tokens.
What I found out is I should first create them by dragging the tokens to any map (I chose my "settings/test" map)
Then rename the tokens to something like Lib:CharacterName
Make the tokens visible to players and set the type to NPC
NOPENOPENOPE Then I tried figuring out how to add macros to the tokens.
From what I understand I had to go to the Campaign properties and add a new Token Type where I could paste the code into the box below, I think?
From copy-pasting the code I got a bunch of errors though /NOPENOPENOPE
Okay, I got closer. I opened up the selection window, selected one of the tokens and added the macro through right-clicking and straight up pasting the code. Then did the same thing in the campaign window but only pasted @selectMyToken
So now in my test map, I have the five Lib:Name tokens for each of my players and I added actual PC tokens, same file, only the name is the PC name without the Lib: in front of it. Changed the type to PC and added vision. I selected one of the tokens, used the hotkey to change the view, the Chat box gave the notification that I selected the token but in my player program, nothing had changed
Did some more digging and found out I should remove the ability to let players edit macros. Did that for each of the lib tokens. Still not working yet.
So far I'm confused about:
What to write in the campaign macro?
Can I have my Lib tokens on one map as NPC's, named Lib:NAME and have them work for other tokens on a different map that have the same name without the "Lib:" part?
Last edited by N2tZ on Fri Feb 22, 2019 3:47 pm, edited 1 time in total.
Re: Is there a way to force client to the NPC view selected by the GM?
You should look at this wiki page on lib:tokens: Library_Token
Re: Is there a way to force client to the NPC view selected by the GM?
So I took a nap and took a new look at the lib tokens wiki page.
I realized I don't need a separate token for all my PC's but only one lib token that has the macros.
Then I re-read aliasmask's code and thought that maybe they provided two codes instead of one. So I made only one lib token, gave it the following macros:
forceSelection
selectMyToken
Then I added a macro to the campaign:
Select Token
When I tried running that I got an error "Undefined function: macro"
I looked around and pretty much got that there has to be a variable in the last code. Looking at the sample code I tried macro.return but that didn't really work since it asked for a value.
I tried changing it to [macro ("selectMyToken@Lib:TokenSel"): 1] since that at least gives me no errors
So when I try running the code now this is what I get:
Chat: GMr:@@ @selectMyToken
It doesn't change the view/selection but when I manually select a token in the player's computer and run the macro on my computer, it deselects the view.
I realized I don't need a separate token for all my PC's but only one lib token that has the macros.
Then I re-read aliasmask's code and thought that maybe they provided two codes instead of one. So I made only one lib token, gave it the following macros:
forceSelection
Code: Select all
@@ @forceSelection
[H: selected = arg(0)]
[H: selectTokens(selected,0,"json")]
Code: Select all
@@ @selectMyToken
[H: mySelection = getSelected("json")]
[H: link = macroLink("","forceSelection@"+getMacroLocation(),"none",mySelection)]
[R: " " + link + " "]
Select Token
Code: Select all
[macro ("selectMyToken@Lib:TokenSel")]
I looked around and pretty much got that there has to be a variable in the last code. Looking at the sample code I tried macro.return but that didn't really work since it asked for a value.
I tried changing it to [macro ("selectMyToken@Lib:TokenSel"): 1] since that at least gives me no errors
So when I try running the code now this is what I get:
Chat: GMr:@@ @selectMyToken
It doesn't change the view/selection but when I manually select a token in the player's computer and run the macro on my computer, it deselects the view.
Re: Is there a way to force client to the NPC view selected by the GM?
Can I ask what these articles will help me with? Just so I know what to look out for or what to keep in mind while reading through them.
Should I make the macros on the library token run on campaign load?
Edit: I also kind of roughly installed the Bag of Tricks set, will this somehow interfere with the oncampaingload stuff?
Sorry for all the questions, I'm just trying to get this thing running with zero knowledge on coding
Edit 2: Okay, I'm watching Into the Spiderverse with my friends and checking up on the wiki site, I might actually get it now. I created the oncampaign load token, so far I understand that I have to create a new macro to the library token that has the following code: "defineFunction(function, macro)", right? My PC crashed before I could test it since it can't handle running two instances of MapTools tho
Should I make the macros on the library token run on campaign load?
Edit: I also kind of roughly installed the Bag of Tricks set, will this somehow interfere with the oncampaingload stuff?
Sorry for all the questions, I'm just trying to get this thing running with zero knowledge on coding
Edit 2: Okay, I'm watching Into the Spiderverse with my friends and checking up on the wiki site, I might actually get it now. I created the oncampaign load token, so far I understand that I have to create a new macro to the library token that has the following code: "defineFunction(function, macro)", right? My PC crashed before I could test it since it can't handle running two instances of MapTools tho
Re: Is there a way to force client to the NPC view selected by the GM?
First thing. Don't put those @@ or !! lines in your code. That is special formatting for AliasMask's RPEdit macros for pasting in code from NotePad++. The @@ line tells you what he would have named the macro.
Be aware that by jumping into lib:tokens and macrolinks with no other MT macro background you are jumping into the deep end of the pool - with an anchor - and your hands tied behind your back.
It's the difference between:
and
Which one is clearer to you?
Be aware that by jumping into lib:tokens and macrolinks with no other MT macro background you are jumping into the deep end of the pool - with an anchor - and your hands tied behind your back.
By including a onCampaignLoad macro on your lib:token and then putting in defineFunction calls for each library macro, you make it easier to access those functions.
It's the difference between:
Code: Select all
[r: result = myLibFunction("Bob","Heal")]
Code: Select all
[r: var1 = "Bob" ]
[r: var2 = "Heal" ]
[r: passedVars = json.append( "", var1, var2 )]
[MACRO("myLibFunction@MyLibToken"): passedVars ]
[r: result = macro.return ]
No. Each library token can have its own onCampaignLoad macro.
For any macro on your lib:token that you want to call from some other macro, you should add a call to defineFunction() in the onCampaignLoad macro. The wiki page for Wiki: defineFunction() includes an example of how to do it.
Any PC made in the last decade can run multiple instances of MapTool without problem.
-
- Kobold
- Posts: 15
- Joined: Tue Jun 18, 2019 7:43 pm
Re: Is there a way to force client to the NPC view selected by the GM?
Maybe I am missing your intention but could you not run a GM session and client session on your computer? Have your GM session on one monitor and configure the HDMI TV as a second monitor where you have your client session. If your players only see the HDMI TV then this should work. You get the benefit of a full GM screen but your players only see the client screen.
When you connect both a GM session and a client session (i.e. two instances of MapTool), MapTool will recognize that you are running both sessions on the same PC and display a warning about a loop-back connection (or something similar). However, accepting the warning seems to work fine. I use this method to do testing of my campaign maps and macros (instead of just using the View As Player option).
When you connect both a GM session and a client session (i.e. two instances of MapTool), MapTool will recognize that you are running both sessions on the same PC and display a warning about a loop-back connection (or something similar). However, accepting the warning seems to work fine. I use this method to do testing of my campaign maps and macros (instead of just using the View As Player option).