
Ok - so I'm wanting to inline roll a table in API. I can "/roll 1t[whatever]" but that gives wonky output in the chat window. To further complicate things, I'd like to include the inline roll result in fancy formatted box: Ultimate goal is a really basic weather script that has VERY generic temp generation and a daily weather forecast (implementing fancy icons for the weather result is also on my list). So far I've got temperatures for 4 seasons of a more-or-less temperate climate. Might think about adding the ability to differentiate on climate later. Here's the code: on('chat:message', function (msg) {
var range, min;
if (msg.type == 'api' && msg.content.indexOf('!summer') !== -1) {
range = 55;
min = 60
var x = Math.floor(Math.random() * range) + min;
sendChat(
'',
"/direct "
+"<div style='"
+'background-color: #4B0082;'
+'border: 3px solid #808080;'
+'font-size: 20px;'
+'text-align:center;'
+'vertical-align: top;'
+'color: white;'
+'font-weight:bold;'
+'padding: 5px 5px;'
+"'>"
+"The current temperature is: "+x+" degrees"
+"</div>"
);
}
if (msg.type == 'api' && msg.content.indexOf('!winter') !== -1) {
range = 55;
min = -20
var x = Math.floor(Math.random() * range) + min;
sendChat(
'',
"/direct "
+"<div style='"
+'background-color: #4B0082;'
+'border: 3px solid #808080;'
+'font-size: 20px;'
+'text-align:center;'
+'vertical-align: top;'
+'color: white;'
+'font-weight:bold;'
+'padding: 5px 5px;'
+"'>"
+"The current temperature is: "+x+" degrees"
+"</div>"
);
}
if (msg.type == 'api' && msg.content.indexOf('!fall') !== -1) {
range = 40;
min = 30
var x = Math.floor(Math.random() * range) + min;
sendChat(
'',
"/direct "
+"<div style='"
+'background-color: #4B0082;'
+'border: 3px solid #808080;'
+'font-size: 20px;'
+'text-align:center;'
+'vertical-align: top;'
+'color: white;'
+'font-weight:bold;'
+'padding: 5px 5px;'
+"'>"
+"The current temperature is: "+x+" degrees"
+"</div>"
);
}
if (msg.type == 'api' && msg.content.indexOf('!spring') !== -1) {
range = 40;
min = 30
var x = Math.floor(Math.random() * range) + min;
sendChat(
'',
"/direct "
+"<div style='"
+'background-color: #4B0082;'
+'border: 3px solid #808080;'
+'font-size: 20px;'
+'text-align:center;'
+'vertical-align: top;'
+'color: white;'
+'font-weight:bold;'
+'padding: 5px 5px;'
+"'>"
+"The current temperature is: "+x+" degrees"
+"</div>"
);
}
}
);