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 .
×

[Script] ScriptCards - Thread #2

ScriptCards cannot currently delete an object. I have a small script I wrote that I call from some of my summoning ScriptCards that can deleted tokens to overcome the no delete shortcoming. I can post it if it is helpful but you will need something in addition to ScriptCards if you want to delete objects.
1768657752
Kurt J.
Pro
API Scripter
The inability to delete objects via ScriptCards was an intentional limitation to prevent people from creating malicious scripts. It isn't difficult to add that ability, but I'd make it configurable to allow the game owner to restrict it to GMs or something similar.
1769268164

Edited 1769268999
Keep higher one just returns zero. What am I doing wrong here? --=Skill|{@{selected|Grapple},@{selected|DX},@{selected|PunchSkill}}kh1 Edit: Newer mind, fixed it --=Skill|[[{@{selected|Grapple},@{selected|DX},@{selected|PunchSkill}}kh1]]
1770335083
Kurt J.
Pro
API Scripter
ScriptCards 3.0.14 headed to OneClick The latest version of ScriptCards is just about to go live on OneClick. Besides a couple of bug fixes, this version adds: - Support for setting bar4 values "intelligently" (like linking, etc. You could already set them individually) - Support for triggers for change:pin add:pin and destroy:pin Map pins are already manipulatable in ScriptCards via --! using the "pin" object type, so no changes were needed to support them. The OneClick change was merged on he back end today so it should be active in a day or so.
1772661180
Kurt J.
Pro
API Scripter
ScriptCards 3.0.16 headed to OneClick, 3.0.17 on GitHub Fast on the heels of 3.0.14, 3.0.16 is now on OneClick. Besides some internal cleanup and prep work for new features, there is only one major change: - Added the buttonwidth setting, which defaults to "auto". This setting is a per-line setting that can be set to a css size indicator (ie, 20%, or 50px, or 60em, etc.) and will update the style output for subsequent buttons using that width. Currently on the GitHub version, I've added a feature I'm calling "pointers" (maybe not the best name...) that allows you to store object properties on the Java side so they don't get mangled by running them through the ScriptCards text processor. Useful, for example, for transferring things like the Action property of a character ability that might contain script code.
Hi, Is it possible to use script cards to do the following on the 2024 beacon character sheet Add a new attribute to the Advanced Tools Attribute Tab Report the value of the new attribute Adjust the value of the new attribute I'm trying to set up a method of tracking and automatically adjusting resources if possible. If it is possible some working examples would be greatly appreciated Thanks
1776118022
Kurt J.
Pro
API Scripter
ScriptCards v 3.0.20 is now on OneClick The most recent version of ScriptCards is now live on OneClick. The following is a summary of the changes since 3.0.16: - Updated handout creation and modification to process inline formatting for notes properties. - Exposes NUMERIC_VERSION for read by other scripts through the API_META object. This is a numeric representation of the version number that can be used for easy comparison by other scripts. The format is major version * 10000 + minor version * 100 + patch version. For example, version 3.0.19 would be represented as 300190. - Implements message queuing for processing multiple ScriptCard messages in rapid succession. This prevents the scripts from running simultaneously and causing issues with shared variables. Each message will be processed in the order received, and the next message won't start processing until the previous one has finished.  - Added new setting: dontnotifyobservers . Defaults to 0. If set to 1, your script won't inform other APIs that are watching of token changes. - Added the ability to create (--!oh:NewHandoutID) and modify (--!h:ExistingHandoutID) handouts. When creating a handout, you can specify properties to set on the handout in the content section of the line, using the format PropertyName:Value. Separate multiple properties with | characters. If a value contains a | character, escape it with \\. (ex: name:My Handout|notes:"This is a note with a \\| character in it"). When modifying an existing handout, you can use the same format to specify properties to change on the handout.  When creating handouts, the ID of the new handout will be returned in the string variable listed after the "oh:" in the tag. Creation Example: --!oh:HandoutID|name:"Modified Handout"|notes:"This is a handout note from ScriptCards" Update Example: --!h:[&HandoutID]|gmnotes:"This note was added after creation" - New Setting: titletextalign (default: center). This controls the text-align CSS property for title text. Note that this only applies to title text, not subtitle or body text. Valid values are any valid CSS text-align value, such as left, right, center, justify, etc. - New Setting: disablevariableexpansion (default: 0). When set to 1, variable expansion will be disabled for all variables. - Pointer variables are now included in stashed scripts when using the #reentrant option or --i statements. - Added new array function: abilities. Like attributes, this builds an array containing the object IDs of all abilities on a character. The syntax is:   --~|array;abilities;ArrayName;CharacterID   Where ArrayName is the name of the array to create and CharacterID is the ID of the character whose abilities you want to list. You can optionally include a filter parameter at the end to only include abilities that start with the filter text. - Added --P (pointer) commands. Currently supported are --Pread and --Pset. Both commands use the same syntax:   --P[r or s]|[PointerName]::ObjectID::PropertyName   Using "r" will look for an object with ID ObjectID and if found, will set the pointer variable PointerName to the value of the specified property on that object. Using "s" will set the specified property on the object to the value of the pointer variable. This is useful for transfering information that will get mangled by ScriptCard's normal parsing process, such as the content of an action on a character which might contain script cards code or other things that would be misinterpreted when read to/from a string variable.   Example:   !script {{      --Pr|TestPtr::@{selected|character_id}::name     --Ps|TestPtr::@{target|token_id}::tooltip   }}   This (admittedly trivial) example reads the name of the selected character into a pointer variable called TestPtr, and then sets the tooltip of the targeted token to that name.   Here is a more robust example that builds a menu of abilities to copy from one character to another:   !script {{   --#reentrant|CopyAbilities-[&SendingPlayerID]   --&id|@{selected|character_id}   --&tid|@{target|character_id}   --#title|Ability Copy   --#leftsub|From [*[&id]:name]   --#rightsub|To [*[&tid]:name]   --+|[c][b]Click abilities to copy[/b][/c]   --~dummy|array;abilities;ability_list;[&id]   --%abils|foreach;ability_list     --&Name|[*O:[&abils]:ability:name]     --+|[c][rbutton][&Name]::COPY;[&abils][/rbutton][/c]   --%|   --+|[br]   --+|[c][rbutton]COPY ALL ABILITIES::COPYALL[/rbutton][/c]   --+|[br]   --+|[c][b]Copying abilities may create duplicates that need to be manually cleaned up.[/b][/c]   --X|   --:COPY|     --&Name|[*O:[&reentryval]:ability:name]     --&Desc|[*O:[&reentryval]:ability:description]     --&IsAction|[*O:[&reentryval]:ability:istokenaction]     --Pread|ActionPointer::[&reentryval]::action     --+|Name: [&Name], Desc: [&Desc], IsAction: [&IsAction]     --!ob:NewID:[&tid]:[&Name]:[&isAction]|temp     --Pset|ActionPointer::[&NewID]::action     --+|Copied action [&Name] from [*[&id]:name] to [*[&tid]:name]   --X|   --:COPYALL|   --%abils|foreach;ability_list     --+Abil|[&abils],      --&Name|[*O:[&abils]:ability:name]     --&Desc|[*O:[&abils]:ability:description]     --&IsAction|[*O:[&abils]:ability:istokenaction]     --Pread|ActionPointer::[&abils]::action     --+|Name: [&Name], Desc: [&Desc], IsAction: [&IsAction]     --!ob:NewID:[&tid]:[&Name]:[&isAction]|temp     --Pset|ActionPointer::[&NewID]::action   --%|   --X| }}
1776181622

Edited 1776181658
HT
Pro
Dear Roll20 Comunity this is my Script for Monster Lore Roll with Script Cards.  thanks !script {{ --#whisper|gm --#title|Dungeon Master Tools --#emoteState|0 --/|==================  Style ======================= --#titlecardbackground|#3A2F1B --#titleFontColor|#F5E6B3 --#bodyFontSize|13px --#evenrowbackground|#FFFFFF --#evenRowFontColor|#2B2415 --#oddrowbackground|#FFFFFF --#oddRowFontColor|#2B2415 --#buttonbackground|#ed0510 --#buttontextcolor|#FFFFFF --#buttonFontSize|13px --#buttonBorderColor|#000000 --#buttonPadding|0px --/|==================  Token and Characheter Reserach via Name ======================= --~tokencntpw|array;pagetokens;alltokenspw;[*C:playerpageid]   --~TokenIdpw|array;getfirst;alltokenspw --&CharIdpw|[*[&TokenIdpw]:t-represents] --?[&TokenIdpw] -eq ArrayError|ENDLOOPPW --:LOOPCHECKPW| --&CharIdpw|[*[&TokenIdpw]:t-represents] --?[*[&TokenIdpw]:t-layer] -ne objects|CONTINUEPW --?"[*[&TokenIdpw]:npc]" -eq 1|CONTINUEPW --?"[*[&TokenIdpw]:t-represents]" -inc "-"|STARTPW --^CONTINUEPW| --:STARTPW| --&CharIdpw|[*[&TokenIdpw]:t-name] --&tblpw|+|[&CharIdpw] --:CONTINUEPW| --~TokenIdpw|array;getnext;alltokenspw --?[&TokenIdpw] -ne ArrayError|LOOPCHECKPW --:ENDLOOPPW| --IChoose player would use **Monster Knowledge** from menu   ;Open player dropdown menu|q;PlayerName;Chose a Player?[&tblpw] --IChoose monster choosen player want to **analyze**  ;Target a monster|t;MonsterTarget;Target a MonsterMonster --~TokenCount|array;pagetokens;PartyTokenArr;[*C:playerpageid];char --%tokenid|foreach;PartyTokenArr --?"[*[&tokenid]:character_name]" -eq "[&PlayerName]"|Match --^Next| --:Match| --=MatchCount|[$MatchCount]+1 --&FoundTokenID|[&tokenid] --&FoundCharID|[*[&tokenid]:character_id] --:Next| --%|  --/|==================  Global Skill Bonus =======================  --=totalroll|+ --Rfirst|[&FoundCharID];repeating_skillmod --?"[*R:global_skill_active_flag]" -eq "NoRepeatingAttributeLoaded"|ENDGGM --:ggmLoop| --=ggmTmpRoll|[*R:global_skill_roll] --&_ggmNameRoll|[*R:global_skill_name] --=totalroll|[$totalroll]+[$ggmTmpRoll.Total] --Rnext| --?"[*R:global_save_name]" -ne "NoRepeatingAttributeLoaded"|_ggmLoop --:ENDGGM| --/|==================  Parameters  ======================= --#targetToken|[&MonsterTarget] --=JackBonus|[*[&FoundCharID]:jack_bonus] --&MonsterName|[*T:npc_name] --=CreatureCR|[*T:npc_challenge] {MIN:1} --&DebugCR|[*T:npc_challenge] --&MonsterType|[*T:npc_type] --=LoreRoll|1d20 --=KnDCBase|[$CreatureCR]+4 --=KnDCAdvanced|[$CreatureCR]+8  --=KnDCExpert|[$CreatureCR]+12 --/|==================  Assign Skill and Variable By Monster Type ======================= --?"[&MonsterType]" -inc construct -or ?"[&MonsterType]" -inc dragon -or ?"[&MonsterType]" -inc elemental -or ?"[&MonsterType]" -inc ooze| [   --&SkillTitle|Arcana   --&SymbolCheck| --=MonsterLoreValue|[*[&FoundCharID]:arcana_bonus]+[$totalroll]+[$JackBonus]   --&TCB|5b3c88   --&TCF|FFFFFF   --&ERB|e6def5   --&ORB|f3effb --]| --?"[&MonsterType]" -inc beast -or ?"[&MonsterType]" -inc aberration -or ?"[&MonsterType]" -inc monstrosity -or ?"[&MonsterType]" -inc plant |[   --&SkillTitle|Nature   --&SymbolCheck|   --=MonsterLoreValue|[*[&FoundCharID]:narture_bonus]+[$totalroll]+[$JackBonus]   --&TCB|3f6b3f   --&TCF|FFFFFF   --&ERB|dfeedd   --&ORB|eef7ec --]| --?"[&MonsterType]" -inc celestial -or ?"[&MonsterType]" -inc fey -or ?"[&MonsterType]" -inc fiend -or ?"[&MonsterType]" -inc undead |[   --&SkillTitle|Religion   --&SymbolCheck|   --=MonsterLoreValue|[*[&FoundCharID]:religion_bonus]+[$totalroll]+[$JackBonus]   --&TCB|6b5a2e   --&TCF|FFFFFF   --&ERB|e8e5dc   --&ORB|f4f2ea --]|  --?"[&MonsterType]" -inc humanoid -or ?"[&MonsterType]" -inc giant  |[   --&SkillTitle|History   --&SymbolCheck|   --=MonsterLoreValue|[*[&FoundCharID]:history_bonus]+[$totalroll]+[$JackBonus]   --&TCB|6b5a2e   --&TCF|FFFFFF   --&ERB|e8e5dc   --&ORB|f4f2ea --]| --/|==================  Style by Skill ======================= --#title|Monster Lore [&MonsterName] --#leftsub|[&SymbolCheck] [&SkillTitle] Check --#titlecardbackground|#[&TCB] --#titleFontColor|#[&TCF] --#evenrowbackground|#[&ERB] --#oddrowbackground|#[&ORB]     --/|==================  Program =======================    --=TotalRollSkill|[$MonsterLoreValue]+[$LoreRoll]    --=TotalBonus|[$totalroll]+[$JackBonus]     --+|[c]**[&PlayerName]:** *Skill* + *Bonus*:[$MonsterLoreValue]+*Roll*:[$LoreRoll] = Total [$TotalRollSkill] [/c] [c]∘₊✧──────── ⋆⋅☆⋅⋆ ───────✧₊∘ [/c] --?[$TotalRollSkill] -lt [$KnDCBase]|NoKnowledge --?[$TotalRollSkill] -ge [$KnDCBase] -and [$TotalRollSkill] -lt [$KnDCAdvanced]|>BaseKnowledge --?[$TotalRollSkill] -ge [$KnDCAdvanced] -and [$TotalRollSkill] -lt [$KnDCExpert]|>AdvancedKnowledge --?[$TotalRollSkill] -ge [$KnDCExpert]|>ExpertKnowledge --/|==================  Check Fails =======================   --:NoKnowledge| --+|[c]Minimum: [$KnDCBase]; No Knowledge obtained![/c] --^Final| --/|==================  Minimum Informations ======================= --:BaseKnowledge| --+|[c]∘₊✧──────── CD [$KnDCBase] ───────✧₊∘[/c] --+**Name**|[&MonsterName(totitlecase)] (**CR [&DebugCR]**) --+**Type**|[&MonsterType]  --+**Languages**|[*T:npc_languages] --+**Senses**|[*T:npc_senses] --+|[c]∘₊✧──────── ⋆⋅☆⋅⋆ ───────✧₊∘ [/c] --^Final| --/|==================  Advanced Informations =======================      --:AdvancedKnowledge| --+|[c]∘₊✧────────────────────✧₊∘[/c] --+**Name**|[&MonsterName(totitlecase)] (**CR [&DebugCR]**) --+**Type**|[&MonsterType]  --+**Languages**|[*T:npc_languages] --+**Senses**|[*T:npc_senses] --+|[c]∘₊✧────────  CD [$KnDCAdvanced]  ──────✧₊∘[/c] --+**Speed**|[*T:npc_speed]   --&TraitOutputAdv| --Rfirst|[*T:character_id];repeating_npctrait --?"[*R:name]" -eq "NoRepeatingAttributeLoaded"|NoTraitsAdv --:TraitLoopAdv| --&TraitOutput|[&TraitOutput][B][*R:name][/B]: [*R:description][br] --Rnext| --?"[*R:name]" -ne "NoRepeatingAttributeLoaded"|TraitLoopAdv --+|[&TraitOutputAdv] --X| --:NoTraitsAdv| --+|No Trait for this Monster --+|[c]∘₊✧──────── ⋆⋅☆⋅⋆ ───────✧₊∘ [/c] --^Final| --/|==================  Maximum Informations =======================      --:ExpertKnowledge| --+|[c]∘₊✧────────────────────✧₊∘[/c] --+**Name**|[&MonsterName(totitlecase)] (**CR [&DebugCR]**) --+**Type**|[&MonsterType]  --+**Languages**|[*T:npc_languages] --+**Senses**|[*T:npc_senses] --+|[c]∘₊✧────────────────────✧₊∘[/c] --+**Speed**|[*T:npc_speed]   --&TraitOutputExp| --Rfirst|[*T:character_id];repeating_npctrait --?"[*R:name]" -eq "NoRepeatingAttributeLoaded"|NoTraitsExp --:TraitLoopExp| --&TraitOutputExp|[&TraitOutputExp][B][*R:name][/B]: [*R:description][br] --Rnext| --?"[*R:name]" -ne "NoRepeatingAttributeLoaded"|TraitLoopExp --+|[&TraitOutputExp] --^AfterTraitsExp| --/|==================  Null Program ======================= --:NoTraitsExp| --+|No Trait for this Monster --:AfterTraitsExp| --+|[c]∘₊✧──────── CD [$KnDCExpert] ───────✧₊∘ [/c] --?"[*T:npc_vulnerabilities]" -ne ""|VulYes|VulNo --:VulYes --&Vulnerabilites|[*T:npc_vulnerabilities] --^DoneVul --:VulNo| --&Vulnerabilites|No Vulnerabilities --:DoneVul| --?"[*T:npc_resistances]" -ne ""|ResYes|ResNo --:ResYes --&Resistances|[*T:npc_resistances] --^DoneRes --:ResNo| --&Resistances|No Resistances --:DoneRes| --?"[*T:npc_immunities]" -ne ""|ImmYes|ImmNo --:ImmYes --&Immunities|[*T:npc_immunities] --^DoneImm --:ImmNo| --&Immunities|No Immunities --:DoneImm|   --?"[*T:npc_condition_immunities]" -ne ""|ConYes|ConNo --:ConYes --&Condition|[*T:npc_condition_immunities] --^DoneCon --:ConNo| --&Condition|No Condition Immunities --:DoneCon| --+**Vulnerabilities**|[&Vulnerabilites] --+**Resistances**|[&Resistances] --+**Immunities**|[&Immunities] --+**Condition Immunities**|[&Condition] --^Final| --:Final|  --/|================== End ======================= --+|[c]∘₊✧──────── ⋆⋅☆⋅⋆ ───────✧₊∘ [/c]   --X| }}