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

Scriptcard script not working?

Hello, i've been using scriptcard for some time and i'm loving it, but today i'm trying to write this script but i can't make it work.&nbsp; It's actually pretty simple: it should roll a 1d100 for % and if is above a certain threshold it should jump to a specific point (above 70 to base loot, above 90 to better loot, above 95 to best loot, and above 100 to top loot) inside each loot point (base, better, best, top) there is another 1d100 to decide if it's going to be an armour or a weapon, if it's an armour it jumps to armour, and if is a weapon it jumps to weapon. but it doesn't jump anywhere, it just stops at the "Gil point" ignoring the -gt 70, -gt 90, -gt 95 and -gt 100.&nbsp; what am i missing?&nbsp; all my other script are written kinda the same and work great.&nbsp; ! script {{ --# emoteState | no --+|[ img ] http : //<a href="http://www.artofmtg.com/wp-content/uploads/2021/07/Treasure-Chest-Adventures-in-the-Forgotten-Realms-MtG-Art.jpg[/img]" rel="nofollow">www.artofmtg.com/wp-content/uploads/2021/07/Treasure-Chest-Adventures-in-the-Forgotten-Realms-MtG-Art.jpg[/img]</a> -- Lsettings | Loot --# sourceToken |@{ selected | token_id } --# title |@{ selected | token_name } --# leftsub | --# rightsub | --&amp; Ogg |@{ selected | token_name } --&amp; OggType |@{ selected | bar1 } --+|[ c ] [ rbutton ] Alai :: ALAI [/ rbutton ] [ rbutton ] Anoun :: ANOUN [/ rbutton ] [ rbutton ] Artemis :: ARTEMIS [/ rbutton ] [ rbutton ] Evol :: EVOL [/ rbutton ] [/ c ] -- X | --: ALAI | --= LckRoll |1 d100 + @{ Alai | totale_fortuna } --= ArmOrWep |1 d100 --= ArmFisOrMag |1 d100 --+ Loot Roll |[ $LckRoll ] --?[ $LckRoll . Total ] - gt 70 | BaseEquip --?[ $LckRoll . Total ] - gt 90 | BestEquip --?[ $LckRoll . Total ] - gt 95 | BetterEquip --?[ $LckRoll . Total ] - gt 100 | TopEquip --= GilRoll |1 d20 + 5 --+| Gil : [ $GilRoll ] --^ Final | —-: BaseEquip | --+| ProvaBase —-&gt; EquipStat | —-?[ $ArmOrWep . Base ] - gt 50 | ArmBase —-+ WepBase |” nome arma ” [ $WepStat . Raw ] --^ Final | —-: BestEquip --+| ProvaBest —-&gt; EquipStat | —-?[ $ArmOrWep . Base ] - gt 50 | ArmBest —-+ WepBase |” nome arma ” [ $WepStat . Raw ] --^ Final | —-: BetterEquip | --+| ProvaBetter —-&gt; EquipStat | —-?[ $ArmOrWep . Base ] - gt 50 | ArmBetter —-+ WepBase |” nome arma ” [ $WepStat . Raw ] --^ Final | —-: TopEquip | --+| ProvaTop —-&gt; EquipStat | —-?[ $ArmOrWep . Base ] - gt 50 | ArmTop —-+ WepBase |” nome arma ” [ $WepStat . Raw ] --^ Final | —-: ArmBase | —-?[ $ArmFisOrMag . Base ] - gt 50 | ArmMagBase —-+ ArmFis |” nome Armatura " [$ArmFisStat ] --^ Final | —-: ArmMagBase | —-+ ArmMag |” nome Armatura Magica " [$ArmFisStat ] --^ Final | —-: ArmBetter | --= ArmBetterStat | [ $ArmFisStat ] + 1 —-?[ $ArmFisOrMag . Base ] - gt 50 | ArmMagBetter —-+ ArmFis |” nome Armatura " [$ArmBetterStat ] --^ Final | —-: ArmMagBetter | —-+ ArmMag |” nome Armatura Magica " [$ArmBetterStat ] --^ Final | —-: ArmBest | --= ArmBestStat | [ $ArmFisStat ] + 2 —-?[ $ArmFisOrMag . Base ] - gt 50 | ArmMagBest —-+ ArmFis |” nome Armatura " [$ArmBestStat ] --^ Final | —-: ArmMagBest | —-+ ArmMag |” nome Armatura Magica " [$ArmBestStat ] --^ Final | —-: ArmTop | --= ArmTopStat | [ $ArmFisStat ] + 3 —-?[ $ArmFisOrMag . Base ] - gt 50 | ArmMagTop —-+ ArmFis |” nome Armatura " [$ArmTopStat ] --^ Final | —-: ArmMagTop | —-+ ArmMag |” nome Armatura Magica " [$ArmTopStat ] --: Final | --: EquipStat | --= WepStat |@{ Alai | noun1 } —-= ArmFisStat |( @{ Alai | def1 } + @{ Alai | def2 } + @{ Alai | def3 } + @{ Alai | def4 } + @{ Alai | def5 } ) / 5 { CEIL } --&lt;| }} Thank you very much!
1639132569
Kurt J.
Pro
API Scripter
So this isn't going to look &nbsp;very different, but when I copied your code out to notepad, I noticed that many of the -- markers were not actually double dashes, but a character that looks like a dash followed by a dash (if that makes sense)... They were obviously different in Notepad for me. Anyay, I just did a find/replace and that cleared up most things, but there are two other issues I spotted: First, the --:BestEquip line is missing its vertical bar, so any jump to it will fail. Second, the order you have the conditionals in will always result in the player getting base equipment. Whenever you have a series of "greater than" tests, you want to work in reverse order. For example, if the roll ends up being 93, that is greater than 70, so it will jump to baseequip and the script will end because &gt;70 is tested before &gt;90. Reversing the order eliminates this problem. Here is the script with the -- replaced, the | added, and the order reversed. There may be other issues, but I didn't spot them right away :) !script {{ &nbsp; &nbsp; --#emoteState|no &nbsp; &nbsp; --+|[img]<a href="http://www.artofmtg.com/wp-content/uploads/2021/07/Treasure-Chest-Adventures-in-the-Forgotten-Realms-MtG-Art.jpg[/img]" rel="nofollow">http://www.artofmtg.com/wp-content/uploads/2021/07/Treasure-Chest-Adventures-in-the-Forgotten-Realms-MtG-Art.jpg[/img]</a> &nbsp; &nbsp; --Lsettings|Loot &nbsp; &nbsp; --#sourceToken|@{selected|token_id} &nbsp; &nbsp; --#title|@{selected|token_name} &nbsp; &nbsp; --#leftsub| &nbsp; &nbsp; --#rightsub| &nbsp; &nbsp; --&amp;Ogg|@{selected|token_name} &nbsp; &nbsp; --&amp;OggType|@{selected|bar1} &nbsp; &nbsp; --+|[c] [rbutton]Alai::ALAI[/rbutton] [rbutton]Anoun::ANOUN[/rbutton] [rbutton]Artemis::ARTEMIS[/rbutton] [rbutton]Evol::EVOL[/rbutton] [/c] &nbsp; &nbsp; --X| &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; --:ALAI| &nbsp; &nbsp; --=LckRoll|1d100 + + @{Alai|totale_fortuna} &nbsp; &nbsp; --=ArmOrWep|1d100 &nbsp; &nbsp; --=ArmFisOrMag|1d100 &nbsp; &nbsp; --+Loot Roll|[$LckRoll]&nbsp; &nbsp; &nbsp; --?[$LckRoll.Total] -gt 100|TopEquip &nbsp; &nbsp; --?[$LckRoll.Total] -gt 95|BetterEquip &nbsp; &nbsp; --?[$LckRoll.Total] -gt 90|BestEquip &nbsp; &nbsp; --?[$LckRoll.Total] -gt 70|BaseEquip &nbsp; &nbsp; --=GilRoll|1d20 + 5 &nbsp; &nbsp; --+|Gil: [$GilRoll] &nbsp; &nbsp; --^Final| &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; --:BaseEquip| &nbsp; &nbsp; --+|ProvaBase &nbsp; &nbsp; --&gt;EquipStat| &nbsp; &nbsp; --?[$ArmOrWep.Base] -gt 50|ArmBase &nbsp; &nbsp; --+WepBase|”nome arma” [$WepStat.Raw] &nbsp; &nbsp; --^Final| &nbsp; &nbsp; --:BestEquip| &nbsp; &nbsp; --+|ProvaBest &nbsp; &nbsp; --&gt;EquipStat| &nbsp; &nbsp; --?[$ArmOrWep.Base] -gt 50|ArmBest &nbsp; &nbsp; --+WepBase|”nome arma” [$WepStat.Raw] &nbsp; &nbsp; --^Final| &nbsp; &nbsp; --:BetterEquip| &nbsp; &nbsp; --+|ProvaBetter &nbsp; &nbsp; --&gt;EquipStat| &nbsp; &nbsp; --?[$ArmOrWep.Base] -gt 50|ArmBetter &nbsp; &nbsp; --+WepBase|”nome arma” [$WepStat.Raw] &nbsp; &nbsp; --^Final| &nbsp; &nbsp; --:TopEquip| &nbsp; &nbsp; --+|ProvaTop &nbsp; &nbsp; --&gt;EquipStat| &nbsp; &nbsp; --?[$ArmOrWep.Base] -gt 50|ArmTop &nbsp; &nbsp; --+WepBase|”nome arma” [$WepStat.Raw] &nbsp; &nbsp; --^Final| &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; --:ArmBase| &nbsp; &nbsp; --?[$ArmFisOrMag.Base] -gt 50|ArmMagBase &nbsp; &nbsp; --+ArmFis|”nome Armatura" [$ArmFisStat] &nbsp; &nbsp; --^Final| &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; --:ArmMagBase| &nbsp; &nbsp; --+ArmMag|”nome Armatura Magica" [$ArmFisStat] &nbsp; &nbsp; --^Final| &nbsp; &nbsp; --:ArmBetter| &nbsp; &nbsp; --=ArmBetterStat| [$ArmFisStat] + 1 &nbsp; &nbsp; --?[$ArmFisOrMag.Base] -gt 50|ArmMagBetter &nbsp; &nbsp; --+ArmFis|”nome Armatura" [$ArmBetterStat] &nbsp; &nbsp; --^Final| &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; --:ArmMagBetter| &nbsp; &nbsp; --+ArmMag|”nome Armatura Magica" [$ArmBetterStat] &nbsp; &nbsp; --^Final| &nbsp; &nbsp; --:ArmBest| &nbsp; &nbsp; --=ArmBestStat| [$ArmFisStat] + 2 &nbsp; &nbsp; --?[$ArmFisOrMag.Base] -gt 50|ArmMagBest &nbsp; &nbsp; --+ArmFis|”nome Armatura" [$ArmBestStat] &nbsp; &nbsp; --^Final| &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; --:ArmMagBest| &nbsp; &nbsp; --+ArmMag|”nome Armatura Magica" [$ArmBestStat] &nbsp; &nbsp; --^Final| &nbsp; &nbsp; --:ArmTop| &nbsp; &nbsp; --=ArmTopStat| [$ArmFisStat] + 3 &nbsp; &nbsp; --?[$ArmFisOrMag.Base] -gt 50|ArmMagTop &nbsp; &nbsp; --+ArmFis|”nome Armatura" [$ArmTopStat] &nbsp; &nbsp; --^Final| &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; --:ArmMagTop| &nbsp; &nbsp; --+ArmMag|”nome Armatura Magica" [$ArmTopStat] &nbsp; &nbsp; --:Final| &nbsp; &nbsp; --:EquipStat| &nbsp; &nbsp; --=WepStat|@{Alai|noun1} &nbsp; &nbsp; --=ArmFisStat|( @{Alai|def1} + @{Alai|def2} + @{Alai|def3} + @{Alai|def4} + @{Alai|def5} ) / 5 {CEIL} &nbsp; &nbsp; --&lt;| &nbsp; &nbsp; }}
1639154494

Edited 1639155370
That's it! it seems to work perfectly now! thank you so much! oh i think that those weird symbols were caused by the program i used to write part of it (notes on my phone)!&nbsp; do you have a suggestion on what to use or what language to use to write Scriptcard scripts? Thank you again! Oh and another thing, if i wanted the part inside this: to just report what's inside the noun1 attribute (it's a die) and not roll it, for example, to just report 1d4 and not "3" where should i add this:&nbsp; disablerollprocessing?
1639159935
Andrew R.
Pro
Sheet Author
I use and can recommend Sublime Text on MacOS or Windows, but there are many programming editors. Shop around!
Cool! thanks! and what lenguage shoud i set when writing for Scriptcard? Javascript? or others? Andrew R. said: I use and can recommend Sublime Text on MacOS or Windows, but there are many programming editors. Shop around!
1639214756
Andrew R.
Pro
Sheet Author
andrea d. said: what lenguage shoud i set when writing for i haven’t done that for Script Cards yet, the defaults work OK.&nbsp;
1639227577
Kurt J.
Pro
API Scripter
andrea d. said: Cool! thanks! and what lenguage shoud i set when writing for Scriptcard? Javascript? or others? Andrew R. said: I use and can recommend Sublime Text on MacOS or Windows, but there are many programming editors. Shop around! I use Visual Studio Code as my editor for managing anything more than a quick and easy script (which I do in Notepad). Notepad++ is also a good choice.