Skip to content

Commit 2393bb1

Browse files
authored
Update FFG-SWRPG-DestinyTracker.js
few minor tweaks
1 parent 1ed0b26 commit 2393bb1

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

FFG-SWRPG-DestinyTracker/0.1.0/FFG-SWRPG-DestinyTracker.js

+23-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
The inspiration for this (and base code!) came from: https://gist.github.com/dyent/6b25dbf9d52843b5bb83
33
Many, many, many thanks to The Aaron for his ever patient help with making some updates and quality of life changes to the code.
44
Also more kudos to The Aaron for enabling the handout tracking aspect
5+
6+
Optimum use requires a character to have an ability called 'destiny' with the contents of: !eed characterID(@{character_id}) label(skill:Destiny) 1w (gmdice)
57
**/
68

79
// Provides a way to track and manage light and dark side destiny points.
@@ -12,10 +14,25 @@ Also more kudos to The Aaron for enabling the handout tracking aspect
1214
// !destiny addlight [optional value] (adds light side points or 1 by default)
1315
// !destiny usedark [optional value] (spends dark side points and adds them to light side, 1 by default)
1416
// !destiny uselight [optional value] (spends light side points and adds them to dark side, 1 by default)
15-
1617
on("ready",function(){
17-
var version = '0.1.0',
18-
const schemaVersion = 0.1,
18+
var version = '0.1.0';
19+
const schemaVersion = 0.1;
20+
const esRE = function (s) {
21+
var escapeForRegexp = /(\\|\/|\[|\]|\(|\)|\{|\}|\?|\+|\*|\||\.|\^|\$)/g;
22+
return s.replace(escapeForRegexp,"\\$1");
23+
},
24+
25+
HE = (function(){
26+
var entities={
27+
//' ' : '&'+'nbsp'+';',
28+
')' : '&'+'#41'+';',
29+
'@' : '&'+'#64'+';'
30+
},
31+
re=new RegExp('('+_.map(_.keys(entities),esRE).join('|')+')','g');
32+
return function(s){
33+
return s.replace(re, function(c){ return entities[c] || c; });
34+
};
35+
}());
1936
writeHandout = function(handout){
2037
handout.set({
2138
notes: `<div style="width:70px;height:175px;align-text:center;font-size:40px;">`+
@@ -182,8 +199,8 @@ on("ready",function(){
182199
+ '<div style="padding-bottom:5px">'
183200
+ '<span style="font-size:130%;border-bottom:1px; color: black; font-weight:bold">May the Force be with you!</span>'
184201
+ '</div><div style="padding-left:10px; text-align: center; padding-right:10px; padding-bottom:5px">'
185-
+ "Select your token and:"
186-
+ "[Roll Destiny](!eed characterID(@{selected|character_id}) label(skill:Destiny) 1w (gmdice))"
202+
+ "Select your token and: "
203+
+ '[Roll Destiny](~selected|destiny)'
187204
+ '</div>'
188205
);
189206
sendChat("Master Yoda",'<div style="border: 1px solid black; text-align: center; color: black; background-color: #58C3EF; padding: 3px 3px">'
@@ -197,4 +214,4 @@ on("ready",function(){
197214
}
198215
});
199216

200-
});
217+
});

0 commit comments

Comments
 (0)