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
This post has been closed. You can still view previous posts, but you can't post any new replies.

[Script] PowerCards 3 (Thread 4)

Ziechael said: No joy, refreshed my game, have restarted the API each time to make sure no silent crash is happening and have renamed the tracks to add the -players- suffix but still getting the crash, it sends the powercard prior to the crash however, it's just the sound triggers that seem to be crashing the API :( It works for me, ver 3.3.0 (PowerCards) and 1.04 (Roll20AM) without any modifications to Roll20AM. Just tried it with a fresh one-click install.
1487327666

Edited 1487327978
Ziechael
Forum Champion
Sheet Author
API Scripter
Hmm, I wonder if i've got some conflict somewhere... will try ruling out other things in case... [edit] Yup, must be a conflict somewhere as it works in a fresh game... dammit
1487328040
Silvyre
Forum Champion
I'd try clearing the state
1487328201
Ziechael
Forum Champion
Sheet Author
API Scripter
That was something I'd considered but it wipes my calendar when I do that and I hate replacing all that stuff :'(
You should be able to do a log (state); and look through it to see what may or may not need to be cleared out.
1487329202
Ziechael
Forum Champion
Sheet Author
API Scripter
ok, this is an exciting world of new possibilities... i'm very much a journeyman when it comes to code, i didn't realise the state could be queried or edited without affecting the whole thing (I now realise how flawed a thought process that was lol)... ok TO GOOGLE!
Ziechael said: ok, this is an exciting world of new possibilities... i'm very much a journeyman when it comes to code, i didn't realise the state could be queried or edited without affecting the whole thing (I now realise how flawed a thought process that was lol)... ok TO GOOGLE! Heh. It's actually one of the suggestions when utilizing the state, to namespace all your stored information... such as state.powercards.variablename. That way it doesn't conflict with other scripts.
1487338854
Ziechael
Forum Champion
Sheet Author
API Scripter
Some progress... clearing state didn't help but biting the bullet and looking for conflicts sure did. Seems that Recursive Tables, Emas, Ammo and TurnMarker all cause the error when enabled alongside Powercards and Roll20AM... Emas I can live without and the common factor in the others is Aaron so I'll pester him about it ;)
Yeah I really wish that Recursive tables worked better with powercards. I love Recursives and I love PowerCards.
Ziechael said: Some progress... clearing state didn't help but biting the bullet and looking for conflicts sure did. Seems that Recursive Tables, Emas, Ammo and TurnMarker all cause the error when enabled alongside Powercards and Roll20AM... Emas I can live without and the common factor in the others is Aaron so I'll pester him about it ;) They did work with powercards by itself though right?
1487524043
Ziechael
Forum Champion
Sheet Author
API Scripter
Yeah, I've been running them all together for months :(
Try commenting out Line 433 in PowerCards with all the scripts running and enabled. That will prevent PowerCards from triggering any sounds, but you can rule out whether it is that line or something else causing the conflict. If the API doesn't crash... try sending a standard !roll20AM command from chat with that line still disabled.
1487536488

Edited 1487536768
Ziechael
Forum Champion
Sheet Author
API Scripter
With all three conflicts enabled and line 433 commented out it runs fine (sans sound as mentioned). Roll20AM command plays sound fine too... Really odd!! I'm going to put those three scripts into a fresh game with PC and AM to see if I can narrow the issue down further... at least if worst comes to worst I can run it without line 433 for now ;) [edit] same result in fresh game, as soon as any of those three are involved it kills the API when PC tries to run sound but not when Roll20AM does it direct
Try replacing line 433 with this: if (Tag.substring(0,7) == "soundfx") sendChat("", "!roll20AM " + PowerCard[Tag].replace(/\_/g, "--"));
1487539108
Ziechael
Forum Champion
Sheet Author
API Scripter
Still no joy: TypeError: Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined at _.each._.each.ops.*./.+.ops.*./._.each.state.Roll20AM.playLists.(anonymous function).currentTrack._.some._.some._.each.msg.playerid._.chain.map.HandleInput (apiscript.js:2309:42) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:34), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:34), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1494:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461
So I have like a 10 part question. First question currently I'm using a Recursive table that holds an inline for my roll for figuring out character stats. It's [[4d6d1]], can I make PowerCard to this 6 times in a row without typing it out 6 times. Then can I set up a query asking the player how many times they want to roll the stat lines. I allow them to do it 3 times some times. What I'm currently using this, but dadgum recursives don't work right with Powercards. I have to set it to whisper for it to work otherwise it rolls $[[0]]$[[1]]$[[2]]$[[3]]$[[4]]$[[5]] --!Abilities|**Ability Scores** --!Abilities#?{Number of Stats Lines|1}|[[6t[Stats]]] And honestly I think if I can get this worked out I'll probably be able to figure out the other recursive table problems I'm having within Powercards.
1487572832
Silvyre
Forum Champion
Jerry F. said: it rolls $[[0]]$[[1]]$[[2]]$[[3]]$[[4]]$[[5]] --!Abilities|**Ability Scores** --!Abilities#?{Number of Stats Lines|1}|[[6t[Stats]]] Looks like this might be a problem with identically-named tags (which PowerCards doesn't like when handled outside of the # syntax). Try replacing --!Abilities|**Ability Scores** with --Ability Scores| and see if that helps.
Ziechael said: Still no joy: TypeError: Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined at _.each._.each.ops.*./.+.ops.*./._.each.state.Roll20AM.playLists.(anonymous function).currentTrack._.some._.some._.each.msg.playerid._.chain.map.HandleInput (apiscript.js:2309:42) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:146:34), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:146:34), <anonymous>:70:8) at /home/node/d20-api-server/api.js:1494:12 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:461 I'll see what I can do, but can't promise anything soon. It may require an update from Roll20AM before it'll play nice.
Silvyre said: Jerry F. said: it rolls $[[0]]$[[1]]$[[2]]$[[3]]$[[4]]$[[5]] --!Abilities|**Ability Scores** --!Abilities#?{Number of Stats Lines|1}|[[6t[Stats]]] Looks like this might be a problem with identically-named tags (which PowerCards doesn't like when handled outside of the # syntax). Try replacing --!Abilities|**Ability Scores** with --Ability Scores| and see if that helps. Ok I'll give that a try.
Silvyre said: Jerry F. said: it rolls $[[0]]$[[1]]$[[2]]$[[3]]$[[4]]$[[5]] --!Abilities|**Ability Scores** --!Abilities#?{Number of Stats Lines|1}|[[6t[Stats]]] Looks like this might be a problem with identically-named tags (which PowerCards doesn't like when handled outside of the # syntax). Try replacing --!Abilities|**Ability Scores** with --Ability Scores| and see if that helps. No joy, same thing. It works perfectly fine when I use --whisper| and when I remove it I get the crazy rolls.
Ok I just changed it to the [[4d6d1]] 6 times. But I can't roll Recursive tables unless I whisper. I have a few Recursives that are like 3 deep and when it prints out to the powercard that is not whispered I get $[[0]]. The second I set --whisper it works fine. I don't want to have to use whisper though, because each instance of a whisper with roll in it is different.
1487574307
Silvyre
Forum Champion
Do the Rollable Tables you're using only work with Recursive Tables? If so, they won't work with PowerCards.
They work perfectly when you --whisper| to the powercard, that is what is annoying.
1487574538
Silvyre
Forum Champion
It's coincidental that they do work at all, if they do not work in the Text Chat. You might find --whisper|all helpful.
That's weird they would work in a whisper but not chat. Dunno why you need to use a recursive table for stats since you only have to make the macro once.
Well it was something I was working on that you could query what type of stat rolls you would be using but that got nixed because I wanted simplicity. This is more about the recursive tables further down the character creation. Like birth status rolls your birth with in the court or outside the court and then figures out your lineage to the line of the court. It is very odd that the rolls only work in whispers.
Yeah, that's something Aaron might have to weigh in on.
1487577185
Silvyre
Forum Champion
It sounds like you've got it nicely set up with RecursiveTables, but PowerCards could also emulate those Rollable Tables (albeit with a ton of conditionals).
Yeah that's what I was thinking that it would require a ton of conditionals and I don't even know where that even begins. Oh well I figured out something for now and that will have to work until I learn more.
1487583815
Ziechael
Forum Champion
Sheet Author
API Scripter
SkyCaptainXIII said: I'll see what I can do, but can't promise anything soon. It may require an update from Roll20AM before it'll play nice. No worries, I'm needy and selfish but I also appreciate how much work goes into scripts and that fact that most script writers (except for Aaron obviously) have real lives to attend to rather than my particular issue at any given time ;) I'm more than happy to run it with the line commented out for the time being, at least I won't have to go through and redo all my players attack macros that way lol.
1487636060

Edited 1487636121
Good Evening folks, I did a ton of searching and couldnt find an example of what i was trying. Can you put a conditional in front of "name" For instance i have a hidden roll set up to ask if my spell is Empowered.  I wanted to change the Title of the spell to "Empowered spell name" or just "spell name" Here is what i tried, but it shows "undefined" in the name section. !power {{ --hroll|[[ [$Empower] ?{Empower?|No,1|Yes,1.5|Double,2} +0d0]] [[ [$Attack Bonus] ?{Attack Bonus?|6} +0d0]][[ [$Attack Bonus] ?{Attack Bonus?|6} +0d0]] [[ [$Crit1] [$Dmg1] ((4d6+13 +?{Attack Bonus?})*?{Empower?}+3)*2 ]] [[ [$Crit2] [$Dmg2] ((4d6+13 +?{Attack Bonus?})*?{Empower?}+2)*2 ]] [[ [$Crit3] [$Dmg3] ((4d6+13 +?{Attack Bonus?})*?{Empower?}+2)*2 ]] --format|Black --charid|@{character_id} --?? $Empower == 1 ?? name|Getter Ray? --?? $Empower == 1.5 ?? name|Whoa thats a big Ray? --?? $Empower == 2 ?? name|WHAT THE HELL Ray! --leftsub|Scorching Ray --rightsub|Ranged Touch --Ray 1:|[[ [$Atk] 1d20cs>20 +12 +?{Attack Bonus?|} ]] vs AC --?? $Atk.base == 1 ?? !Miss *1:|Gun Jammed *Gains Broken Condition. --?? $Atk.base <> 1 AND $Atk.base <> 20 ?? Hit 1:|[[ [NH] (4d6+13 +?{Attack Bonus?})*?{Empower?}+3]] Damage --?? $Atk.base >= 20 ?? Critical:|**CRIT** [! [^Crit1] !] --Ray 2:|[[ [$Atk2] 1d20cs>20 +12 +?{Attack Bonus?} ]] vs AC --?? $Atk2.base == 1 ?? !Miss *1:|Gun Jammed *Gains Broken Condition. --?? $Atk2.base <> 1 AND $Atk2.base <> 20 ?? Hit 2:|[[ [NH] (4d6+13 +?{Attack Bonus?})*?{Empower?}+2]] Damage --?? $Atk2.base >= 20 ?? Critical:|**CRIT**  [! [^Crit2] !] --Ray 3:|[[ [$Atk3] 1d20cs>20 +12 +?{Attack Bonus?} ]] vs AC --?? $Atk3.base == 1 ?? !Miss *1:|Gun Jammed *Gains Broken Condition. --?? $Atk3.base <> 1 AND $Atk3.base <> 20 ?? Hit 3:|[[ [NH] (4d6+13 +?{Attack Bonus?})*?{Empower?}+2 ]] Damage --?? $Atk3.base >= 20 ?? Critical:|**CRIT**  [! [^Crit3] !] }}
You can't use conditionals on any of the reserved tags due to the way powercards loops through and sets everything up. It might be possible to change it, but I have no idea how much else that would break.
Thanks for the Reply SkyCaptainXIII.  I find a different spot to work it in.
So the macro i earlier referenced has an output like this. My math portions all work correctly for the "$Empower" call. Were i have issues is for the --?? $Empower == 1.5 ?? .... "Whoa thats a big Ray! It doesn't output the line for == 1.5 when i choose "yes" It does output the line for == 2 when i choose the "double" option. Any suggestions would be appriciated. !power {{ --hroll|[[ [$Empower] ?{Empower?|No,1|Yes,1.5|Double,2} +0d0]] [[ [$Attack Bonus] ?{Attack Bonus?|6} +0d0]][[ [$Attack Bonus] ?{Attack Bonus?|6} +0d0]]  --format|Black --charid|@{character_id} --name|Scorching Ray --rightsub|Ranged Touch --?? $Empower == 1.5 ?? Empowered *2:|Whoa that's a big Ray! --?? $Empower == 2 ?? Empower Stacked:|WHAT THE HELL Ray! --Target *1:|$$#990000|@{target|Target 1|token_name}$$ --Ray 1:|[[ [$Atk] 1d20cs>20 +12 +?{Attack Bonus?|} ]] vs AC --?? $Atk.base == 1 ?? !Miss *1:|Gun Jammed *Gains Broken Condition. --?? $Atk.base <> 1 AND $Atk.base <> 20 ?? Hit 1:|[[ [NH] (4d6+13 +?{Attack Bonus?})*?{Empower?}+3]] Damage --?? $Atk.base >= 20 ?? Critical *1:|[[ ((4d6+13 +?{Attack Bonus?})*?{Empower?}+3)*2 ]] --Target *2:|$$#990000|@{target|Target 2|token_name}$$ --Ray 2:|[[ [$Atk2] 1d20cs>20 +12 +?{Attack Bonus?} ]] vs AC --?? $Atk2.base == 1 ?? !Miss *1:|Gun Jammed *Gains Broken Condition. --?? $Atk2.base <> 1 AND $Atk2.base <> 20 ?? Hit 2:|[[ [NH] (4d6+13 +?{Attack Bonus?})*?{Empower?}+2]] Damage --?? $Atk2.base >= 20 ?? Critical *2:|[[ ((4d6+13 +?{Attack Bonus?})*?{Empower?}+3)*2 ]] --Target *3:|$$#990000|@{target|Target 3|token_name}$$ --Ray 3:|[[ [$Atk3] 1d20cs>20 +12 +?{Attack Bonus?} ]] vs AC --?? $Atk3.base == 1 ?? !Miss *1:|Gun Jammed *Gains Broken Condition. --?? $Atk3.base <> 1 AND $Atk3.base <> 20 ?? Hit 3:|[[ [NH] (4d6+13 +?{Attack Bonus?})*?{Empower?}+2 ]] Damage --?? $Atk3.base >= 20 ?? Critical *3:|[[ ((4d6+13 +?{Attack Bonus?})*?{Empower?}+3)*2 ]] }}
1487650091
Silvyre
Forum Champion
Conditionals don't seem to play nice with decimals. Try making these changes: [[ [$Empower] ?{Empower?|No, 0|Yes, 1|Double, 2} * 0.5 + 1 + 0d0 ]] --?? $Empower == 1 ?? Empowered *2:|Whoa that's a big Ray! --?? $Empower == 2 ?? Empower Stacked:|WHAT THE HELL Ray! Thereafter, replace every instance of ?{Empower?} with (?{Empower?} * 0.5 + 1)
Tried those changes but the $Empower sees "No" as a value of 1 after the math.  The "Empowered" line triggers when i choose both "no" and "Yes" which is an upgrade as i couldn't get it to trigger off the yes answer before.  I tried changing the lines to: -?? $Empower > 1 AND <> 2 ?? Empowered *2:|Whoa that's a big Ray! I also tried  -?? $Empower >= 1 AND <> 2 ?? Empowered *2:|Whoa that's a big Ray! Neither of those helped.
1487653449

Edited 1487653652
Weird. A log of the roll id's and their values shows it is correctly setting 1.5 for base and total. Digging further. Ah, when getting the values from a roll id, PowerCards is rounding. Will probably just need to change it from parseInt to parseFloat to fix. Testing now.
Ok, changing all the parseInt's in the script to parseFloats instead (where it concerns roll id's and their values), fixes the problem. This works with the changes and doesn't appear to break anything to my knowledge. !power {{ --name|Empower Test --hroll| [[ [$Empower] ?{Empower|No, 1|Yes, 1.5|Double, 2} + 0d0 ]] --Result:| [^Empower] --?? $Empower == 1 ?? Empower No:|True --?? $Empower == 1.5 ?? Empower Yes:|True --?? $Empower == 2 ?? Empower Double:|True }}
February 21st, 2017 ~ 12:20 am eastern Version: 3.3.1 Link: <a href="https://gist.github.com/Sky-Captain-13/452330a3d9" rel="nofollow">https://gist.github.com/Sky-Captain-13/452330a3d9</a>... Bugfix: The script was rounding rolls with decimal points when used in a conditional. [[ [$Roll] 0d0 + 0.5 ]] would return as 1 instead of 0.5 in a conditional, meaning ?? $Roll == 0.5 ?? would never return as true. TLDR... decimal points weren't working properly.
1487671075
Silvyre
Forum Champion
(Glad my fix isn't needed any longer, but I forgot to replace $Empower with ?{Empower?} within the conditionals!)
You guys are awesome, thanks!
Hey guys, just a quick question. Is it possible to use PowerCards with Macros? I have a lot of macros I use and I tried making an inline chat menu, but that wouldn't call the macros. Is there a way to do this with PowerCards, kind of like what you'd do for a spellbook or something like that?
You can. but that requires replacing html entities in the roll query. Basically create the powercard as a macro on the character and then call that macro from another macro with a roll query.
SkyCaptainXIII said: You can. but that requires replacing html entities in the roll query. Basically create the powercard as a macro on the character and then call that macro from another macro with a roll query. What if it's not for a character? Can you put an example if I wanted to put say 3 macros named: Books, Scrolls and Coins?
You should be able to use global macros too with #MacroName.
Arthur, what is your goal with your macros?&nbsp;
For this one I want to have an in-chat menu of the Macros I most commonly use. Since I have a bunch of them, it gets tiring scrolling down the list. I tried setting it up without using PowerCards by using the general [Books](~#Books) and it sends a button into chat but will not call the Macro. So I was trying with PowerCards and got the same error.
1488826759

Edited 1488826850
Silvyre
Forum Champion
Arthur B. said: [Books](~#Books) It is not possible to call a Macro using an Ability Command Button . You want to use an API Command Button : [Books](!&amp;#13;#Books) Furthermore, in order to use Command Buttons with PowerCards, you must use the --whisper| tag. I suggest adding --whisper|all to your macro.
Silvyre said: Arthur B. said: [Books](~#Books) It is not possible to call a Macro using an Ability Command Button . You want to use an API Command Button : [Books](!&#13;#Books) Furthermore, in order to use Command Buttons with PowerCards, you must use the --whisper| tag. I suggest adding --whisper|all to your macro. Oh yeah, I still need to investigate that issue. Thanks for bringing that up again.
1488829990

Edited 1488830092
Ah, I will try that tonight. But if I use --whisper|all, wouldn't that whisper it to everyone? Also, will [Books](!#Books) work in the chat as a buton without a script like PowerCards?