Advertisement Create a free account

Emulate a click on a button on the character sheet via api

1570208159
Hey guys, it's me again! I was digging through the forums for several hours now but I haven't found a solution to the problem although I think it will be quite easy. (Sadly the documentation of the API is really bad guys. :/ ) The D&D 3.5 sheet comes with buttons on the character sheet that trigger attack macros. For not having to open 30 different character sheets in battle I'm writing a macro to trigger the attack macro on the corresponding token. So far I have no clue how to press a button. I wrote several API scripts that toggle values of checkboxes and stuff. But how can I trigger the macro as if it was clicked via the sheet button?
1570208585
keithcurtis
Forum Champion
API Scripter
If I can step this back a bit, what are you trying to accomplish? Those sheet macros can already be triggered with chat commands. Also, there are some great scripts that already do what it sounds like you are trying to accomplish, such as Universal Chat Menus.
1570209038
I want this macro to be executed via API: &{template:DnD35Attack} {{pcflag=true}} {{name=@{character_name}}} {{subtags=führt @{weapon1name} gegen den Feind }} {{critconfirm1=Kritischer Treffer? [[ @{weapon1attackcalc} ]] }} {{fumbleroll=Patzer! }} {{attack1=gegen einen Vert.-Wert von [[ @{weapon1attackcalc} ]] }} {{damage1= @{character_name} verwundet den Gegner mit [[ @{weapon1damage} ]] Schadenspunkten. }} {{critdmg1= ... und verursacht zusätzlichen kritischen Schaden in Höhe von [[@{weapon1crit}]]. }} {{fullattackflag= [[ 0d1 ]] If i copy this into the chat command it tells me: " TypeError: Cannot read property 'substring' of undefined" I think it's because it's missing the information about the characterObject. So I want to select my token and trigger a macro like "!attack weapon1" that then emulates a click on the character sheet button.
1570210460
Seph
Pro
Try adding "selected|" to each of the attributes. For example, @{selected|character_name}
1570211375
Kraynic
Pro
Sheet Author
I would second the recommendation of keithcurtis.&nbsp; The script he mentioned (once you set it up) can create a chat menu that will trigger any button on the sheet, or display the contents of any field you want on the sheet.&nbsp; It is pretty useful.&nbsp;&nbsp; <a href="https://app.roll20.net/forum/post/7474530/script-call-for-testers-universal-chat-menus/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/7474530/script-call-for-testers-universal-chat-menus/?pagenum=1</a>
1570211394
I knew it was simple. Thanks a lot Seph. It's doing exactly what it should.