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

[Help] sending [[ and ]] to chat with /direct

1402088152

Edited 1402088550
DXWarlock
Sheet Author
API Scripter
aaaand Im back with more inane questions :) Im trying to make an !api command to send a message to chat to help players with making macros our script uses. Problem is I cannot send [[something]] with API to chat even with direct, it errors seeing it as a dice command. if(msg.type == "api" && msgTxt.indexOf("!help") !== -1) { var ex = "!attack --[[1d20-3]] --[[1d4*10]] --DIE! --Rifle 3"; var ex1 = "<br>!attack --[[attackroll]] --[[damage]] --saying --Ammo #"; var help = fPart + "background-color:"+grayC+";'>"+ex+" "+ex1+"</div>"; sendChat('', "/direct " + help); }; }); I'm trying to send this as text to chat, but cannot get it to take it. Ive tried escaping all the brackets with \ that didnt help..anyone know if its possible? or will it always see it as a roll attempt?
1402088689

Edited 1402088727
Lithl
Pro
Sheet Author
API Scripter
Hrm... Maybe try [ (for "[") and ] (for "]")?
1402089709

Edited 1402090389
DXWarlock
Sheet Author
API Scripter
I tried that for the codes, it saves right until I leave and reopen the script page..when I go back to "api scripts" and look at the script it turns them back into [ again in the code itself. :\
1402091654

Edited 1402091713
Lithl
Pro
Sheet Author
API Scripter
Hmm... How about this one: var ampersand = String.fromCharCode(38); var lbracket = ampersand + '#x5B'; var rbracket = ampersand + '#x5D'; // output lbracket+lbracket+'attackroll'+rbracket+rbracket
1402092212
DXWarlock
Sheet Author
API Scripter
hmm Ill give that a try. this is becoming overly complicated to send one character to chat :)