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] It's A Trap! v2.3

Thought that was the case. The trigger feature is awesome, btw. It opens up tons of possibilities. Used it as a means of dropping increasingly more difficult waves of mobs around the party. The only thing was that occasionally the mobs would seem to trigger independently.  Was checking to see if I could trick it by lowering the proximity to a negative number or something like that. . 
1482161128
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I can see the use for that. I'll keep it in mind for future enhancements.
I'm stuck on this part... "activate its 'ItsATrap_trapCreationWizard' token macro." How do I activate the macro? Thanks
NM. It creates a macro.  Maybe include that in the instructions? "You should have a new Macro called..."
quick question, what would i have to change exactly to get this to work fine for DnD 4e? 
1482858163

Edited 1482858194
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ryan T. said: quick question, what would i have to change exactly to get this to work fine for DnD 4e?&nbsp; You would need to implement a trap theme for whatever D&D 4E sheet you are using.&nbsp; See&nbsp; <a href="https://github.com/Roll20/roll20-api-scripts/blob/master/Its%20A%20Trap/3.1/ItsATrap.js#L1379" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/blob/master/Its%20A%20Trap/3.1/ItsATrap.js#L1379</a> for the TrapTheme base class and use the 5E-OGL TrapTheme ( <a href="https://github.com/Roll20/roll20-api-scripts/blob/master/ItsATrap_theme_5E_OGL/3.0/TrapTheme.js" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/blob/master/ItsATrap_theme_5E_OGL/3.0/TrapTheme.js</a> ) implementation as a reference for implementing your trap theme.
1483134334
Ada L.
Marketplace Creator
Sheet Author
API Scripter
News! I've got a big update for It's A Trap planned for the near future. I've come up with some new math and rewrote the Token Collisions script to handle collisions with even better pixel-perfect accuracy. This will affect It's A Trap in allowing users to specify trigger areas for traps defined by arbitrary polygon paths!&nbsp; The new version of It's A Trap isn't ready yet, but you can try out the new pixel-perfect collisions by grabbing the newest Path Math and Token Collisions scripts: Path Math v1.4 Token Collisions v1.5 Since It's A Trap v3.3 is soon going to support triggers defined by paths, there's going to be a bit of a paradigm shift on how triggers for traps are set up.&nbsp;Specifically, I'm going to be getting rid of the Triggers property. The reasons are as follows: If mishandled, the Triggers property could lead to infinite loops. In v3.3, it will be cleaner to create a path, and then set one or more trap-like objects to be triggered by that path. Traps activated by the Triggers property could still be activated by bumping into them. For some types of trap-like objects such as secret doors, this might be undesirable. The code support needed for the Triggers property produces a lot of clutter in the script, and I'm trying to make it cleaner. I'd like to present the opportunity for you, the script users, to provide some input on this matter. Is the Triggers property useful to you? Useful enough to keep, even when the path-based triggers feature is rolled out? Are there other new features you'd like to see in this script?
I like the fact that triggers can be used to set off something that the players never even come near to. The path based trigger is exiting, but my guess is that both will continue to be useful.
1483135822
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Stephen, will I need to change how my script is interacting with Token Collisions or will it still function as normal?
1483138341
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Scott C. said: Stephen, will I need to change how my script is interacting with Token Collisions or will it still function as normal? The interface for Token Collisions isn't changing. It will just automagically support the pixel-perfect collisions and polygon/path collisions. New classes have been added to the PathMath namespace, but none of the existing interfaces for that have changed either.
1483138448

Edited 1483138467
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Awesome. And Thank you for the quick response.
How do I remove the&nbsp;'ItsATrap_trapCreationWizard' token macro from all my tokens? I tried disabling the API script and all of its dependencies, and it still keeps appearing.
1483286606
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Carlo said: How do I remove the&nbsp;'ItsATrap_trapCreationWizard' token macro from all my tokens? I tried disabling the API script and all of its dependencies, and it still keeps appearing. Just uninstall the script and remove the macro from your macros list.
You could also just uncheck the "Show as Token Action" box on the macro.
Got it, thanks!
1483592113

Edited 1483720964
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Update v3.3 Beta This version includes: Made the Trap Creation Wizard a bit more organized. There is now a new Set Triggers option in the wizard which allows you to set one or more arbitrary paths on the GM layer as the trigger for the trap. By default, the trap's own token is used as its trigger. Trap types have been changed from a drop-down list to a text input. Thanks for the input on the usefulness of the Triggers option. Since many of you would still find it useful with this update, I've left it in. Here's an animation demonstrating how to set paths as triggers for your traps: Get it here:&nbsp; <a href="https://github.com/Cazra/roll20-api-scripts/blob/t" rel="nofollow">https://github.com/Cazra/roll20-api-scripts/blob/t</a>... You'll also need Path Math v1.4 and Token Collisions v1.5 from the same branch. Pull request/One-Click pending.
1483623580
Ziechael
Forum Champion
Sheet Author
API Scripter
Awesome update, addresses the exact problem I had with triggers in my mage's tower of doom... can't wait to set up my next trap filled dungeon!! =D
This is a fantastic resource now, but a couple of questions: is there a way to copy the details from one trap to another, for example if i have 2 pit traps, instead of reentering all the details? Is there a way to link this to the powercards format?
1484665914
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Jon M. said: is there a way to copy the details from one trap to another, for example if i have 2 pit traps, instead of reentering all the details? Right now the only way to copy the details from one trap to another is to copy the contents of the trap token's GM Notes to the other trap token. Jon M. said: Is there a way to link this to the powercards format? I am not familiar with this powercards format. Could you elaborate?
I tried copying the gm notes but got this error next to the message link :ERROR: invalid TrapEffect JSON. for powercards, the format is proably best explained in the first post of its thread:&nbsp; <a href="https://app.roll20.net/forum/post/4285059/script-powercards-3-thread-4/?pagenum=1" rel="nofollow">https://app.roll20.net/forum/post/4285059/script-powercards-3-thread-4/?pagenum=1</a>&nbsp;
1484677024
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Hmm.. Copying the GM Notes contents normally works. For the Powercards stuff, you may be able to link it up by putting a !power command into a trap's API command property.&nbsp;
1484760689

Edited 1484761425
This looks so amazing! Thank you very much for the hard work but I'm having trouble getting it working, a little help? My problem: I've set a token to the GM layer, set the cobweb icon onto the trap, but when I click the "ItsATrap_trapCreationWizard_showMenu" macro (that was pre-made when I installed the script) I don't get the trap menu appearing in my chat. I don't have any errors appear in my API output console (in fact, nothing happens there at all when I click the macro). When I don't have the token selected and run the macro, it gives the normal "you need to select a token" error in the API output so at least I know the script is running. I have the 5E-OGL theme running and set up and all my other scripts are working fine (I have disabled all of them except for this one to test for the error). Thoughts? Edit: When I move a PC token on top of the trap, it triggers the token with the cobweb and gave me a generic trigger message (copied:) IT'S A TRAP!!! Target: Rob MISS!
1484765761

Edited 1484765885
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I cannot reproduce this issue. Are you running v3.3? If so, could you add this: log('/w "' + _fixWho(who) + '" ' + msg); below line 1456 in the It's A Trap v3.3 script and tell me what you get printed in the console?
a few questions and notes if you will. i'm using D5e shaped sheet campaign and a blank map page with nothing at all modified from default options and a 1 unit (1 square) trap item. target tokens are 1 unit in size. a) if installing via github (3.3 br), what else do i need to install for d5e shaped? i've installed the four packages needed for default function, i'm referring to just files needed for additional d5e shaped ops. b) i understand that you need to be themed before your pc's passive works, correct? c) my trap fires when a pc comes in trigger range but there's no target(s) and no hit/miss for the targets in blast range d) my pc that triggered the trap gets pushed 1/2 a square back diagonally so my pc is sitting precisely in the middle of four squares
1484768731
Ada L.
Marketplace Creator
Sheet Author
API Scripter
FirefighterBlu3 said: a few questions and notes if you will. i'm using D5e shaped sheet campaign and a blank map page with nothing at all modified from default options and a 1 unit (1 square) trap item. target tokens are 1 unit in size. a) if installing via github (3.3 br), what else do i need to install for d5e shaped? i've installed the four packages needed for default function, i'm referring to just files needed for additional d5e shaped ops. b) i understand that you need to be themed before your pc's passive works, correct? c) my trap fires when a pc comes in trigger range but there's no target(s) and no hit/miss for the targets in blast range d) my pc that triggered the trap gets pushed 1/2 a square back diagonally so my pc is sitting precisely in the middle of four squares a) If you've got all the dependencies for It's A Trap also installed (including Path Math 1.4 and Token Collisions 1.5, which are new), then you just need to install the 5E Shaped trap theme from One-Click. b) Yes, passive perception only works with a theme installed. I'm not sure what your points are about notes c and d. Could you elaborate on what you've got your traps' properties set to and what you're trying to do with them?
1484776645

Edited 1484777268
(Edit: I was initially using the one-click installed version (3.1?) and have since updated to 3.3 because I could not edit the other version) Thanks for the help! Using 3.3 and putting the log line after 1456 like you said: "/w \"Blake\" &lt;div style=\"background: #fff; border: solid 1px #000; border-radius: 5px; font-weight: bold; margin-bottom: 1em; overflow: hidden;\"&gt;&lt;div style=\"background: #000; color: #fff; text-align: center;\"&gt;Trap Configuration&lt;/div&gt;&lt;div style=\"padding: 5px; text-align: center;\"&gt;&lt;div style=\"\"&gt;&lt;h4 style=\"\"&gt;Core properties&lt;/h4&gt;&lt;table style=\"\"&gt;&lt;tr title=\"The name of the trap\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Name](!ItsATrap_trapCreationWizard_modifyTrapCore name&&?{Name The name of the trap })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;trap&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"Is this a trap, or some other hidden secret?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Type](!ItsATrap_trapCreationWizard_modifyTrapCore type&&?{Type Is this a trap, or some other hidden secret? })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;trap&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"The message displayed when the trap is activated.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Message](!ItsATrap_trapCreationWizard_modifyTrapCore message&&?{Message The message displayed when the trap is activated. })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"A disabled trap will not activate when triggered, but can still be spotted with passive perception.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Disabled](!ItsATrap_trapCreationWizard_modifyTrapCore disabled&&?{Disabled A disabled trap will not activate when triggered, but can still be spotted with passive perception. |yes|no})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;no&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"When the trap is activated, should its results only be displayed to the GM?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[GM Only](!ItsATrap_trapCreationWizard_modifyTrapCore gmOnly&&?{GM Only When the trap is activated, should its results only be displayed to the GM? |yes|no})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;no&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"Additional secret notes shown only to the GM when the trap is activated.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[GM Notes](!ItsATrap_trapCreationWizard_modifyTrapCore notes&&?{GM Notes Additional secret notes shown only to the GM when the trap is activated. })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;h4 style=\"margin-top: 2em;\"&gt;Shape properties&lt;/h4&gt;&lt;table style=\"\"&gt;&lt;tr title=\"Should this trap affect flying tokens (fluffy-wing status )?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Affects Flying Tokens](!ItsATrap_trapCreationWizard_modifyTrapCore flying&&?{Affects Flying Tokens Should this trap affect flying tokens (fluffy-wing status )? |yes|no})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;no&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"How far away can the trap affect other tokens?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Blast distance](!ItsATrap_trapCreationWizard_modifyTrapCore effectDistance&&?{Blast distance How far away can the trap affect other tokens? })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"Does this trap stop tokens that pass through its trigger area?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Stops Tokens At](!ItsATrap_trapCreationWizard_modifyTrapCore stopAt&&?{Stops Tokens At Does this trap stop tokens that pass through its trigger area? |center|edge|none})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"Is the shape of the trap's effect circular or square?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Trap shape](!ItsATrap_trapCreationWizard_modifyTrapCore effectShape&&?{Trap shape Is the shape of the trap's effect circular or square? |circle|square})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;circle&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;h4 style=\"margin-top: 2em;\"&gt;Trigger properties&lt;/h4&gt;&lt;table style=\"\"&gt;&lt;tr title=\"To set paths, you must also select the paths that trigger the trap.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Set Trigger](!ItsATrap_trapCreationWizard_modifyTrapCore triggerPaths&&?{Set Trigger To set paths, you must also select the paths that trigger the trap. |self|paths})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;self&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"A list of the names or token IDs for other traps that are triggered when this trap is activated.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Other Traps Triggered](!ItsATrap_trapCreationWizard_modifyTrapCore triggers&&?{Other Traps Triggered A list of the names or token IDs for other traps that are triggered when this trap is activated. })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;h4 style=\"margin-top: 2em;\"&gt;Reveal properties&lt;/h4&gt;&lt;table style=\"\"&gt;&lt;tr title=\"How far away can characters passively search for this trap?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Max Search Distance](!ItsATrap_trapCreationWizard_modifyTrapCore searchDist&&?{Max Search Distance How far away can characters passively search for this trap? })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"Should this trap be revealed to the players when it is activated?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[When Activated](!ItsATrap_trapCreationWizard_modifyTrapCore revealToPlayers&&?{When Activated Should this trap be revealed to the players when it is activated? |yes|no})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;no&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"Should this trap be revealed to the players when a character notices it by passive searching?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[When Spotted](!ItsATrap_trapCreationWizard_modifyTrapCore revealWhenSpotted&&?{When Spotted Should this trap be revealed to the players when a character notices it by passive searching? |yes|no})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;no&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"When this trap is revealed, which layer is it revealed on?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Layer](!ItsATrap_trapCreationWizard_modifyTrapCore revealLayer&&?{Layer When this trap is revealed, which layer is it revealed on? |map|objects})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;map&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;h4 style=\"margin-top: 2em;\"&gt;Special properties&lt;/h4&gt;&lt;table style=\"\"&gt;&lt;tr title=\"An API command which the trap runs when it is activated. The constants TRAP_ID and VICTIM_ID will be replaced by the object IDs for the trap and victim.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[API Command](!ItsATrap_trapCreationWizard_modifyTrapCore api&&?{API Command An API command which the trap runs when it is activated. The constants TRAP_ID and VICTIM_ID will be replaced by the object IDs for the trap and victim. })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"What special FX are displayed when the trap is activated?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Special FX](!ItsATrap_trapCreationWizard_modifyTrapCore fx&&?{FX Name The name of the special FX. }&&?{FX Offset The offset (in units) of the special FX from the trap's center. Format: [X,Y] }&&?{FX Direction The directional vector for the special FX (Leave blank to direct it towards characters). Format: [X,Y] })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;None&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"A sound from your jukebox that will play when the trap is activated.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Sound](!ItsATrap_trapCreationWizard_modifyTrapCore sound&&?{Sound A sound from your jukebox that will play when the trap is activated. })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;h4 style=\"margin-top: 2em;\"&gt;Theme-specific properties&lt;/h4&gt;&lt;table style=\"\"&gt;&lt;tr title=\"The trap's attack roll bonus vs AC.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Attack Bonus](!ItsATrap_trapCreationWizard_modifyTrapTheme attack&&?{Attack Bonus The trap's attack roll bonus vs AC. })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"The dice roll expression for the trap's damage.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Damage](!ItsATrap_trapCreationWizard_modifyTrapTheme damage&&?{Damage The dice roll expression for the trap's damage. })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"Show the Saving Throw result only to the GM?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Hide Save Result](!ItsATrap_trapCreationWizard_modifyTrapTheme hideSave&&?{Hide Save Result Show the Saving Throw result only to the GM? |yes|no})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;no&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"Does the trap deal half damage on a miss?\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Miss - Half Damage](!ItsATrap_trapCreationWizard_modifyTrapTheme missHalf&&?{Miss - Half Damage Does the trap deal half damage on a miss? |yes|no})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;no&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"The type of saving throw used by the trap.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Saving Throw](!ItsATrap_trapCreationWizard_modifyTrapTheme save&&?{Saving Throw The type of saving throw used by the trap. |none|str|dex|con|int|wis|cha})&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"The DC for the trap's saving throw.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Saving Throw DC](!ItsATrap_trapCreationWizard_modifyTrapTheme saveDC&&?{Saving Throw DC The DC for the trap's saving throw. })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr title=\"The skill check DC to spot the trap.\" style=\"\"&gt;&lt;td style=\"font-size: 0.8em;\"&gt;[Spot DC](!ItsATrap_trapCreationWizard_modifyTrapTheme spotDC&&?{Spot DC The skill check DC to spot the trap. })&lt;/td&gt;&lt;td style=\"font-size: 0.8em;\"&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;div style=\"margin-top: 2em;\"&gt;[Activate Trap](!itsATrapRemoteActivate)&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;"
1484778410

Edited 1484778449
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ok, so it should be whispering a message with the menu to the player named "Blake". If you try something like&nbsp; /w "Blake" This is a test. in the chat and that works, then the menu should also work for you. If that doesn't work, then my best guess is that some other script might be overriding sendChat to cause problems here, because I can't reproduce the issue in my clean environment.&nbsp;
Yeah "/w "Blake" This is a test." Is working just fine, also other scripts are sending me messages (whispers) just fine. I'll try turning off all other scripts again and see what happens. Thanks for the help though!
1485021676

Edited 1485021739
How do I 'reset' a trap so that when a player moves over it again it trips again? &nbsp;I have scythe blades that swing each time you step in their area, but my traps set off the first time and then won't trigger again. Also, what's the syntax to get my audio file to play when the trap is triggered? &nbsp;I'm not sure exactly what to write in that box. &nbsp;I used the basic Several Swinging Scythes Trap &nbsp; sound.
1485046834
Ada L.
Marketplace Creator
Sheet Author
API Scripter
You can reset a trap by returning it to the GM layer.
1485285055
Ziechael
Forum Champion
Sheet Author
API Scripter
Am i missing something obvious to get fx to work? {"type":"natural occurrence","message":"A plume of acidic gas is discharged from a natural vent in the floor.","stopAt":"none","triggerPaths":["-KbGqpRadoHyYwQVNx7k"],"fx":{"name":"explode-acid"},"sound":"flames","damage":"4d8","missHalf":true,"save":"fort","saveDC":18}
1485285558
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ziechael said: Am i missing something obvious to get fx to work? {"type":"natural occurrence","message":"A plume of acidic gas is discharged from a natural vent in the floor.","stopAt":"none","triggerPaths":["-KbGqpRadoHyYwQVNx7k"],"fx":{"name":"explode-acid"},"sound":"flames","damage":"4d8","missHalf":true,"save":"fort","saveDC":18} Your JSON is working fine for me after I remove the sound option (since I don't have a sound called "flames"). Are you sure that you are spelling the sound exactly how it appears in your jukebox?
1485285704
Ziechael
Forum Champion
Sheet Author
API Scripter
ah, that might be it... in my test game i had no sound named that but didn't connect that 'failing' with the fx not working... just tested and works amazingly well can't wait for tonights game now!! Will be more thorough before panic posting an hour before play in future sorry!
1485289969
Ada L.
Marketplace Creator
Sheet Author
API Scripter
No problem! I'll I'll see about fixing the next version so that if the sound doesn't exist, it'll still do the rest of the trap's output, but it will send the GM a message about it.
1485394119

Edited 1485394196
Good day, When attempting to use the creation wizard, I get the following error within the API: "ItsATrapCreationWizard: HtmlBuilder is not defined" "ReferenceError: HtmlBuilder is not defined\n at displayWizard (apiscript.js:4306:23)\n at apiscript.js:4789:9\n at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:146:34), &lt;anonymous&gt;:65:16)\n at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:146:34), &lt;anonymous&gt;:70:8)\n at /home/node/d20-api-server/api.js:1489:12\n at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560\n at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147)\n at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546)\n at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489)\n at Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)\n at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:111:400" The token is on the GM layer with the cobweb applied to it. Additionally, there is no feedback of any kind, whether in the form of a menu or chat, in the actual roll20 application when using the button. Simply nothing happens, and the API has the previously noted entry. Thank you very much for letting me know what I might be doing wrong.
1485440133
Ada L.
Marketplace Creator
Sheet Author
API Scripter
It sounds like for some reason HTML Builder, which is a dependency for this script, was not installed when you installed this script. You can either try reinstalling It's A Trap through the One-Click installer and see if it picks it up this time, or you can manually add the HTML Builder script:&nbsp;<a href="https://github.com/Roll20/roll20-api-scripts/blob/master/HtmlBuilder/1.0/script.js" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/blob/master/HtmlBuilder/1.0/script.js</a>
1485454334

Edited 1485454546
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Hey Stephen, Did you make changes to PathMath lately? My calls to it in Page Navigator are suddenly crashing the sandbox and I haven't made any changes to the script since it was last working. Error: TypeError: Cannot read property '1' of undefined TypeError: Cannot read property '1' of undefined at apiscript.js:1656:34 at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9) at toSegments (apiscript.js:1638:11) at apiscript.js:1758:41 at iterator (/home/node/d20-api-server/node_modules/underscore/underscore.js:184:16) at Function. (/home/node/d20-api-server/node_modules/underscore/underscore.js:199:14) at _.(anonymous function) [as reduce] (/home/node/d20-api-server/node_modules/underscore/underscore.js:1496:34) at _toSegmentsMany (apiscript.js:1757:12) at Object.toSegments (apiscript.js:1630:20) at _.each.mapSurrounding (apiscript.js:3653:33) EDIT: Ok, this is really weird, moved it back to a v1.0 from v1.4 and it's still throwing the error. What the heck? This was working fine last week. I apologize for hijacking your It's a Trap thread, but seemed the most appropriate place.
1485455831

Edited 1485455972
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Yes, Path Math is now v1.4. Although some new functions and classes were added in v1.4 to support the new features in Token Collisions 1.5 and It's A Trap 3.3, the existing interface for it hasn't changed. Neither of Path Math's dependencies, Vector Math or Matrix Math, have changed either. Can you share the code you are using to call PathMath.toSegments()?
1485463313

Edited 1485463405
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yep,&nbsp; here's a gist of a reasonably simple replication. Figured you didn't want to have to dig through all of PageNavigator to find the relevant code. The part I can't figure out is that this worked perfectly fine last week when I did some updating to PageNavigator and I haven't changed anything since it was last working, and the problem seems to persist even if I go back a version on PathMath.
1485465827
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Thanks. I just tried to reproduce your issue using your test script. In my API sandbox campaign, I didn't have any issues, so to be sure I also started a brand new campaign and only installed It's A Trap and its dependencies (including Path Math 1.4) and your test script.&nbsp; I drew several walls onto the dynamic lighting layer using polygon lines, freehand lines, and even ellipses (newly supported in Path Math 1.4). All of these appear to be working fine, as I see the correct logging output for wallPaths from your script. I could not get it to produce an error.
1485466200

Edited 1485466739
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
hmmm, ok, that's interesting, I'll keep digging then. EDIT: Well looks like there's something bugged in my development game. Like you, it works fine for me in other games. Thanks for looking into it Stephen.
1485481701

Edited 1485481759
The Aaron
Pro
API Scripter
Seeing that error in game right now: For reference, the error message generated was: TypeError: Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined &nbsp; at .each..each..chain.map..each.getDestinationCollisions (apiscript.js:12059:37) &nbsp; at eval (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:146:34), &lt;anonymous&gt;:65:16) &nbsp; at Object.publish (eval at &lt;anonymous&gt; (/home/node/d20-api-server/api.js:146:34), &lt;anonymous&gt;:70:8) &nbsp; at TrackedObj.set (/home/node/d20-api-server/api.js:909:14) &nbsp; at updateLocalCache (/home/node/d20-api-server/api.js:1178:18) &nbsp; at /home/node/d20-api-server/api.js:1357:11 &nbsp; at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 &nbsp; at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) &nbsp; at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) &nbsp; at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) &nbsp; at Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425) ?? 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 "ERROR - It's A Trap!: Cannot read property '1' of undefined" "TypeError: Cannot read property '1' of undefined &nbsp;at apiscript.js:9631:34 &nbsp;at Function..each..forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:153:9) &nbsp;at toSegments (apiscript.js:9620:11) &nbsp;at apiscript.js:9740:41 &nbsp;at iterator (/home/node/d20-api-server/node_modules/underscore/underscore.js:184:16) &nbsp;at Function.&lt;anonymous&gt; (/home/node/d20-api-server/node_modules/underscore/underscore.js:199:14) &nbsp;at _.(anonymous function) [as reduce] (/home/node/d20-api-server/node_modules/underscore/underscore.js:1496:34) &nbsp;at _toSegmentsMany (apiscript.js:9739:12) &nbsp;at Object.toSegments (apiscript.js:9612:20) &nbsp;at Function.filterTokens (apiscript.js:15452:35)" "ERROR - It's A Trap!: Cannot read property '1' of undefined"
1485485139

Edited 1485486582
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I don't recognize the function getDestinationCollisions(). What script is that from? Edit: Okay, I'm seeing the error too now. I'll try to get it fixed as soon as possible.
1485486666
The Aaron
Pro
API Scripter
My GM dropped back to PathMath 1.4 and it hasn't crashed since.
1485487241
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I've got a patch for toSegments(). Try this and let me know if you have any more trouble. &nbsp; &nbsp; /** &nbsp; &nbsp; &nbsp;* Converts a path into a list of line segments. &nbsp; &nbsp; &nbsp;* This supports freehand paths, but not elliptical paths. &nbsp; &nbsp; &nbsp;* @param {(Path|Path[])} path &nbsp; &nbsp; &nbsp;* @return {Segment[]} &nbsp; &nbsp; &nbsp;*/ &nbsp; &nbsp; function toSegments(path) { &nbsp; &nbsp; &nbsp; &nbsp; if(_.isArray(path)) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return _toSegmentsMany(path); &nbsp; &nbsp; &nbsp; &nbsp; var _path = JSON.parse(path.get('_path')); &nbsp; &nbsp; &nbsp; &nbsp; var transformInfo = getTransformInfo(path); &nbsp; &nbsp; &nbsp; &nbsp; var segments = []; &nbsp; &nbsp; &nbsp; &nbsp; var prevPt; &nbsp; &nbsp; &nbsp; &nbsp; _.each(_path, tuple =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let type = tuple[0]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Convert the previous point and tuple into segments. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; let newSegs = []; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(type === 'C') { // Cubic Bezier &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newSegs = _toSegmentsC(prevPt, tuple, transformInfo); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prevPt = newSegs[newSegs.length - 1][1]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(type === 'L') { // Line &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newSegs = _toSegmentsL(prevPt, tuple, transformInfo); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(newSegs.length &gt; 0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prevPt = newSegs[0][1]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(type === 'M') { // Move &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prevPt = tupleToPoint(tuple, transformInfo); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(type === 'Q') { // Freehand (tiny Quadratic Bezier) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newSegs = _toSegmentsQ(prevPt, tuple, transformInfo); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(newSegs.length &gt; 0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; prevPt = newSegs[0][1]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _.each(newSegs, s =&gt; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; segments.push(s); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp; &nbsp; return segments; &nbsp; &nbsp; }
1485487840

Edited 1485487928
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Getdestinationcollisions is from page navigator, but pathmath isn't called from there, really hate the way the new sandbox describes where the error is. ill try that patch come morning, thanks for the help Stephen.
1485490268
The Aaron
Pro
API Scripter
Yeah, there seems to be something fouled up in the way errors are reported lately. &nbsp;I was having the same issue yesterday trying out KABOOM.