From 9ddab3695e757e4c481a29d6d0d958e6273af2eb Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Thu, 6 Feb 2020 00:49:58 +0000 Subject: 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 --- examples/jarvis.js | 7 +++++-- 1 file 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); -- cgit