Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Trigger API Function by CharSheet button

Hey, i want to trigger a funktion within a Script, when a Button on a Charactersheet is Pressed the function is supossed to get 2 Arguments. is this possible? Thx for your Help
1408464099
The Aaron
Roll20 Production Team
API Scripter
Do you mean you want the pushing of the button to prompt the player for input, which is then passed to an API command? You can prompt a player with the query macro construct: ?{Prompt text here|default value} and you can pass that to an API command like this: !api-command ?{Prompt 1|0} ?{Prompt 2|text} and then I'm pretty sure you can just put that as the target of your button in the character sheet, but you might want to ask about that in the character sheets forum.
1408465698
Steve D.
Sheet Author
API Scripter
I just tried something like this the other day with the edge of the empire sheet and dice script and it works fine. I used @{target|attribute} and ?{prompt 1|0} and they passed into the api without a problem.
i dont realy understand how it should work here since i belive that i can't use the ! or ? in a charactersheet. i was looking for a solution to something like that: <button type="roll" name="roll_something" value="/roll 1d6 /callfunktion">
you can use anything in a rollable button that you can use in a macro, including !api commands. .
ah ok thx so all i have to do is create a !api command and post it into the val. Thx i will try that then