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

[Script] Passing Values to a ScriptCards Mule

So, I'm working on setting up a Script Mule with ScriptCards that basically lets players in a Persona TTRPG roll the To-Hit and Damage rolls for their skills automatically with their stats calculated in, and be able to change what Skills are being used by just changing the"TestSkill#" part of the code.     !script {{       --#title|@{character_name} summon's their Persona; @{persona_name}!       --+       --+Lugh's Skills:|       --+|[t border=2 width=100%][tr][td] [sheetbutton]Skill1::SkillMule::TestSkill1[/sheetbutton][/td][td][sheetbutton]Skill2::SkillMule::TestSkill2[/sheetbutton][/td][td][sheetbutton]Skill3::SkillMule::TestSkill3[/sheetbutton][/td][td][sheetbutton]Skill4::SkillMule::TestSkill4[/sheetbutton][/td][/tr][tr][td][sheetbutton]Skill5::SkillMule::TestSkill5[/sheetbutton][/td][td][sheetbutton]Skill6::SkillMule::TestSkill6[/sheetbutton][/td][td][sheetbutton]Skill7::SkillMule::TestSkill7[/sheetbutton][/td][td][sheetbutton]Skill8::SkillMule::TestSkill8[/sheetbutton][/td][/tr][/t]              --:EndOfCard|     }} If anyone has any suggestions on how to pass Attribute values from one sheet to another sheet's Macro's, I would greatly appreciate it.
1722304976

Edited 1722305026
Andrew R.
Pro
Sheet Author
Have you looked into the —S and —L commands? You could use them to pass values through the ScriptCards_Storage mule Character.  I use them in my 13th Age Glorantha game. 
I have not, I'll take a look, but I assume it takes values you set in one macro, and loads them in another macro that's nested?
So ScriptCards has a relatively new feature that you might be able to use. It's a built-in function `system;runaction`. It will allow one ScriptCard to run an ability on a character and pass in parameters to that ability. Per the changelog: v 2.7.4  - Added a new function: --~|system;runaction;character_id;abilityname;param1;param2;param3;param4;...              This function will look for an ability called "abilityname" (case sensitive) on character "charcter_id" and read the Action property of the ability. It will replace the text [REPL1], [REPL2]...              and so forth with the parameters passed in param1, param2, etc. The sequence -_-_ will be replaced in the final macro, allowing you to potentially add lines to anything that uses -- to separate              parameters, etc. Note that the calls are issued by the API, so there is no current player, so interactive scripts will not do anything (ie, targets, roll queries, etc.) but if the action you              are using takes ids, you can pass them as [REPL] items.              Example: Given the SetMacro ability on the "Macro_Mule": !token-mod --ids [REPL1] --set statusmarkers|[REPL2][REPL3]                          This will turn on the blue marker:--~|system;runaction;@{Macro_Mule|character_id};SetMarker;@{selected|token_id};+;blue              And this will turn it off: --~|system;runaction;@{Macro_Mule|character_id};SetMarker;@{selected|token_id};-;blue                          In these examples, [REPL1] gets replaced with the selected token id, [REPL2] gets replaced with either + or -, and [REPL3] gets replaced with blue. Obviously these can be variables or              other ScriptCards constructs.              Note that "runability" is an alias for "runaction" So you could pass in a list of skills in a chat menu and when your players choose the button, you could use system;runaction to pass in parameters to your SkillMule abilities.
Okay, now just a quick question, is it possible to nest that 'system;runaction' inside of a button to call for another macro?
Just so I fully understand and can give proper advice, can you explain exactly how you want this to work? Are you looking execute some ScriptCard and then display buttons in chat that will call another macro and pass in values based on the button clicked? Let me know and hopefully I can give you a better answer or maybe a working example.
Joshua N. said: Just so I fully understand and can give proper advice, can you explain exactly how you want this to work? Are you looking execute some ScriptCard and then display buttons in chat that will call another macro and pass in values based on the button clicked? Let me know and hopefully I can give you a better answer or maybe a working example. This is exactly what I was hoping for. I've tested out the —S and —L commands and they work really well for what I'm hoping to do since I want to basically pass the equivalent of Ability Score Mods to the second macro.
So this is a pretty barebones re-entry script that will display some chat buttons and then pass them into an ability. The ability being called just prints the values passed in: [REPL1] is [REPL2] The ScriptCard that calls it is like so: !script {{ --#title|Runaction Example --#sourceToken|@{selected|token_id} --#reentrant|runaction[*S:character_id] --~|array;define;StatArray;strength;dexterity;constitution;wisdom;intelligence;charisma --%stat|foreach;StatArray --+|[rbutton][&stat(totitlecase)]::RunAction;[&stat][/rbutton] --%| --:Done| --X| --:RunAction|stat --#hidecard|1 --~|system;runaction;@{ScriptCards_Storage|character_id};displayAction;[&reentryval];[*S:[&reentryval]_mod] --^Done| }} So that is a really stripped down example of a ScriptCard doing chat menus and passing values into another ability and running that ability. Let me know if you have any questions.