aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-02-06 00:49:58 +0000
committerHolden Rohrer <hr@hrhr.dev>2020-02-05 19:53:58 -0500
commit9ddab3695e757e4c481a29d6d0d958e6273af2eb (patch)
treeac93dce0cb013d6433afda506ddcc0c2c3e4cbff
parente618b9737fe1b4eebbfeec2eaabd5bb923179c83 (diff)
made notif actually a global variable for jarvis
notifRefresh is more compliant with clean-code standards, and I've moved the notif so as not to interfere with another bot
-rw-r--r--examples/jarvis.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/jarvis.js b/examples/jarvis.js
index 0b4a9d2..cb74da2 100644
--- a/examples/jarvis.js
+++ b/examples/jarvis.js
@@ -69,13 +69,14 @@ const notifsrc = '\
& Called: JARVISx ~SIGNATURE \n\
& If you have any good bullet art (<100 chars),\n\
& please send it to me at hr@hrhr.dev.'.replace('COMMAND', command).replace('SIGNATURE', sig);
+const notifloc = [0, 20];
var minsUp = 0;
var callct = 0;
var notifClaim;
function genNotif(){
let newnotif = new Space();
- newnotif.loc = [-6, 20];
+ newnotif.loc = notifloc;
text = notifsrc;
text = text.replace('UPTIME', Math.floor(minsUp/60) + 'h' + minsUp%60 + 'm');
text = text.replace('JARVIS', callct);
@@ -83,10 +84,12 @@ function genNotif(){
return newnotif
}
+var notif = new Space();
+notif.loc = notifloc;
function notifRefresh(){
let newnotif = genNotif();
let diff = newnotif.copy();
- if (typeof notif !== 'undefined') diff.comb(notif, comb.sub);
+ diff.comb(notif, comb.sub);
notif = newnotif;
if (notifClaim) main.unclaim(notifClaim);
notifClaim = main.claim(newnotif, protectArea);