Page 1 of 2

Redrawing a player's frame

Posted: Sun Jul 13, 2014 8:19 am
by nirkedar
Is it possible for the GM to have a player's frame (character sheet) redrawn from code.

In my situation each player has a frame showing his character sheet. On the sheet, the current movement mode is displayed on it (walk, climb, swim, etc) as well as the movement limit (30 feet, 15 feet, etc).

1. A player may chose to switch his movement to (e.g. from walking to climbing) by clicking on the climb check link on his PC sheet.
2. In the chat menu, his climb check roll is rolled and shown, as well as 2 GM only link buttons: Success & Failure.
3. If the GM clicks on the Success button, the players movement mode changes to Climb and his movement limit is set to 15 (feet per move action).

Is there a way to get the Player's character sheet frame to refresh itself after the GM clicks on the Success link?

Re: Redrawing a player's frame

Posted: Sun Jul 13, 2014 9:46 am
by Bone White
Yes, just call the frame again using the macro link. You can find information here Introduction_to_Dialogs_and_Frames

Re: Redrawing a player's frame

Posted: Sun Jul 13, 2014 11:10 am
by nirkedar
I guess I didn't make my self clear:

I know I can refresh a frame on the same machine by simply calling the macro that draws the frame, but I want the GM's action to refresh a frame on the Player's (a different person) computer.

Is there a way to send a command to another computer terminal to refresh it's frame (similar to broadcasting to a select audience).

Re: Redrawing a player's frame

Posted: Sun Jul 13, 2014 11:19 am
by wolph42
Yup. Broadcast a execlink to that PC. Read Wiki: broadcast() for more info

Re: Redrawing a player's frame

Posted: Sun Jul 13, 2014 11:43 am
by nirkedar
I think that will do it.
Always a pleasure dealing with you gents.
Thanks.

Re: Redrawing a player's frame

Posted: Tue Aug 19, 2014 8:08 pm
by Nertht
Should I get same results of broadcast(link) with two clients running on one PC?

Re: Redrawing a player's frame

Posted: Tue Aug 19, 2014 8:25 pm
by aliasmask
When you broadcast a link that has autoexecute checked it will auto run on all the client computer except the person who ran the macro. They will have to click the link. You can post to all other clients using Wiki: getAllPlayerNames() and subtract your name from list to avoid double post using Wiki: getPlayerName(). One way is like this.

Code: Select all

[r: broadcast(link,json.difference(getAllPlayerNames("json"),json.append("",getPlayerName())),"json")]
[H: executeLink(link)]
The broadcast line posts "link" to the chat for the other clients and runs the link on your client. The "link" string value should have a macro link somewhere in there and the macro being called should have autoexec checked to run automatically for the other clients. Otherwise, they will have to manually click the link.

Re: Redrawing a player's frame

Posted: Tue Aug 19, 2014 8:32 pm
by wolph42
note that i have a function available in the bag of tricks (link in sig) that deals with this. cant recall teh exact name of the function, but its documented in the manual.

Re: Redrawing a player's frame

Posted: Wed Aug 20, 2014 5:39 am
by Nertht
Thx for answers.

But this broadcast macro still doesn´t work. I dont have a clue, why.
-Autoexecute is chcecked.
-I´m using last version of MT (1.3.b90).
-I started two clients (Player1 and Player2) on my PC.

Macro should open new frame on client named Player2. But it still execute macro (open farame) on my (Player1) client.

Code: Select all

[h: broadcast(execLink(macroLinkText("FRAME@Lib:Token", "none", "", "Player2Token")),"Player2")]
Are there any other special options or is problem with my macro?

Wolph:
Searching in bag of trick was first thing which i did. Its function called: bot_execAllPlayers(). Anyway thx for your hard work wolph.

Re: Redrawing a player's frame

Posted: Wed Aug 20, 2014 6:09 am
by wolph42
bot_execAllPlayers()
indeed thats the function. And does it work when you use that?

Re: Redrawing a player's frame

Posted: Wed Aug 20, 2014 6:59 am
by Nertht
Nope, it made an -in body of roll- error.
I tried to make an lib:Token with update macro. And use example macro from Wiki: broadcast().

Code: Select all

[h: bot_execAllPlayer("update@lib:Token", json.append("","Hello World", 2), "Player2", "all")]
Error was occur anyway. (Doesn´t matter if macro update@lib:Token was blank, or not.) BoT was implemented right and function bot_execAllPlayer was defined. (I did it explicitly).

Re: Redrawing a player's frame

Posted: Wed Aug 20, 2014 7:16 am
by wolph42
can you link the campaign file here with your bot_execallplayers trial in it, so I can have a look?

Re: Redrawing a player's frame

Posted: Wed Aug 20, 2014 8:00 am
by aliasmask
Nertht wrote:

Code: Select all

[h: broadcast(execLink(macroLinkText("FRAME@Lib:Token", "none", "", "Player2Token")),"Player2")]
This wouldn't work because there is no output. If you create your link with macroLink you can then post it with broadcast and not use execLink. A link will show up in chat and execute on the other client, but the client who posted the link. You would have to click it yourself or use my code in an earlier post.

Re: Redrawing a player's frame

Posted: Wed Aug 20, 2014 9:09 am
by Nertht
aliasmask:
Ah, ok. I inspired myself in Wiki: broadcast() tutorial, where stands:
Executing the macro 'update()' located at 'lib:Token', for the token 'Dragon' on the PC of user 'Tim':
[h: link = macroLinkText("update@Lib:Token", "none", "", "Dragon")]
[h: broadcast(execLink(link), "tim")]
wolph:
Of course.
Download here


*Now I see, where can be a problem... Cause, I still speak, about direct running macro from my PC, without clicking on chat. Is it necessary players to click a link? Cause in that case, players can click it repeately and make a lot of mess. I thought, that direct running is possible with broadcast execLink.

Re: Redrawing a player's frame

Posted: Wed Aug 20, 2014 10:14 am
by wolph42
Nertht wrote:Nope, it made an -in body of roll- error.
I tried to make an lib:Token with update macro. And use example macro from Wiki: broadcast().

Code: Select all

[h: bot_execAllPlayer("update@lib:Token", json.append("","Hello World", 2), "Player2", "all")]
Error was occur anyway. (Doesn´t matter if macro update@lib:Token was blank, or not.) BoT was implemented right and function bot_execAllPlayer was defined. (I did it explicitly).
its
bot_execAllPlayers
if you correct that it works.