From 817b21d1e7cb94bb0311d26a37bfe743f1d712de Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Wed, 17 May 2023 06:05:08 -0500 Subject: [PATCH] Writes a string with a space instead of nothing when there's nothing to display to show update in OBS overlay --- amt | 1 + goalamt.txt | 1 + inventory_monitor.js | 14 +++++++------- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/amt b/amt index e69de29..af612bf 100644 --- a/amt +++ b/amt @@ -0,0 +1 @@ +undefined: 0/149 (0%) \ No newline at end of file diff --git a/goalamt.txt b/goalamt.txt index e69de29..d7019ae 100644 --- a/goalamt.txt +++ b/goalamt.txt @@ -0,0 +1 @@ +149 \ No newline at end of file diff --git a/inventory_monitor.js b/inventory_monitor.js index 37667f1..792c91b 100644 --- a/inventory_monitor.js +++ b/inventory_monitor.js @@ -97,7 +97,7 @@ function update(){ if (i==386){ //Target Item Slot Amt. (4294967295 means invalid amt) //387 should be item ID. - if (fileContents[387]!=0){ + if (fileContents[387].split(" ")[0]!=0){ var tempLine=fileContents[387].split(" ")[0] var tempLineAmt=fileContents[386].split(" ")[0] var itemObj={id:Number(tempLine)} @@ -110,15 +110,15 @@ function update(){ lastDisplayString=tempString } } else { - if (lastDisplayString!=""){ - fs.writeFile("amt","",()=>{}) - lastDisplayString="" + if (lastDisplayString!=" "){ + fs.writeFile("amt"," ",()=>{}) + lastDisplayString=" " } } } else { - if (lastDisplayString!=""){ - fs.writeFile("amt","",()=>{}) - lastDisplayString="" + if (lastDisplayString!=" "){ + fs.writeFile("amt"," ",()=>{}) + lastDisplayString=" " } } }