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 .
×
D&D 2024 has arrived! Pre-order the new core rulebooks now and get an exclusive pre-order bonus for free!
Create a free account

[Script] It's A Trap! v2.3

1468963969
Ada L.
Marketplace Creator
Sheet Author
API Scripter
The aura determines what tokens are subjected to the trap when it is triggered. To actually trigger the trap, a token must collide with the trap's token.
1468964212
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Ah, misunderstood the functionality.
1468966943

Edited 1468970952
Ziechael
Forum Champion
Sheet Author
API Scripter
Just had an odd bit of behaviour, traps were triggering without being collided with... in fact they seemed to trigger from opposite sides of the map when i was changing the HP of a PC and nothing else? Also the trap json was being outputted to chat without any formatting too? Will look into it a bit more tomorrow and let you know my findings but bed time is a-calling right now... ps. since the thread is closed... i'm going to be using your geiger counter soon in this game but noticed that when i have tokens in range of a 'source' on another map and change the HP of a token linked to the same character on the player ribbon page it sends a radiation message to the chat... would it be possible to only have it trigger on the ribbon/player pages? sorry to ask so much!
1468974679
Ada L.
Marketplace Creator
Sheet Author
API Scripter
The traps should only be triggered if it is on the same page as the token moved. I will double check this when I have a chance though. Can you also tell me the nature of the collision. Were both tokens circular, were both square? Was one circular and the other square? Does this happen with previous versions of It's A Trap?
1469011955
Ziechael
Forum Champion
Sheet Author
API Scripter
Sorry, had to post and run last night... very late. It seems that a token on another page that is linked to a sheet is 'colliding' with a trap when it is in the same place and received a 'change' such as a hot point adjustment... it just so happens that there is a player token in the same grid squares as the circled traps already in place on some upcoming maps from my testing. This gif (limited to a measly 7 seconds) just about shows the HP adjustment to a player triggering the trap in the north east: You can see it change from a hidden to active trap right at the end lol... also if you look at the chat it shows that the 'radioactive' source on another page is registering the token update as something to tell me about too lol (I know the quick fix is to not put player tokens on pages until I need them there but I'm a CDO prep'er (OCD is the wrong way around!). Also confused about the output since the json looks to be set up correctly (although the fx didn't work when actually walking over the trap properly...): { "damage": "8d6 + 8", "fx": "explode-fire", "message": "A magical glyph flashes to life and then erupts in a whirling storm of fire!", "missHalf": true, "save": "ref", "saveDC": 20, "sound": "Fireball", "spotDC": 40 }
1469032512
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Thanks for the detailed response. I think it has helped me identify where the problem lies that affects both of the scripts. I'll try to get a fix in later.
1469049113
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I think I've got things fixed for the ItsATrap and GeigerCounter scripts now. The fixes are included in this pull request:&nbsp;<a href="https://github.com/Roll20/roll20-api-scripts/pull/314" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/pull/314</a>
1469049778
Ziechael
Forum Champion
Sheet Author
API Scripter
Awesome thanks, will let you know if I find any new ways to break your gifts to the world :)
1469050018
Ada L.
Marketplace Creator
Sheet Author
API Scripter
As for the FX not appearing for your traps, your JSON is correct. It looks like you are using a custom trap theme though. Are you using ItsATrap.announceTrap(effect) to send your trap's message? That will now handle any sounds or FX your trap has too.
1469050646
Ziechael
Forum Champion
Sheet Author
API Scripter
It is the 3.5e theme :/ i hope...
1469051545
Ada L.
Marketplace Creator
Sheet Author
API Scripter
hmm... I don't remember it showing the raw JSON in the chat.
1469051810
Ziechael
Forum Champion
Sheet Author
API Scripter
it shouldn't lol, in my test game and previous uses it shows the lovely powercards like format? I broke it didn't i...
1469071020
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Yeah, you should be getting a nicely formatted message box for it. From the looks of that chat message though, do you have text in the GM notes before the JSON? That would cause the JSON to be printed as raw text.
1469088682

Edited 1469088759
Ziechael
Forum Champion
Sheet Author
API Scripter
This is the GM notes (on reflection I copied it from the 3.5e theme help page and tweaked so maybe it picked up some hidden characters? will do some testing with actually inputting it myself later):
1469193255
Ziechael
Forum Champion
Sheet Author
API Scripter
*face palms self and prostrates oneself for admonishment* I HAD A SECOND VERSION OF THE SCRIPT ON MY MAIN GAME STILL!!! Disabling that version allowed the json to output to chat properly and fixed the fx issue... I'm just glad that my original findings helped to tweak the code for preventing off page conflict ;) Sorry for any extra effort you've wasted on my stupidity!!
1469197779
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ah... Glad you found the answer to that issue! XD
So I like the idea of this script but I can't get it to work right. I play a seldom-used system, the warhammer 40k RPG system and really I don't need a theme. I just want the trap to display its message, and then 2 or more inline rolls. That's all I need. HOWEVER, when I do this it all mashes together and I cant' get it to line break anyway. Is there some way to get it to put the message, and several in-line rolls seperated by lines? The documentation at the OP is too vague for me to figure it out. I must be stupid.
1469568135
Ada L.
Marketplace Creator
Sheet Author
API Scripter
How are you setting up your trap? Screenshots would help best.
Sorry. So its just standard. A token with the web icon, then in gm notes I just type A steam main vents dangerous scalding heat onto you! Attack: [[50-1d100]] Damage: [[5d10]] I do each of those on a seperate line but it comes out like this: I'd just like them separated out.
1469715543
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ah, I see now. I'll try to put in a fix for this in the next update.
1469738599
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ok, this should be fixed in version 2.5. It will also support other formatting you put in the GM notes for non-JSON traps.
Hi Stephen! Love the script (pretty sure I told you already but there you go). I'm having a small problem with information being lost in translation. I'm currently converting all my trap data into my native language (swedish) and when I use one of the three special letters of our alphabet "Å, Ä, Ö" in the trap message the script refuses to work. When I write the message without the special letters it works flawlessly. Do you know if it's possible to fix? Not that it's hard to use information in english, I just don't like mixing languages in chat &nbsp;;)
1470184006
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I'll look into it. Is this problem happening with messages specified through the JSON, non-JSON messages, or both?
Stephen L. said: I'll look into it. Is this problem happening with messages specified through the JSON, non-JSON messages, or both? Thanks Stephen. It happens whenever I put any information in the GM NOTES using the special letters. No differance if I just put in plain text or specify it as a "{"message"}.&nbsp;It's a trap is the only script giving me this problem I might add so I'm sure it's not a problem within Roll20.
1470318751
Ada L.
Marketplace Creator
Sheet Author
API Scripter
I think I've got it fixed now. Until the merge request goes through, you can get the fixed code here:&nbsp;<a href="https://github.com/Cazra/roll20-api-scripts/blob/TrapUnicode/Its%20A%20Trap/2.5/ItsATrap.js" rel="nofollow">https://github.com/Cazra/roll20-api-scripts/blob/TrapUnicode/Its%20A%20Trap/2.5/ItsATrap.js</a>
It works! Thanks a lot Stephen! I really&nbsp;appreciate it. No more broken english in chat. :)
Hi, I'm new at this so I may be doing something wrong, but no matter what my traps always miss. I used the one-click api tool so i didn't mess with the code.&nbsp;
1470422121

Edited 1470422599
Ada L.
Marketplace Creator
Sheet Author
API Scripter
What theme are you using for it? Also, please provide the JSON you are using for your trap.
Ah, Got it!! I didn't properly link the character and the token. Thanks for the quick response though!
1470595118
Pat S.
Forum Champion
Sheet Author
I must be stupid but I can not get it to stop the token when it crosses the trap. It is a one click install with the cobweb and bleeding eye on the trap token. What command do I use and placed where to get it to stop the token when it is moved across with a mouse?
1470617676
Ada L.
Marketplace Creator
Sheet Author
API Scripter
You need to assign a character to the token.
1470621852
Pat S.
Forum Champion
Sheet Author
Are you indicating it has to be assigned to the trap token? I have a sheet assigned to the character token.
1470661342
Ada L.
Marketplace Creator
Sheet Author
API Scripter
No, just the character token. If you're still having trouble, post what theme you're using, the trap's GM notes, and any error log that might be popping up in your API console.
1470661971
Pat S.
Forum Champion
Sheet Author
I got some help from Ziechael for the trap script.&nbsp;It is a manual install with the default theme (system agnostic) so that I could change the Adminiral Ackbar to GM and Ziechael help me with the GM notes bit. I did not know you had to put in the commands inside { " " }. I did not see that bit of information anywhere in the various readme's. &nbsp;The only thing hanging up is getting it to state the player token's name. It does what I want it to do now except stating the token's name in the chat message.
1470662640
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ok, so it sounds like you now just need to make some changes to the message that gets put together in the default theme's activateTrap function. The effect object passed into that function has a victimId property you can use to get the character token. From there, just get the token's name and put it wherever it needs to go in the HTML message.
1470663352
Pat S.
Forum Champion
Sheet Author
I just noticed something when I did the one click install on another game. Is there supposed to be multiple duplicates of scripts loading? There was about four vector math, two matrixmath, and a couple path math.
1470665640
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Yes and no. The One Click API doesn't currently handle dependency trees well. This causes it to import duplicates of scripts it finds more than once in a dependency tree.&nbsp; The dependency tree for It's A Trap looks something like this: It'sATrap: [PathMath, TokenCollisions, VectorMath] PathMath: [MatrixMath, VectorMath] TokenCollisions: [MatrixMath, PathMath, VectorMath] MatrixMath: [] VectorMath: [] You can safely remove the duplicate scripts, but having the duplicates isn't going to break anything either.
1470668696
Pat S.
Forum Champion
Sheet Author
Thanks. I trimmed them down to the basic listing of the five required.
1471273007

Edited 1471638473
Ada L.
Marketplace Creator
Sheet Author
API Scripter
A Pathfinder trap theme is now available. The pull request is currently pending but you can get it from this branch:&nbsp; <a href="https://github.com/Cazra/roll20-api-scripts/tree/T" rel="nofollow">https://github.com/Cazra/roll20-api-scripts/tree/T</a>... The new theme is now in the One-Click API library. Its JSON structure is the same as the D&D 3.5 theme.
1471274104
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Very nice Stephen. Much cleaner than the one I hacked together for my game.
1472284194
Tetsuo
Forum Champion
Hi! I'm starting to pick up scripts a little more, and seem to be having some trouble with this one. I made a trap with the cobweb symbol and the bleeding eye symbol. I set the api to move to the objects layer, and in GM Notes, I put this: { "attack": 22, "damage": "4d10+15", "message": "A long, spiny, dolphin-like creature rises up from the water, and tried to eat you!", "notes": "If the character is hit, make a grapple check", } When the trap is encountered, it returns the error: ERROR: invalid TrapEffect JSON. and moves to the map layer instead of the objects layer. What am I doing wrong?
Map layer is the default now. You can choose to have it go to the gm layer in the script tab. Are you using the vanilla version by itself or do you have a theme with it. When I first started using the &nbsp;script I failed to set the user customization properly and had a lot of difficulty. That is where I would start.&nbsp;
1472331650
Tetsuo
Forum Champion
I used the one click install from the library. I deselected the "move to map layer" option, and I'm using the Pathfinder theme
I had failed to type in the theme when first using the program. If you have done that already than you are past my ability to help- sorry :)&nbsp;
1472394705

Edited 1472394771
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Franky: Your JSON is invalid because you have an extra comma after the notes line. Remove the comma there and it should be fine. If you're ever having trouble with invalid JSON, I would highly recommend checking your JSON with&nbsp; JSON Lint , a handy validator for JSON.
Well that link gets book marked. thanks Stephen
1472463244
Tetsuo
Forum Champion
Thanks a lot. Definitely book marking that as well! I'm new to coding and stuff, so simple things like that completely go over my head.
Hi guys, I'm trying to get my first 5ed game going and want to install the 5ed OGL trap theme. However my script-fu is non-existent and I'm having trouble installing it. The link takes me to a lot of differant script-parts and I have no idea where to start. Anyone able to give a push in the right direction? <a href="https://github.com/Roll20/roll20-api-scripts/tree/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree/</a>...
1473718428
Ada L.
Marketplace Creator
Sheet Author
API Scripter
For some reason, the 5E OGL theme wasn't added to the One-Click library. As long as you've got the It's A Trap! script installed from One-Click though, just get 1.1/TrapTheme.js file's contents and copy-paste it into a new script in your API sandbox. For the theme option of the It's A Trap script, enter in "5E-OGL".
Stephen L. said: For some reason, the 5E OGL theme wasn't added to the One-Click library. As long as you've got the It's A Trap! script installed from One-Click though, just get 1.1/TrapTheme.js file's contents and copy-paste it into a new script in your API sandbox. For the theme option of the It's A Trap script, enter in "5E-OGL". Thanks!