I am trying to make something perhaps kind of odd for Construct - an inventory system, but not for a game, as in real life barcode scanning inventory haha.
I have written a nice code for this in Excel and it works well, but I want to see if I can do something similar in Construct so I can have a better look than Excel (more visual customization).
So far I have a text box tied to an array that then automatically exports to a CSV.
What I am looking to do is have another text box next to the barcode textbox and have it keep count of how many lines have been scanned in (to give a total item count).
I have ideas using variables and comparing the array height, but cannot seem to wrap my head around it.
Develop games in your browser. Powerful, performant & highly capable.
The Array in Construct can use Push. You can start with a 0 size array and every time you scan you can Push a new instance into the array. To delete an instance you just use delete. These will both edit your Array Width (size).
To capture the current size simply create a text object. And every (whatever timing you decide) setText to Array.Width.
Changing your array size means whatever you had in index 15 at one time may be else where at a later time. So you would need to add additional width/depth to the array to add an ID.
You are awesome!
I had no idea about pushing, works perfect. I ended up just pushing every time the "enter" key is pressed, because barcode scanners automatically hit enter after each scan.
Thank you so much! :D