Link to run code in dialog

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
Hypatia
Cave Troll
Posts: 29
Joined: Sun Oct 21, 2012 5:30 am

Link to run code in dialog

Post by Hypatia »

How do I create a link within a dialog for players to click which will run code

i have found the macrolink function but that calls another macro.. I want the link to run the code itself.

EG MACRO called Heal on player token which opens a dialog within which is a clickable link to roll some dice for damage healed and another link which when clicked changes the state on the token etc

Thanks to anyone who answers

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Link to run code in dialog

Post by Full Bleed »

Hypatia wrote:
Wed Jul 15, 2020 8:14 am
How do I create a link within a dialog for players to click which will run code

i have found the macrolink function but that calls another macro.. I want the link to run the code itself.
I'm not sure I follow. A macrolink that calls another macro is "running code." It's used for exactly what you're asking for. You click it. It runs code.
EG MACRO called Heal on player token which opens a dialog within which is a clickable link to roll some dice for damage healed and another link which when clicked changes the state on the token etc
Is your Heal Macro popping an input window or a true Frame/Dialog window? You can't make clickable links in the input window... but you can in a Frame or Dialog.

http://lmwcs.com/rptools/wiki/Introduct ... and_Frames
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Hypatia
Cave Troll
Posts: 29
Joined: Sun Oct 21, 2012 5:30 am

Re: Link to run code in dialog

Post by Hypatia »

Yes it is a proper dialog .
yes I know a macro runs code but the macro is somewhere else...not on the player token which means lots of unnecessary faff of getting the properties from the original token by the time it has bounced to a global macro and a lib macro etc.



In a simpler example; I want a clickable link on a dialog or frame that is called ROLL DICE and rolls dice.when you click it .not calls another macro to roll dice.

Hope this makes sense

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Link to run code in dialog

Post by wolph42 »

it makes sense and its not possible, it might be if you're using jscript, as thats self contained in the frame, but if you're talking MT script, that HAS to be contained in a macro (or copy pasted straight into chat).

I guess the closest thing is that you enter some code in the frame as string e.g [r:roll(1,6)] and pass that onto a 'executeThis' macro which contains:
[r:evalMacro(arg(0))]

Post Reply

Return to “Macros”