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

Interpolated Trap format chat output

I am currently using  [Script] Interpolated trap detection but i was wondering if there was a way to format the text that was sent to the chat window, trying to make it stand out - like a power card, but more an event card.  is there a way to do this? or even to use the powercards 3 script and create an event card?
It certainly is possible to trigger powercards from other scripts, thanks to Brian or TheAaron (I think... I can't actually remember who did it). The bulk of the powercard script is in its own function. As long as you have it installed, you can create powercards by sending a string to PowerCard.Process like this: var TrapMessage = "!power --tag|content"); PowerCard.Process(TrapMessage);
1438027792
The Aaron
Pro
API Scripter
I think I might have made use of it first, but the structure of your code is what made it possible. =D
The Aaron said: I think I might have made use of it first, but the structure of your code is what made it possible. =D Someone else suggested it... must have been Brian if not you.
really sorry - i have tried the above but get the following error when the trap is triggered: For reference, the error message generated was: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Cannot call method 'get' of undefined at Object.PowerCard.Process (evalmachine.<anonymous>:8832:52) at evalmachine.<anonymous>:10919:25 at eval (
Doh, that's my fault. I forgot about the player object needing to be sent to the powercards script too. Try this instead: PowerCard.Process(TrapMessage, getObj("player", msg.playerid));
i think its me as it is getting late but: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ ReferenceError: msg is not defined at evalmachine. :10919:62 at eval (
I'll have to look at the trap script to see what kind of information it is using. I'll also update powercards to fail gracefully when a player object isn't found.
1438033348
The Aaron
Pro
API Scripter
Yeah, there won't be a msg object when it triggers. The event is based on change:graphic. 
The Aaron said: Yeah, there won't be a msg object when it triggers. The event is based on change:graphic.  I probably needed to change that in powercards anyway and default to black and white or something if a player object isn't found.
glad it wasnt me - i do have a nack of missing the obvious lol
1438115218

Edited 1438509892
Jon M. said: glad it wasnt me - i do have a nack of missing the obvious lol I have an update for powercards I haven't posted yet (will post later tonight), that will let you do the following without errors: var TrapMsg.content = "!power --tag|content"; PowerCard.Process(TrapMsg);
Sorry for the delay, but ver 3.2.10 of PowerCards will now work without a player object being sent to PowerCard.Process. The snippet of code above with TrapMsg.content will now work properly without crashing the api. gist.github.com/Sky-Captain-13/452330a3d926b32da49c
I am so sorry..... ReferenceError: TrapMsg is not defined at evalmachine. :10924:15 at eval (
Jon M. said: I am so sorry..... ReferenceError: TrapMsg is not defined at evalmachine.:10924:15 at eval ( You have to define what TrapMsg is. What do you want the powercard to say when the player trips the trap?
Also, if you want... invite me to your campaign and make me a GM once I've joined. It'll be far easier for me to create an example for you that way.
sorry - i did that - and that when it gave the error: TrapMsg.content = ("!power {{--emote|Its a Trap. --format|atwill --name|Melee Attack --leftsub|Action --rightsub|Reach 5 ft. --Attack|1d20 vs AC --Hit|2d6 slashing damage }}") PowerCard.Process(TrapMsg);
1438511278

Edited 1438511313
Try this instead: var TrapMsg.content = "!power --emote|It's a Trap! --format|atwill --name|Melee Attack --leftsub|Action --rightsub|Reach 5 ft. --Attack|[[1d20]] vs AC --Hit|[[2d6]] slashing damage"; PowerCard.Process(TrapMsg);
Unexpected token = will send you an invite
You might want to delete that post or you'll have people randomly joining your campaign.
HoneyBadger said: You might want to delete that post or you'll have people randomly joining your campaign. and done so - was being lazy in the invite ;)
"var TrapMessage.content = ...;" shouldn't work (and should give you an error like the "unexpected token: =" error you got).  To accomplish that, you'll need to either do var TrapMessage = {'content': ...}; or var TrapMessage = {}; TrapMessage.content = ...;
manveti said: "var TrapMessage.content = ...;" shouldn't work (and should give you an error like the "unexpected token: =" error you got).  To accomplish that, you'll need to either do var TrapMessage = {'content': ...}; or var TrapMessage = {}; TrapMessage.content = ...; Yeah, I figured that out eventually. :D Felt dumb when I did. Got things working for Jon now and have motivation and an idea on re-writing ItsATrap into something more flexible. :)
I am so grateful for the help, and it works a charm.  thank you so much