execLink() and broadcast()

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

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. :)
Post Reply
Merudo
Giant
Posts: 228
Joined: Wed Jun 05, 2019 7:06 am

execLink() and broadcast()

Post by Merudo »

I'm having trouble running execLink() and broadcast() together.

I have the following campaign macro:

Code: Select all

[h: link = macroLinkText("test@Lib:mylib")]
[h: broadcast(execLink(link))]
When I click the macro is executed, but only for the player who clicked. What should happen is that every player have the macro executed...

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: execLink() and broadcast()

Post by aliasmask »

execLink() for running code from the current client. You're simply outputting the result of that run to chat. If you output the link, like with macroLink(), then players can click it and run it on their client. Typically these work together like this. You create a link for your client with macroLinkText, convert that in to a valid macro link by adding <a href="%{link}">Click Me!</a> and then broadcast that to the other players. If autoexecute is on for the linked macro then it will autorun for the other clients but not you. That's why you use execLink so it runs for you as well.

Merudo
Giant
Posts: 228
Joined: Wed Jun 05, 2019 7:06 am

Re: execLink() and broadcast()

Post by Merudo »

aliasmask wrote:
Sun Jul 14, 2019 2:22 pm
execLink() for running code from the current client. You're simply outputting the result of that run to chat. If you output the link, like with macroLink(), then players can click it and run it on their client. Typically these work together like this. You create a link for your client with macroLinkText, convert that in to a valid macro link by adding <a href="%{link}">Click Me!</a> and then broadcast that to the other players. If autoexecute is on for the linked macro then it will autorun for the other clients but not you. That's why you use execLink so it runs for you as well.
I noticed the BoT also uses macroLink() instead of macroLinkText().

Does this mean the wiki example with the macroLinkText being directly broadcasted is incorrect?

EDIT: The following code worked great:

Code: Select all

[h: link = macroLink("", "test@Lib:mylib")]
[h: broadcast(link)]
Last edited by Merudo on Sun Jul 14, 2019 2:46 pm, edited 2 times in total.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: execLink() and broadcast()

Post by aliasmask »

Well, it's not wrong, just not what you thought. For example, if my macro was called, outputToTim then it makes perfect sense.

Post Reply

Return to “MapTool”