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] ScriptCards - My "Spiritual Successor" to PowerCards

1644240164

Edited 1644240372
Kurt J. said: Your call to --@ is missing its vertical bar (should be --@radar| followed by parameters) Also, you'll need to define string variables to use in place of the {{ and }}, as they would confuse the code as to what is part of the ScriptCard. Something like: --&oBrac|{ --&cBrac|} and then use them in the call: !scriptcard {{ --&oBrac|{ --&cBrac|} --@radar|[&oBrac][&oBrac] _range|30ft _wavespacing|35 _wavedelay|50 _wavelife|200 _pinglife|4000 _wavetype|square _layers|gm, token, map _tokfilter|gmnotes: Magic#858585 _LoS|yes _title|Detect Magic _units|feet, 5e _graphOptions|grid, circle, reticle _output| graph, table, compact [&cBrac][&cBrac] }} So interestingly, this works if I invoke from the sheet (as written I still need to pass the token and player ids to Radar - but for this discussion, it works). Thanks! I'd never have thought to call brackets as a variable in a thousand years.  The interesting part is, if I call the spell from the 5e Action Menu, I still just get the text of the macro and not the output.  I wonder if the fix for the action menu (presuming there is one) would mean that we don't actually need to call the script card in the description - that it would parse the API call the same way the sheet does currently. 
Kurt J. said: Bradley P. said: Kurt Last night was my game night and the Action Menu script failed to work as expected. It seems that when MOST of the players use the action menu, we see a message similar to  -Mv5JsC1KJlluXyJcqOy|Detect-Magic     Everything after the | is the spell that they were trying to use but the beginning is always the same!.  One other player and me seem to be able to use the action menu script with no problems.  All script macros are available to "All Players" so I am assuming that maybe the Spell-Mule is the problem but not sure want to do.  I rebooted the API sandbox while we were playing too but no go.   Has this been seen by others? Fix? Brad Is the spell mule available to all players as well? I thought so.  One player said that the Action Menu was working completely for him.   I will double check the spell mule character when I get home. This week I work OT so I don’t have a lot of time once I’m home. I might have to create a bogus Roll20 account and log in and try the scripts.  As the dm it’s hard to flush out permission issues when everything works for you.
1644248794
Kurt J.
Pro
API Scripter
Michael C. said: @Kurt J. - I noticed a change needed on your (most excellent) casino script: Line 201: --?&AllowSpotBonus -eq 1|=Res;1d20 + [*S:[&SpotBonusAttribute]]|=Res;1d20 needs the brackets around &AllowSpotBonus.  (There are also some minor spelling errors that don't effect game play (e.g. "time" should be plural in 2 cases, etc.) and I leave up to designers to fix or not fix.) Also, I am currently working on the script to automatically test for sufficient money on hand to make the initial bet and to adjust a character's gp (DnD 5e) for wins and losses.  Thus, though I am sure there are better ways to approach this, I have added after the setting of the default bet:   --/|Test if default wager or change in wager exceeds player's cash on hand   --:WagerTest|      --=CashOnHand|[*S:gp]      --?[$CashOnHand.Raw] -ge [$Wager.Raw]|Remove Bet      --+|[#ffff00][b][c]You don't have enough money to play![/#][/b][/c]   --X| and...   --/|Remove bet from character's pool   --:Remove Bet|      --=GP|[*S:gp] - [$Wager.Raw]      --@setattr| _charid [*S:character_id] _gp|[$GP]  _silent above the following line...   --:DISPLAY_CASINO_MENU| Note that similar test and adjustment will need to be made after a change of wager.  Anyone working on the outcome of each game should note that (correctly) the winning variable [$Payout.Raw] effectively contains the return of the bet within the winnings while a losing wager [$Wager.Raw] contains only the bet.  In reality, the bet is forfeit when made and the payout is always a multiple of the bet in order for the winner to have a return greater than the initial bet.  A call procedure to a subroutine to adjust the character pool for winnings (no losing routine needed if the bet is deducted initially) will need to be made in each game and, for some of the games, in more than one location.  (Also still working on that.)  Thanks for spotting that error :) I made a fix and have uploaded version 1.10. It also includes a new game - Press Your Luck, in which the player rolls a (configurable) sided die and attempts to guess if the next roll will be higher or lower. When they are right, they can continue with increased payouts, with up to 5 rolls being made. A wrong guess or a tie on the dice loses, and the player can opt to collect before they hit the limit as well. Press You Luck is more interactive than the other games, and as a result will add more output to the game-wide chat.
I'm having trouble using these two lines of code from the Bless script:   --@setattr|_charid [*[%2%]:character_id] _repeating_savemod_$0_global_save_active_flag|1 _silent   --@setattr|_charid [*[%2%]:character_id] _repeating_tohitmod_$0_global_attack_active_flag|1 _silent When I run the macro, I get the following error messages in Chat window.    Errors    Repeating row number 0 invalid for character _________ and repeating section repeating_savemod.    Errors    Repeating row number 0 invalid for character _________ and repeating section repeating_tohitmod. Do I need to have a special API script installed to run this? I don't have trouble setting other attributes on character sheets. If not, anyone have an idea why I'm getting these errors? Thanks.
Kurt J. said: Bradley P. said: Kurt The new script is better but there still seems to be an issue with the first roll. Brad What issue are you having? In the results line, the 2d20 came up with a 12 and a 17, and the 12 was dropped (hence the [x x] around it and the 17 kept. How do I get the script to roll advantage?
Seems the turnorder is no longer pushing to the initiative tracker. I have been using this regularly and I think a roll20 update just broke it. I am running Deadlands Classic so the initiative roll does a bulk roll using all of the PCs and NPCs with about 50 lines of script each. I pulled the line in question out and am still not getting a response from it. For an example; !scriptcard {{   --~turnorder|turnorder;addtoken;@{selected|token_id};[$turns] }}
Hi All, We play D&D 3.5 with Diana character sheet and in order to simplify some of the calculations i've created a few attack macros for my players. As my scripting ability is very limited i need some help to fix some issues i'm facing with my macros. I'm open to suggestions as well on how to better implement my automations as i'm sure there is a better and more elegant way to script these macros, considering that i'm learning to code along the way.. These are the macros that are currently working, i will post them in case anyone need them or have suggestions. The thing to take in consideration about my macros is that i'm not DMing the game, so sometimes the npctoken have no character sheets attached and in this case the players use macros on other players for the sake of launching their attack. This is evident in particular in my Critic calculation. Barbarian Macros RAGE TOGGLING ON !scriptcard   {{   --=DurataIra|?{Durata Ira Max=(@{selected|con-mod}+3)|0}   --@act|-1 [$DurataIra] _IraBarbarica   --:DoneDurataIra|   --=NewHitPoints|@{selected|level}*2     --#title|IRA per [$DurataIra] round   --#leftsub|(+4FO, +4CO, +2TS Volontà e -2CA +[$NewHitPoints]pf)   --#sourceToken|@{selected|token_id}   --#emoteText|@{selected|character_name} entra in una Furia Barbarica|   —-:IRA|   --@setattr|_sel _silent _str-temp|4 _con-temp|4 _willtempmod|2 _miscac2bonus|-2   --@setattr|_sel _silent _mod _hitpoints|[$NewHitPoints]   --@token-mod|_set _silent statusmarkers|+strong }} RAGE TOGGLING OFF !scriptcard   {{   --=NewHitPoints|@{selected|level}*2   --#title|IRA Finita   --#leftsub|(Affaticato, non puo correre nè caricare per la durata dello scontro -[$NewHitPoints]pf)   --#sourceToken|@{selected|token_id}   --#emoteText|@{selected|character_name} è in preda alla stanchezza dopo il suo attacco di Ira.|     —-:FINE_IRA|   --@setattr|_sel _silent _str-temp|-2 _con-temp|-2 _willtempmod|0 _miscac2bonus|0   --@setattr|_sel _silent _mod _hitpoints|-[$NewHitPoints]   --@token-mod|_set _silent statusmarkers|-strong   --@token-mod|_set _silent statusmarkers|+back-pain }} RAGE RESET !scriptcard   {{   --=NewHitPoints|@{selected|level}*2   --#title|IRA reset   --#leftsub|(+0FO, +0CO, +0TS Volontà e 0CA)   --#sourceToken|@{selected|token_id}   --#emoteText|@{selected|character_name} è pronto ad incazzarsi nuovamente|     —-:NORMALE|   --@setattr|_sel _str-temp|0 _con-temp|0 _willtempmod|0 _miscac2bonus|0   --@token-mod|_set statusmarkers|-back-pain   --@token-mod|_set statusmarkers|-strong }} Barbarian Power Attack First Attack !scriptcard {{ --#title|@{selected|weapon1name} --#leftsub|@{selected|weapon1type} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|character_name} attacca @{target|character_name} con --=TargetAC|@{target|armorclass} --:DoneWithAC| --=AttPod|?{Attacco Poderoso Max=@{selected|bab}|0} --:DoneWithAttPod --=Critico|@{selected|weapon1critmult}-1 --:DoneWithCritico --=BonusStatDamage|@{selected|str-mod}/2 {FLOOR} +@{selected|str-mod} --:DoneWithBonusStatDamage --=AttackRoll|1d20 + @{selected|BAB}[BAB] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] - [$AttPod][Attacco Poderoso] --+Attacca|@{selected|character_name} rolls [$AttackRoll] vs AC [$TargetAC]. --?[$AttackRoll.Base] -eq 20|Conferma --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit|Miss --^Final| --:Hit| --=Damage|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [[$AttPod]*2][Attacco Poderoso]] --+Danni!|L'attacco colpisce @{target|token_name} con [$Damage] danni. --^Final| --:Miss| --=Miss|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [[$AttPod]*2][Attacco Poderoso]] --+Danni!|L'attacco non colpisce @{target|token_name} con [$Miss] danni. --^Final| --:Conferma| --=Conferma|1d20 + @{selected|BAB}[BAB] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] - [$AttPod][Attacco Poderoso] --=Damage2|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [[$AttPod]*2][Attacco Poderoso]] --=Critico|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [[$AttPod]*2][Attacco Poderoso] *[$Critico] --+Critico!|Se [$Conferma] colpisce, allora l'attacco colpisce @{target|token_name} con [$Damage2] + [$Critico] danni critici. --^Final| --:Fumble| --=Fumble|1d100 --+1!| Controlla la tabella percentuale [$Fumble]. --:Final| }} Barbarian Power Attack Second Attack !scriptcard {{ --#title|@{selected|weapon1name} --#leftsub|@{selected|weapon1type} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|character_name} attacca @{target|character_name} con --=TargetAC|@{target|armorclass} --:DoneWithAC| --=AttPod|?{Attacco Poderoso Max=@{selected|bab2}|0} --:DoneWithAttPod --=Critico|@{selected|weapon1critmult}-1 --:DoneWithCritico --=BonusStatDamage|@{selected|str-mod}/2 {FLOOR} +@{selected|str-mod} --:DoneWithBonusStatDamage --=AttackRoll|1d20 + @{selected|BAB2}[BAB2] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] - [$AttPod][Attacco Poderoso] --+Attacca|@{selected|character_name} rolls [$AttackRoll] vs AC [$TargetAC]. --?[$AttackRoll.Base] -eq 20|Conferma --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit|Miss --^Final| --:Hit| --=Damage|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [[$AttPod]*2][Attacco Poderoso]] --+Danni!|L'attacco colpisce @{target|token_name} con [$Damage] danni. --^Final| --:Miss| --=Miss|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [[$AttPod]*2][Attacco Poderoso]] --+Danni!|L'attacco non colpisce @{target|token_name} con [$Miss] danni. --^Final| --:Conferma| --=Conferma|1d20 + @{selected|BAB2}[BAB2] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] - [$AttPod][Attacco Poderoso] --=Damage2|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [[$AttPod]*2][Attacco Poderoso]] --=Critico|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [[$AttPod]*2][Attacco Poderoso] *[$Critico] --+Critico!|Se [$Conferma] colpisce, allora l'attacco colpisce @{target|token_name} con [$Damage2] + [$Critico] danni critici. --^Final| --:Fumble| --=Fumble|1d100 --+1!| Controlla la tabella percentuale [$Fumble]. --:Final| }} Paladin Power Attack First Attack !scriptcard {{ --#title|@{selected|weapon1name} --#leftsub|@{selected|weapon1type} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|character_name} attacca @{target|character_name} con --=TargetAC|@{target|armorclass} --:DoneWithAC| --=AttPod|?{Attacco Poderoso Max=@{selected|bab}|0} --:DoneWithAttPod --=Critico|@{selected|weapon1critmult}-1 --:DoneWithCritico --=BonusStatDamage|@{selected|weapon1damagestat} --:DoneWithBonusStatDamage --=AttackRoll|1d20 + @{selected|BAB}[BAB] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] - [$AttPod][Attacco Poderoso] --+Attacca|@{selected|character_name} rolls [$AttackRoll] vs AC [$TargetAC]. --?[$AttackRoll.Base] -eq 20|Crit --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit|Miss --^Final| --:Hit| --=Damage|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [$AttPod][Attacco Poderoso]] --+Danni!|L'attacco colpisce @{target|token_name} con [$Damage] danni. --^Final| --:Miss| --=Miss|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [$AttPod][Attacco Poderoso]] --+Danni!|L'attacco non colpisce @{target|token_name} con [$Miss] danni. --^Final| --:Crit| --=Damage2|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [$AttPod][Attacco Poderoso]] --=Conferma|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] --=Critico|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [$AttPod][Attacco Poderoso] *[$Critico] --+Critico!|L'attacco colpisce @{target|token_name} con [$Damage2] più [$Critico] danni critici se confermati. Tiro x Conferma [$[$Critico] --^Final| --:Fumble| --=Fumble|1d100 --+1!| Controlla la tabella percentuale [$Fumble]. --:Final| }} Paladin Power Attack Second Attack !scriptcard   {{   --#title|@{selected|weapon2name}   --#leftsub|@{selected|weapon2type}   --#sourceToken|@{selected|token_id}   --#targetToken|@{target|token_id}   --#emoteText|@{selected|character_name} attacca @{target|character_name} con   --=TargetAC|@{target|armorclass}   --:DoneWithAC|   --=AttPod|?{Attacco Poderoso Max=@{selected|bab}|0}   --:DoneWithAttPod   --=Critico|@{selected|weapon2critmult}-1   --:DoneWithCritico   --=BonusStatDamage|@{selected|weapon2damagestat}   --:DoneWithBonusStatDamage   --=AttackRoll|1d20 + @{selected|BAB}[BAB] + @{selected|weapon2stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2focus}[ArmaFocalizzata] - [$AttPod][Attacco Poderoso]   --+Attacca|@{selected|character_name} rolls [$AttackRoll] vs AC [$TargetAC].   --?[$AttackRoll.Base] -eq 20|Crit   --?[$AttackRoll.Base] -eq 1|Fumble   --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit|Miss   --^Final|   --:Hit|   --=Damage|@{selected|weapon2damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] + [$AttPod][Attacco Poderoso]]   --+Danni!|L'attacco colpisce @{target|token_name} con [$Damage] danni.   --^Final|   --:Miss|   --=Miss|@{selected|weapon2damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] + [$AttPod][Attacco Poderoso]]   --+Danni!|L'attacco non colpisce @{target|token_name} con [$Miss] danni.   --^Final|   --:Crit|   --=Damage2|@{selected|weapon2damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] + [$AttPod][Attacco Poderoso]]   --=Conferma|@{selected|weapon2damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata]   --=Critico|@{selected|weapon2damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] + [$AttPod][Attacco Poderoso] *[$Critico]   --+Critico!|L'attacco colpisce @{target|token_name} con [$Damage2] più [$Critico] danni critici se confermati. Tiro x Conferma [$[$Critico]   --^Final|     --:Fumble|   --=Fumble|1d100   --+1!| Controlla la tabella percentuale [$Fumble].   --:Final| }} Explorer Skirmishing Attack !scriptcard {{ --#title|@{selected|weapon1name} --#leftsub|@{selected|weapon1type} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|character_name} attacca @{target|character_name} con --=TargetAC|@{target|armorclass} --:DoneWithAC| --=Critico|@{selected|weapon1critmult} --:DoneWithCritico| --=BonusStatDamage|@{selected|weapon1damagestat} --:DoneWithBonusStatDamage| --=SchermagliaDanniAggiuntivi|2d6 --=Schermaglia|?{Schermaglia solo se ti muovi di almeno 3m + CA+1|Si, 0|No, 1} --?[$Schermaglia] -eq 0|AttaccoSchermaglia --?[$Schermaglia] -eq 1|Attacco --:DoneWithSchermaglia| --^Final| --:AttaccoSchermaglia| --=AttaccoSchermaglia|1d20 + @{selected|BAB}[BAB] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] --+Attacca|@{selected|character_name} rolls [$AttaccoSchermaglia] vs AC [$TargetAC]. --?[$AttaccoSchermaglia.Base] -eq 20|CritSchermaglia --?[$AttaccoSchermaglia.Base] -eq 1|FumbleSchermaglia --?[$AttaccoSchermaglia.Total] -ge [$TargetAC.Total]|DamageSchermaglia|Miss --^Final| --:DamageSchermaglia| --=DamageSchermaglia|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [$SchermagliaDanniAggiuntivi][Schermaglia] --+Danni!|L'attacco colpisce @{target|token_name} con [$DamageSchermaglia] danni di cui[$SchermagliaDanniAggiuntivi] di danni schermaglia| --^Final| --:Miss| --=Miss|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [$SchermagliaDanniAggiuntivi][Schermaglia] --+Danni!|L'attacco non colpisce @{target|token_name} con [$Miss] danni di cui [$SchermagliaDanniAggiuntivi] di danni schermaglia| --^Final| --:CritSchermaglia| --=Critico|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] + [$AttPod][Attacco Poderoso] *[$Critico] +[$SchermagliaDanniAggiuntivi][Schermaglia] --+Critico!|L'attacco colpisce @{target|token_name} con [$Critico] danni di cui [$SchermagliaDanniAggiuntivi] di danni schermaglia| --^Final| --:FumbleSchermaglia| --=Fumble|1d100 --+1!| Controlla la tabella percentuale [$Fumble]. --:Final| --:Attacco| --=Attacco|1d20 + @{selected|BAB}[BAB] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] --+Attacca|@{selected|character_name} rolls [$Attacco] vs AC [$TargetAC]. --?[$AttaccoSchermaglia.Base] -eq 20|Crit --?[$AttaccoSchermaglia.Base] -eq 1|Fumble --?[$AttaccoSchermaglia.Total] -ge [$TargetAC.Total]|Hit|Miss --^Final| --:Hit| --=Damage|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] --+Danni!|L'attacco colpisce @{target|token_name} con [$Damage] danni| --^Final| --:Miss| --=Miss|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] --+Danni!|L'attacco non colpisce @{target|token_name} con [$Miss] danni. --^Final| --:Crit| --=Damage2|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] *[$Critico] --=Conferma|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] --=Critico|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] *[$Critico] --+Critico!|L'attacco colpisce @{target|token_name} con [$Damage2] più [$Critico] danni critici se confermati. Tiro x Conferma [$Critico] --^Final| --:Fumble| --=Fumble|1d100 --+1!| Controlla la tabella percentuale [$Fumble]. --:Final| }} And here are the problems i'm having. This is a Macro for a Two Weapon Style player, 1 attack with main hand (-2) and 2 attacks with offhand (-2,-5) I can't manage to have the 3 attacks in one page, the macro stops after the first attack. !scriptcard {{ --:TITLE CARD DISPLAY| --#title|@{selected|weapon1name} e @{selected|weapon2name} --#leftsub|@{selected|weapon1type} e @{selected|weapon2type} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|character_name} attacca @{target|character_name} con due armi --:VARIABLES| --=TargetAC|@{target|armorclass} --:DoneWithAC| --=Critico1|@{selected|weapon1critmult} --=Critico2|@{selected|weapon2critmult} --:DoneWithCritico| --=BonusStatDamage|@{selected|weapon1damagestat} --=BonusStatDamage2|@{selected|weapon2damagestat} --:DoneWithBonusStatDamage| --:PROCEDURES| --:ATTACCOPRIMARIO| --=AttackRoll|1d20 + @{selected|BAB}[BAB] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] - 2[Combattere con due armi] --+Attacca|@{selected|character_name} attacca con la mano primaria e tira [$AttackRoll] vs AC [$TargetAC]. --?[$AttackRoll.Base] -eq 20|Conferma --?[$AttackRoll.Base] -eq 1|Fumble --?[$AttackRoll.Total] -ge [$TargetAC.Total]|Hit|Miss --^Final| --:Hit| --=Damage|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] --+Danni!|L'attacco colpisce @{target|token_name} con [$Damage] danni. --^Final| --:Miss| --=Miss|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] --+Danni!|L'attacco non colpisce @{target|token_name} con [$Miss] danni. --^Final| --:Conferma| --=Conferma|1d20 + @{selected|BAB}[BAB] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] --=Damage2|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] --=Critico|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] *[$Critico] --+Critico!|Se [$Conferma] colpisce, allora l'attacco colpisce @{target|token_name} con [$Damage2] + [$Critico] danni critici. --^Final| --:Fumble| --=Fumble|1d100 --+1!| Controlla la tabella percentuale [$Fumble]. --:Final| --:ATTACCOSECONDARIO| --=Offhand|1d20 + @{selected|BAB}[BAB] + @{selected|weapon2stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon2focus}[ArmaFocalizzata] - 2[Combattere con due armi] --+Attacca|@{selected|character_name} attacca con la mano secondaria e tira [$Offhand] vs AC [$TargetAC]. --=HitOffhand|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --?[$Offhand.Base] -eq 20|Conferma --?[$Offhand.Base] -eq 1|Fumble --?[$Offhand.Total] -ge [$TargetAC.Total]|HitOffhand|Miss --^Final| --:HitOffhand| --=Damage|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --+Danni!|L'attacco colpisce @{target|token_name} con [$Damage] danni. --^Final| --:Miss| --=Miss|@{selected|weapon1damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --+Danni!|L'attacco non colpisce @{target|token_name} con [$Miss] danni. --^Final| --:Conferma| --=Conferma|1d20 + @{selected|BAB}[BAB] + @{selected|weapon2stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] --=Damage2|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --=Critico|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] *[$Critico] --+Critico!|Se [$Conferma] colpisce, allora l'attacco colpisce @{target|token_name} con [$Damage2] + [$Critico] danni critici. --^Final| --:Fumble| --=Fumble|1d100 --+1!| Controlla la tabella percentuale [$Fumble]. --:Final| --:SECONDOATTACCOSECONDARIO| --=Offhand2|1d20 + @{selected|BAB}[BAB] + @{selected|weapon2stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2focus}[ArmaFocalizzata] - 5[Combattere con due armi] --+Attacca|@{selected|character_name} attacca nuovamente con la mano secondaria e tira [$Offhand2] vs AC [$TargetAC]. --=HitOffhand2|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --?[$Offhand2.Base] -eq 20|Conferma --?[$Offhand2.Base] -eq 1|Fumble --?[$Offhand2.Total] -ge [$TargetAC.Total]|HitOffhand2|Miss --^Final| --:HitOffhand2| --=Damage|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --+Danni!|L'attacco colpisce @{target|token_name} con [$Damage] danni. --^Final| --:Miss| --=Miss|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --+Danni!|L'attacco non colpisce @{target|token_name} con [$Miss] danni. --^Final| --:Conferma| --=Conferma|1d20 + @{selected|BAB}[BAB] + @{selected|weapon2stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2focus}[ArmaFocalizzata] --=Damage2|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --=Critico|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] *[$Critico] --+Critico!|Se [$Conferma] colpisce, allora l'attacco colpisce @{target|token_name} con [$Damage2] + [$Critico] danni critici. --^Final| --:Fumble| --=Fumble|1d100 --+1!| Controlla la tabella percentuale [$Fumble]. --:Final| }} Any help will be greatly appreciated! Thanks Taki  
1644402553
Kurt J.
Pro
API Scripter
Zach said: Seems the turnorder is no longer pushing to the initiative tracker. I have been using this regularly and I think a roll20 update just broke it. I am running Deadlands Classic so the initiative roll does a bulk roll using all of the PCs and NPCs with about 50 lines of script each. I pulled the line in question out and am still not getting a response from it. For an example; !scriptcard {{   --~turnorder|turnorder;addtoken;@{selected|token_id};[$turns] }} I'm working on a fix for this, but I haven't had time to do any testing yet. If you want to try updating your copy of ScriptCards, search for "addtoken" in the code and replace that block with the code below. Note that this will only fix the "addtoken" function. Updates need to be made to replacetoken and addcustom as well, which I have done in my code but the update below should fix the most pressing issue. if (params[1].toLowerCase() == "addtoken") { var turnorder = []; if (Campaign().get("turnorder") !== "") { turnorder = JSON.parse(Campaign().get("turnorder")); } var t=getObj('graphic', params[2]); if (t) { turnorder.push({ id: params[2], pr: params[3], _pageid: t.get('pageid'), custom: "", }); } Campaign().set("turnorder", JSON.stringify(turnorder)); }
@Taki The problem is you're reusing label names.
1644430853

Edited 1644430902
Colin C. said: @Taki The problem is you're reusing label names. Hey Colin, i've storted this out this way. !scriptcard {{ --:TITLE CARD DISPLAY| --#title|@{selected|weapon1name} e @{selected|weapon2name} --#leftsub|@{selected|weapon1type} e @{selected|weapon2type} --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#emoteText|@{selected|character_name} attacca @{target|character_name} con due armi --:VARIABLES| --=TargetAC|@{target|armorclass} --:DoneWithAC| --=Critico1|@{selected|weapon1critmult}-1 --=Critico2|@{selected|weapon2critmult}-1 --:DoneWithCritico| --=BonusStatDamage|@{selected|weapon1damagestat} --=BonusStatDamage2|@{selected|weapon2damagestat} --:DoneWithBonusStatDamage| --:PROCEDURES| --:ATTACCOPRIMARIO| --=AttackRoll|1d20 + @{selected|BAB}[BAB] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] - 2[Combattere con due armi] --+Attacca|@{selected|character_name} attacca con la mano primaria e tira [$AttackRoll] vs AC [$TargetAC]. --?[$AttackRoll.Base] -eq 20|ConfermaPrimario --?[$AttackRoll.Base] -eq 1|FumblePrimario --?[$AttackRoll.Total] -ge [$TargetAC.Total]|HitPrimario|MissPrimario --^ATTACCOSECONDARIO| --:HitPrimario| --=HitPrimario|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] --+Danni!|L'attacco colpisce @{target|token_name} con [$HitPrimario] danni. --^ATTACCOSECONDARIO| --:MissPrimario| --=MissPrimario|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] --+Danni!|L'attacco non colpisce @{target|token_name} con [$MissPrimario] danni. --^ATTACCOSECONDARIO| --:ConfermaPrimario| --=ConfermaPrimario|1d20 + @{selected|BAB}[BAB] + @{selected|weapon1stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] --=Damage2|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] --=CriticoPrimario|@{selected|weapon1damage} + [$BonusStatDamage][BonusStat] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon1specialize}[ArmaSpecializzata] *[$Critico1] --+Critico!|Se [$ConfermaPrimario] colpisce, allora l'attacco colpisce @{target|token_name} con [$Damage2] + [$CriticoPrimario] danni critici. --^ATTACCOSECONDARIO| --:FumblePrimario| --=FumblePrimario|1d100 --+1!| Controlla la tabella percentuale [$FumblePrimario]. --^ATTACCOSECONDARIO| --:ATTACCOSECONDARIO| --=Offhand|1d20 + @{selected|BAB}[BAB] + @{selected|weapon2stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon1enh}[BonusArma] + @{selected|weapon2focus}[ArmaFocalizzata] - 2[Combattere con due armi] --+Attacca|@{selected|character_name} attacca con la mano secondaria e tira [$Offhand] vs AC [$TargetAC]. --?[$Offhand.Base] -eq 20|ConfermaOffhand --?[$Offhand.Base] -eq 1|FumbleOffhand --?[$Offhand.Total] -ge [$TargetAC.Total]|HitOffhand|MissOffhand --^SECONDOATTACCOSECONDARIO| --:HitOffhand| --=HitOffhand|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --+Danni!|L'attacco colpisce @{target|token_name} con [$HitOffhand] danni. --^SECONDOATTACCOSECONDARIO| --:MissOffhand| --=MissOffhand|@{selected|weapon1damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --+Danni!|L'attacco non colpisce @{target|token_name} con [$MissOffhand] danni. --^SECONDOATTACCOSECONDARIO| --:ConfermaOffhand| --=ConfermaOffhand|1d20 + @{selected|BAB}[BAB] + @{selected|weapon2stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon1focus}[ArmaFocalizzata] --=DamageOffhand|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --=CriticoOffhand|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] *[$Critico2] --+Critico!|Se [$ConfermaOffhand] colpisce, allora l'attacco colpisce @{target|token_name} con [$DamageOffhand] + [$CriticoOffhand] danni critici. --^SECONDOATTACCOSECONDARIO| --:FumbleOffhand| --=FumbleOffhand|1d100 --+1!| Controlla la tabella percentuale [$FumbleOffhand]. --^SECONDOATTACCOSECONDARIO| --:SECONDOATTACCOSECONDARIO| --=Offhand2|1d20 + @{selected|BAB}[BAB] + @{selected|weapon2stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2focus}[ArmaFocalizzata] - 5[Combattere con due armi] --+Attacca|@{selected|character_name} attacca nuovamente con la mano secondaria e tira [$Offhand2] vs AC [$TargetAC]. --=HitOffhand2|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --?[$Offhand2.Base] -eq 20|ConfermaOffhand2 --?[$Offhand2.Base] -eq 1|FumbleOffhand2 --?[$Offhand2.Total] -ge [$TargetAC.Total]|HitOffhand2|MissOffhand2 --^Final| --:HitOffhand2| --=HitOffhand2|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --+Danni!|L'attacco colpisce @{target|token_name} con [$HitOffhand2] danni. --^Final| --:MissOffhand2| --=MissOffhand2|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --+Danni!|L'attacco non colpisce @{target|token_name} con [$MissOffhand2] danni. --^Final| --:ConfermaOffhand2| --=ConfermaOffhand2|1d20 + @{selected|BAB}[BAB] + @{selected|weapon2stat}[BonusStat] + @{selected|size}[BonusTaglia] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2focus}[ArmaFocalizzata] --=DamageOffhand2|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] --=CriticoOffhand2|@{selected|weapon2damage} + [$BonusStatDamage2][BonusStat] + @{selected|weapon2enh}[BonusArma] + @{selected|weapon2specialize}[ArmaSpecializzata] *[$Critico2] --+Critico!|Se [$ConfermaOffhand2] colpisce, allora l'attacco colpisce @{target|token_name} con [$DamageOffhand2] + [$CriticoOffhand2] danni critici. --^Final| --:FumbleOffhand2| --=FumbleOffhand2|1d100 --+1!| Controlla la tabella percentuale [$FumbleOffhand2]. --:Final| }}
Looks right to me.
Hello!  First off, love the new ScriptCards.  I used PowerCards many years ago and this is a huge improvement.  Now, I was running into an odd issue with ScriptCards and checking distance, and I was able to figure out what the issue was.  I figured I'd post it here in case anyone else has a similar issue in the future.  I'm using the manhattandistance function, and in some cases it seems to return a huge decimal value. I first realized the issue was occurring because of group movement.  If I selected all these tokens and moved them all at once as a group, it would consistently throw these weirdly long numbers on the distance results.  When I moved them individually and manually back onto the grid, it started working fine... except for this one case. I don't know why exactly it's doing this, but I believe I can use a FLOOR call to get it down to an integer. Thanks for making such a great tool!
1644451109
Kurt J.
Pro
API Scripter
Phillip W. said: Kurt J. said: Bradley P. said: Kurt The new script is better but there still seems to be an issue with the first roll. Brad What issue are you having? In the results line, the 2d20 came up with a 12 and a 17, and the 12 was dropped (hence the [x x] around it and the 17 kept. How do I get the script to roll advantage? Advantage/Normal/Disadvantage is based on the setting on the character sheet. The 5E Action Menu makes use of the Advantage Toggle system.
1644451286
Kurt J.
Pro
API Scripter
Richter Scales said: Hello!  First off, love the new ScriptCards.  I used PowerCards many years ago and this is a huge improvement.  Now, I was running into an odd issue with ScriptCards and checking distance, and I was able to figure out what the issue was.  I figured I'd post it here in case anyone else has a similar issue in the future.  I'm using the manhattandistance function, and in some cases it seems to return a huge decimal value. I first realized the issue was occurring because of group movement.  If I selected all these tokens and moved them all at once as a group, it would consistently throw these weirdly long numbers on the distance results.  When I moved them individually and manually back onto the grid, it started working fine... except for this one case. I don't know why exactly it's doing this, but I believe I can use a FLOOR call to get it down to an integer. Thanks for making such a great tool! There are a couple of ways to do it. You can use the --~ function: --~MyVariable|math;floor[$MyVariable.Raw] or you can use a roll modifier: --=MyVariable|[$MyVariable.Raw] {FLOOR} Both will take the value of MyVariable, drop the decimal portion, and put the value back into MyVariable.
Kurt J. said: Phillip W. said: Kurt J. said: Bradley P. said: Kurt The new script is better but there still seems to be an issue with the first roll. Brad What issue are you having? In the results line, the 2d20 came up with a 12 and a 17, and the 12 was dropped (hence the [x x] around it and the 17 kept. How do I get the script to roll advantage? Advantage/Normal/Disadvantage is based on the setting on the character sheet. The 5E Action Menu makes use of the Advantage Toggle system. Thanks so much! I appreciate all of your work!
1644452637

Edited 1644452659
Kurt J.
Pro
API Scripter
ScriptCards 1.6.0 ScriptCards 1.6.0 has been uploaded to the GitHub Repo. Version 1.6.0 has the following changes: Minor display tweaks to spacing from the output of the dice roll parser. Added code to accommodate the undocumented Roll20 change to the Roll20 turnorder system. The turnorder functions should once again behave as expected. Added the [#settingname] replaceable content reference. This can be used to read back any of the settings supported by ScriptCards. For example, [#title] will be replaced with the current value of the "title" setting. Added 10 new settings (usersetting0 thru usersetting9). These settings are not used by ScriptCards itself, but they are stored when using the --Ssettings command and can be reloaded with --Lsettings and provide user configurable storage that can be stored along with named setting sets.
Does anyone know how to access a token's tooltip with Scriptcards? . . . I've tried this... [*S:t-tooltip] ...and several other likely guesses, but no luck so far :-/ (and, of course, I also looked in the SC wiki for it, but no dice)
1644540298

Edited 1644540355
Kurt J.
Pro
API Scripter
ScriptCards 1.6.1 Is On the Repo ScriptCards 1.6.1 is a small update that removes the restrictions on what properties you can access on tokens with the "t-" notation. It will now allow you to access any properties, even if they don't exist :) The initial intention of limiting the available properties to a built-in list was to cut down on potential errors, but it means that I needed to update the script every time token properties were added, and there were some (like tooltip) that I forgot completely (Thanks Ronnie McDurgen and egm_melu for pointing that out). - [*S:t-tooltip]  and similar constructs should work now :) The result is run through .toString(), so boolean items will return "true" or "false", while properties that don't exist will return "undefined" (which is different from an empty string, which will still return an empty string). Unless show stopper bugs are found (not expected) I'll queue this version up for OneClick deployment, since it contains the turn tracker fix from 1.6.0 which would be good to get up there.
1644540623
Andrew R.
Pro
Sheet Author
It might be helpful to have a ScriptCards example that displays all the token properties. 
1644540855
Kurt J.
Pro
API Scripter
Andrew R. said: It might be helpful to have a ScriptCards example that displays all the token properties.&nbsp; The original list is on the wiki here:&nbsp; <a href="https://wiki.roll20.net/Script:ScriptCards#Character.2FToken_Attributes" rel="nofollow">https://wiki.roll20.net/Script:ScriptCards#Character.2FToken_Attributes</a> The Roll20 Object API has the list here:&nbsp; <a href="https://wiki.roll20.net/API:Objects#Graphic_.28Token.2FMap.2FCard.2FEtc..29" rel="nofollow">https://wiki.roll20.net/API:Objects#Graphic_.28Token.2FMap.2FCard.2FEtc..29</a> &nbsp;but I don't think it includes some of the most recent additions, which are in this forum thread:&nbsp; <a href="https://app.roll20.net/forum/post/10136021/new-api-keys" rel="nofollow">https://app.roll20.net/forum/post/10136021/new-api-keys</a> With the removal of the built-in list of attributes, even when Roll20 adds new ones they should "just work" in ScriptCards.
Kurt J. said: Richter Scales said: Hello!&nbsp; First off, love the new ScriptCards.&nbsp; I used PowerCards many years ago and this is a huge improvement.&nbsp; Now, I was running into an odd issue with ScriptCards and checking distance, and I was able to figure out what the issue was.&nbsp; I figured I'd post it here in case anyone else has a similar issue in the future.&nbsp; I'm using the manhattandistance function, and in some cases it seems to return a huge decimal value. I first realized the issue was occurring because of group movement.&nbsp; If I selected all these tokens and moved them all at once as a group, it would consistently throw these weirdly long numbers on the distance results.&nbsp; When I moved them individually and manually back onto the grid, it started working fine... except for this one case. I don't know why exactly it's doing this, but I believe I can use a FLOOR call to get it down to an integer. Thanks for making such a great tool! There are a couple of ways to do it. You can use the --~ function: --~MyVariable|math;floor[$MyVariable.Raw] or you can use a roll modifier: --=MyVariable|[$MyVariable.Raw] {FLOOR} Both will take the value of MyVariable, drop the decimal portion, and put the value back into MyVariable. Thanks!&nbsp; I was able to get it to work.
Thanks very much for that latest update, Kurt, it's going to be great for my campaign :-)
I think I need a bit of help with a block of code.&nbsp; It's using the built-in object modification functions of ScriptCards.&nbsp; The goal is to update the bar1 value of a token after it's been attacked, to show the damage it took. However, when I run the script, the bar1_value is never updated, and if I try to display the value of bar1 in an output window, it comes back as undefined.&nbsp; I've tried just about everything I can think of; the token is linked to the character sheet, bar1 is linked to HP, it's all there, as far as I can tell.&nbsp; I copied the syntax for the token command from the 5e magic missile script example, so the syntax should be correct. &nbsp; --/| Apply the damage to the token &nbsp; --!t:[%2%]|bar1_value:-=[$attackDmg] &nbsp; --+hp|[*[%2%]:bar1_value] &nbsp; --?[*[%2%]:bar1_value] -gt 0 -or "[*[%2%]:auras]" -inc "Stand"|survived &nbsp; --"[*[%1%]:auras]" -ninc "Massive" -or [$attackDmg] -lt [*[%2%]:bar1_max] * 0.8|survived &nbsp; --!t:[%2%]|bar1_value:0 &nbsp; --&gt;EndBattle|[%1%];[%2%] &nbsp; --:survived| In the above code block, the output line shows "undefined" as it is, but if I change it to t-name instead of bar1_value, then it shows the token's name just fine. I did notice an odd error that has occurred in the sandbox a few times while I was troubleshooting this.&nbsp; I don't know if it's related or not. Any help would be greatly appreciated.&nbsp; Thank you!
1644624840
Kurt J.
Pro
API Scripter
Richter Scales said: I think I need a bit of help with a block of code.&nbsp; It's using the built-in object modification functions of ScriptCards.&nbsp; The goal is to update the bar1 value of a token after it's been attacked, to show the damage it took. However, when I run the script, the bar1_value is never updated, and if I try to display the value of bar1 in an output window, it comes back as undefined.&nbsp; I've tried just about everything I can think of; the token is linked to the character sheet, bar1 is linked to HP, it's all there, as far as I can tell.&nbsp; I copied the syntax for the token command from the 5e magic missile script example, so the syntax should be correct. &nbsp; --/| Apply the damage to the token &nbsp; --!t:[%2%]|bar1_value:-=[$attackDmg] &nbsp; --+hp|[*[%2%]:bar1_value] &nbsp; --?[*[%2%]:bar1_value] -gt 0 -or "[*[%2%]:auras]" -inc "Stand"|survived &nbsp; --"[*[%1%]:auras]" -ninc "Massive" -or [$attackDmg] -lt [*[%2%]:bar1_max] * 0.8|survived &nbsp; --!t:[%2%]|bar1_value:0 &nbsp; --&gt;EndBattle|[%1%];[%2%] &nbsp; --:survived| In the above code block, the output line shows "undefined" as it is, but if I change it to t-name instead of bar1_value, then it shows the token's name just fine. So a couple of things: When using [*x:xxx] referencing, token properties must &nbsp;be prefixed with t- (otherwise it will look for a character attribute by that name), so "--+hp|[*[%2%]:bar1_value]" should be "--+hp|[*[%2%]:t-bar1_value]". If you don't use the prefix, you will get "undefined" as indicated above. This "--"[*[%1%]:auras]" -ninc "Massive" -or [$attackDmg] -lt [*[%2%]:bar1_max] * 0.8 |survived" will not work for at least two reasons: First, it is missing the ? at the beginning (--" is not a valid statement type so is currently being ignored). Even if you add the ?, however, you will get an error in the console log stating that the condition "contains an invalid clause joiner".&nbsp;This is because your can't inline math operations (the *0.8) inside a condititional statement. You would need to have a --= like to calculate the massive damage threshold beforehand and compate to that variable. Since you are using [%1%] and [%2%] parameters, I assume you are calling this code as a subroutine. It would be valuable to see the statement that calls this code to see what is getting passed into parameters 1 and 2.
I'm hoping someone can help me with a sudden loss of chat window output. I'm working with a modified version of Kurt's 5E Action Menu. After a PC melee attack hits, the following branch checks for target immunity/resistance/vulnerability, modifies damage appropriately, applies modified damage to token bar, and then is supposed to output a text string describing damage and any damage modification to chat window. Everything works fine except for chat output. Nothing is being output to the chat window. Can anyone see anything wrong with my code that would explain why? &nbsp;--:ATTACK_ONE_DAMAGE|&nbsp; &nbsp; --&amp;Tough|Normal &nbsp; --&gt;VULNERABLE| &nbsp; --C[&amp;Tough]|Immune:&gt;Imm|Resistant:&gt;Res|Vulnerable:&gt;Vul|Normal:&gt;Norm|&nbsp; &nbsp; --&gt;ApplyDamageScriptCards|@{target|token_id};1;-[$attackDamage] &nbsp; --^ATTACK_DONE| &nbsp;&nbsp;&nbsp; --:Imm|&nbsp; --+[&amp;hittag]|The [*R:atkname] [&amp;hitdesc] but deals no damage. [*T:t-name] seems immune to [*R:dmgtype] damage.[br][br]&nbsp; --&lt;| &nbsp;&nbsp;&nbsp; --:Res|&nbsp; --+[&amp;hittag]|The [*R:atkname] [&amp;hitdesc] and deals [$attackDamage] [*R:dmgtype] damage. [*T:t-name] seems resistant to [*R:dmgtype] damage.[br][br]&nbsp; --&lt;| &nbsp;&nbsp;&nbsp; --:Vul|&nbsp; --+[&amp;hittag]|The [*R:atkname] [&amp;hitdesc] and deals [$attackDamage] [*R:dmgtype] damage. [*T:t-name] seems vulnerable to [*R:dmgtype] damage.[br][br]&nbsp; --&lt;| &nbsp;&nbsp;&nbsp; --:Norm|&nbsp; --+[&amp;hittag]|The [*R:atkname] [&amp;hitdesc] and deals [$attackDamage] [*R:dmgtype] damage.[br][br]&nbsp; --&lt;|
Kurt J. said: Richter Scales said: I think I need a bit of help with a block of code.&nbsp; It's using the built-in object modification functions of ScriptCards.&nbsp; The goal is to update the bar1 value of a token after it's been attacked, to show the damage it took. However, when I run the script, the bar1_value is never updated, and if I try to display the value of bar1 in an output window, it comes back as undefined.&nbsp; I've tried just about everything I can think of; the token is linked to the character sheet, bar1 is linked to HP, it's all there, as far as I can tell.&nbsp; I copied the syntax for the token command from the 5e magic missile script example, so the syntax should be correct. &nbsp; --/| Apply the damage to the token &nbsp; --!t:[%2%]|bar1_value:-=[$attackDmg] &nbsp; --+hp|[*[%2%]:bar1_value] &nbsp; --?[*[%2%]:bar1_value] -gt 0 -or "[*[%2%]:auras]" -inc "Stand"|survived &nbsp; --"[*[%1%]:auras]" -ninc "Massive" -or [$attackDmg] -lt [*[%2%]:bar1_max] * 0.8|survived &nbsp; --!t:[%2%]|bar1_value:0 &nbsp; --&gt;EndBattle|[%1%];[%2%] &nbsp; --:survived| In the above code block, the output line shows "undefined" as it is, but if I change it to t-name instead of bar1_value, then it shows the token's name just fine. So a couple of things: When using [*x:xxx] referencing, token properties must &nbsp;be prefixed with t- (otherwise it will look for a character attribute by that name), so "--+hp|[*[%2%]:bar1_value]" should be "--+hp|[*[%2%]:t-bar1_value]". If you don't use the prefix, you will get "undefined" as indicated above. This "--"[*[%1%]:auras]" -ninc "Massive" -or [$attackDmg] -lt [*[%2%]:bar1_max] * 0.8 |survived" will not work for at least two reasons: First, it is missing the ? at the beginning (--" is not a valid statement type so is currently being ignored). Even if you add the ?, however, you will get an error in the console log stating that the condition "contains an invalid clause joiner".&nbsp;This is because your can't inline math operations (the *0.8) inside a condititional statement. You would need to have a --= like to calculate the massive damage threshold beforehand and compate to that variable. Since you are using [%1%] and [%2%] parameters, I assume you are calling this code as a subroutine. It would be valuable to see the statement that calls this code to see what is getting passed into parameters 1 and 2. Thanks for the advice about the ? conditional issues.&nbsp; I made those changes, and I can read the value of the bar now that I used t-bar1_value.&nbsp; However, I still can't seem to update the token's bar value with the --! command.&nbsp; I was curious about if I could do a roundabout solution and update the linked character sheet's HP value instead, to update the token bar that way.&nbsp; Sadly that didn't work either. I've included the full macro that I'm using here and the custom character sheet HTML here . As a developer myself, I'm trying to troubleshoot as much on my own as possible, so that you don't have to be bothered with my stupid issues.&nbsp; Right now the main thing I am looking to figure out is why I can't update the token values/character sheet values.&nbsp; I'm sorry to put this on you.&nbsp; Thank you for helping me! EDIT: I have been doing some testing on my own and I'm quite baffled.&nbsp; I just copied the examples from the wiki page and put them in a little 3 line script, and it doesn't update the token values. !script {{ &nbsp; --+|@{selected|token_id} &nbsp; --!t:@{selected|token_id}|bar1_value:+=1 &nbsp; --!t:@{selected|token_id}|t-bar1_max:+=3 }} Is there a script or game setting that I'm missing?&nbsp; I have made the tokens completely visible to and editable by all players. Second Edit:&nbsp; I was able to get what I needed with a workaround.&nbsp; I called tokenMod and chatSetAttr to set the properties I needed, and just used some additional logic in the script.
1644758820

Edited 1644759205
Kurt J.
Pro
API Scripter
ScriptCards 1.6.2 A bug fix for rollable table rolls not working has been uploaded to the&nbsp; GitHub Repo . Using [T#table-name] in a --= line should now work as expected again. In addition, I just pushed 1.6.2 to the Roll20 OneClick, so hopefully this week it will be updated there.
Dyesuhn said: I'm hoping someone can help me with a sudden loss of chat window output. I'm working with a modified version of Kurt's 5E Action Menu. After a PC melee attack hits, the following branch checks for target immunity/resistance/vulnerability, modifies damage appropriately, applies modified damage to token bar, and then is supposed to output a text string describing damage and any damage modification to chat window. Everything works fine except for chat output. Nothing is being output to the chat window. Can anyone see anything wrong with my code that would explain why? &nbsp;--:ATTACK_ONE_DAMAGE|&nbsp; &nbsp; --&amp;Tough|Normal &nbsp; --&gt;VULNERABLE| &nbsp; --C[&amp;Tough]|Immune:&gt;Imm|Resistant:&gt;Res|Vulnerable:&gt;Vul|Normal:&gt;Norm|&nbsp; &nbsp; --&gt;ApplyDamageScriptCards|@{target|token_id};1;-[$attackDamage] &nbsp; --^ATTACK_DONE| &nbsp;&nbsp;&nbsp; --:Imm|&nbsp; --+[&amp;hittag]|The [*R:atkname] [&amp;hitdesc] but deals no damage. [*T:t-name] seems immune to [*R:dmgtype] damage.[br][br]&nbsp; --&lt;| &nbsp;&nbsp;&nbsp; --:Res|&nbsp; --+[&amp;hittag]|The [*R:atkname] [&amp;hitdesc] and deals [$attackDamage] [*R:dmgtype] damage. [*T:t-name] seems resistant to [*R:dmgtype] damage.[br][br]&nbsp; --&lt;| &nbsp;&nbsp;&nbsp; --:Vul|&nbsp; --+[&amp;hittag]|The [*R:atkname] [&amp;hitdesc] and deals [$attackDamage] [*R:dmgtype] damage. [*T:t-name] seems vulnerable to [*R:dmgtype] damage.[br][br]&nbsp; --&lt;| &nbsp;&nbsp;&nbsp; --:Norm|&nbsp; --+[&amp;hittag]|The [*R:atkname] [&amp;hitdesc] and deals [$attackDamage] [*R:dmgtype] damage.[br][br]&nbsp; --&lt;| It would be great if someone could give me a hand with this. I haven't got a clue how to fix the problem.
@Dyesuhn - eliminate the "|" at the end of the case statement.&nbsp; If that isn't the issue then look to see if [&amp;Tough] is changed in the VULNERABLE subroutine.
1645104219

Edited 1645104474
@Kurt J. - suddenly all of my [/#] marks are being printed out in chat.&nbsp; Have I missed something?&nbsp; :-(&nbsp; EDIT: Looks like any time a macro has an inserted color code [#ffffff]Word[/#] the color is not inserted and the [/#] is printed to chat.
1645108214
timmaugh
Pro
API Scripter
Dyesuhn said: Dyesuhn said: I'm hoping someone can help me with a sudden loss of chat window output. *snip* It would be great if someone could give me a hand with this. I haven't got a clue how to fix the problem. If Michael's answer doesn't get you there, I would wonder if you are getting *any* API output to the chat? If not, you will likely need to delete your chat archive (not the in-game "clear chat" option... the option available at the game's launch page). It is drastic, but it is sometimes necessary to "unstick" the chat.
Michael C. said: @Dyesuhn - eliminate the "|" at the end of the case statement.&nbsp; If that isn't the issue then look to see if [&amp;Tough] is changed in the VULNERABLE subroutine. Michael and Timmaugh, thanks for responses. I still can't get this to work though, despite eliminating the "|" at the end of the case statement and deleting the chat archive. As for Michael's other query, [&amp;Tough] does change in the VULNERABLE subroutine, but that's the whole point of the subroutine. I first set [&amp;Tough] as Normal by default, then run VULNERABLE to see if the target is immune, vulnerable, or resistant to the damage type. If so, I change [&amp;Tough] as appropriate. The case statement is then supposed to output to chat the description of the attack and resulting damage that fits the target's immunity/resistance/vulnerability or lack of any of those things. I know that [&amp;Tough] is changing as its supposed to, but I'm not getting any output from the case statement alternatives in the chat window. Is the way I'm adjusting [&amp;Tough] incorrect?
1645128529
David M.
Pro
API Scripter
Dyesuhn, have you tried printing a debug line after you call the VULNERABLE subroutine and before your case statement to make sure that there are no typos or upper/lowercase-sensitivity issues in the subroutine? --+Tough Value|[&amp;Tough]
1645142301
Kurt J.
Pro
API Scripter
Michael C. said: @Kurt J. - suddenly all of my [/#] marks are being printed out in chat.&nbsp; Have I missed something?&nbsp; :-(&nbsp; EDIT: Looks like any time a macro has an inserted color code [#ffffff]Word[/#] the color is not inserted and the [/#] is printed to chat. Yea, I accidently broke color coding when adding the settings references. I just uploaded 1.6.2a with a fix for the issue. It is on the GitHub, and I got it up in time to be included in the OneClick push as well.
David M. said: Dyesuhn, have you tried printing a debug line after you call the VULNERABLE subroutine and before your case statement to make sure that there are no typos or upper/lowercase-sensitivity issues in the subroutine? --+Tough Value|[&amp;Tough] I did, and it was working fine. But thanks for the suggestion. Oddly, after removing lines, rewording them, and then putting everything back exactly as I'd had it before, the code is now working, and output is properly printing in chat window. Go figure.
@Dyesuhn - you probably had what we old folks call a "white space" in your code, an invisible character that caused the error.&nbsp; Can't tell you how many times I have done that.
@Kurt J. - ::whew:: Thanks!
1645233057
Andrew R.
Pro
Sheet Author
Dyesuhn said Oddly, after removing lines, rewording them, and then putting everything back exactly as I'd had it before, the code is now working, and output is properly printing in chat window. Go figure. As Michael says, probably a “white space” or punctuation that’s visually hard to distinguish from a correct character. What editor are you using? A good programmer’s editor is best for scripts. I use the Sublime editor, but there’s lots available for free.&nbsp;
Andrew R. said: Dyesuhn said Oddly, after removing lines, rewording them, and then putting everything back exactly as I'd had it before, the code is now working, and output is properly printing in chat window. Go figure. As Michael says, probably a “white space” or punctuation that’s visually hard to distinguish from a correct character. What editor are you using? A good programmer’s editor is best for scripts. I use the Sublime editor, but there’s lots available for free.&nbsp; I'm sure it's not ideal, but I just paste my code into a Word document and edit it there.
1645279797
Kurt J.
Pro
API Scripter
Dyesuhn said: Andrew R. said: Dyesuhn said Oddly, after removing lines, rewording them, and then putting everything back exactly as I'd had it before, the code is now working, and output is properly printing in chat window. Go figure. As Michael says, probably a “white space” or punctuation that’s visually hard to distinguish from a correct character. What editor are you using? A good programmer’s editor is best for scripts. I use the Sublime editor, but there’s lots available for free.&nbsp; I'm sure it's not ideal, but I just paste my code into a Word document and edit it there. I used to use Notepad++ almost exclusively, and I still do for a lot of tasks. For coding, though, I've since moved over to Visual Studio Code (free from Microsoft). One side benefit there is that Andreas J wrote a VSCode add-in that does syntax hilighting for Roll20 macros (available at&nbsp;<a href="https://marketplace.visualstudio.com/items?itemName=anduh.rmacro" rel="nofollow">https://marketplace.visualstudio.com/items?itemName=anduh.rmacro</a>)
1645304664
Andrew R.
Pro
Sheet Author
Dyesuhn said: I'm sure it's not ideal, but I just paste my code into a Word document and edit it there. There's your problem, then. Word will mess up your script with smart quotes, etc.,&nbsp; I suggest you follow Kurt's lead and use the free Visual Studio Code instead.&nbsp;
I use sublime text editor, which works well as a code/text editor.&nbsp; It' also allows me to create syntax shortcuts, so I can program it to store all the commonly used ScriptCards commands.
@Kurt J./Andrew R. - good referral, I've been using Notepad++ also and Visual Studio Code is a step up.&nbsp; Thanks!
Does anyone have an equivalent recommendation for editor (similar to Video Studio Code for M/S) for Apple/Mac?
I believe there is xCode which is Apple's version of VSC.
Kurt J. said: Zack B. said: I did a little playing around, and have the following observations: When using an alpha channel specifier with button colors, it appears Roll20 overrides the color and displays the pink background. No idea why this would be happening, but I can set the color to anything without an alpha channel and get the right background color. If the alpha channel value is specified at all (even FF) the button shows in Roll20's default pink color. I even tried applying a transparent PNG file as the background image, but the pink color still overrides that. That might not be something I can fi Is it possible to have even buttons and odd buttons have different backgrounds or is it all or nothing? Buttons (and rbuttons and sheetbuttons) can have individual colors assigned, but you need to assign both the text and the background (text first, background second). After button, add a colon and the text color, a colon and the background color. This produces a white background button and a black background button on the same line: --+|[button:#000000:#ffffff]Black Button::dummy[/button] [button:#ffffff:#000000]White Button::dummy[/button] Is there a way to get rid of the border that appears after you apply the individual button text color and background color? Right now it looks like this:
1645414009
Andrew R.
Pro
Sheet Author
Michael C. said: Does anyone have an equivalent recommendation for editor (similar to Video Studio Code for M/S) for Apple/Mac? It’s cross-platform support that got me to switch to Sublime editor. The developers at my previous job all used it, so I tried it on my Mac mini.&nbsp;
1645414745
Senjak
Pro
Sheet Author
Hello! I'm feeling rather stupid right now.&nbsp; I know most of what I need; however, I'm just not understanding the correct references that I need. On the specific character sheets there are variables for skill_name and skill_name-check.&nbsp; skil_name contains an integer number, the skill level. skill_name-check ranges from 0 to "on".&nbsp;&nbsp; My code looks like the following: !script {{ --~|array;define;SKILLS;accounting;anthropology;appraise;archaeology;charm;climb;disguise;dodge;drive_auto;electrical_repair;fast_talk;first_aid;history;intimidate;jump;law;library_use;listen;locksmith;mechanical_repair;medicine;natural_world;navigate;occult;operate_heavy_machinery;persuade;psychoanalysis;psychology;ride;sleight_of_hand;spot_hidden;stealth;swim;throw;track;brawl;handgun;rifle_shotgun --~|array;sort;SKILLS --%LoopCounter|0;37;1 --&amp;SKILL|[@SKILLS([&amp;LoopCounter])] --&amp;UPDATE|[&amp;SKILL] --&amp;UPDATE|+-check --&amp;STATUS|(@{selected|[&amp;UPDATE]}) --+|Update [&amp;SKILL]: [&amp;UPDATE] --+|Status: [&amp;STATUS] --%| }} My output looks like this: Status: I'd like to have display either the value 0 or something else.&nbsp;&nbsp; Eventually I want to loop through and for the values that aren't 0 print the skill name, the result of 1d4-1 and the new value of the skill. I'd love some suggestions on how to get this operational. Thanks! Senjak
1645433524
Kurt J.
Pro
API Scripter
Senjak said: Hello! I'm feeling rather stupid right now.&nbsp; I know most of what I need; however, I'm just not understanding the correct references that I need. On the specific character sheets there are variables for skill_name and skill_name-check.&nbsp; skil_name contains an integer number, the skill level. skill_name-check ranges from 0 to "on".&nbsp;&nbsp; My code looks like the following: !script {{ --~|array;define;SKILLS;accounting;anthropology;appraise;archaeology;charm;climb;disguise;dodge;drive_auto;electrical_repair;fast_talk;first_aid;history;intimidate;jump;law;library_use;listen;locksmith;mechanical_repair;medicine;natural_world;navigate;occult;operate_heavy_machinery;persuade;psychoanalysis;psychology;ride;sleight_of_hand;spot_hidden;stealth;swim;throw;track;brawl;handgun;rifle_shotgun --~|array;sort;SKILLS --%LoopCounter|0;37;1 --&amp;SKILL|[@SKILLS([&amp;LoopCounter])] --&amp;UPDATE|[&amp;SKILL] --&amp;UPDATE|+-check --&amp;STATUS|(@{selected|[&amp;UPDATE]}) --+|Update [&amp;SKILL]: [&amp;UPDATE] --+|Status: [&amp;STATUS] --%| }} My output looks like this: Status: I'd like to have display either the value 0 or something else.&nbsp;&nbsp; Eventually I want to loop through and for the values that aren't 0 print the skill name, the result of 1d4-1 and the new value of the skill. I'd love some suggestions on how to get this operational. Thanks! Senjak This line: --&amp;STATUS|(@{selected|[&amp;UPDATE]}) Is going to be an issue. the @{selected|...} notation is processed by the chat server before ScriptCards gets the script, and at that time, [&amp;UPDATE] doesn't exist, so this will always be empty. Near the top of your script, add: --#sourcetoken|@{selected|token_id} This assigns the selected token to the internal source character, allowing you to use the [*S:...] notation, which is processed inline by ScriptCards itself. This allows you to access character attributes by name/variable. Instead of the original line above, use: --&amp;STATUS|([*S:[&amp;UPDATE]]) Since I don't know what sheet you are using, I can't test out the rest of the code, but that stands out as an issue. Also, I don't see anything for your output (missing image?)