Main Menu

Simple Counter

Started by RaiuTheEevee, Jul 27, 2022, 11:19 PM

Previous topic - Next topic

RaiuTheEevee

As the title states, this is a simple counter program that lets you add as many counters as you want. This program requires an advanced computer and will work best on a normal advanced computer rather than a pocket computer or turtle. As an example in the image below, I'm using my counters to help me track shiny hunting in a Pokémon Crystal romhack.


Pastebin: https://pastebin.com/r40996h9

If you'd like, here's a tutorial for how to use this.

Starting the Program
  • The last line under your counters will always contain the Add and Exit buttons.
  • The Add button will have you inputting the name of your counter, which you can leave blank if you wish.
  • The Exit button of course exits the program.
Controlling the Counters (Mouse Input)
  • Each counter will be contained in a single line.
  • The "x" button will delete the counter.
  • The "R" button will allow you to rename the counter.
  • The "↑↓" buttons will move the counter up and down in the list. They're grayed out if it's at the top or bottom of the list.
  • The "L" button will lock the counter, preventing it from being accidentally deleted or changed. The lock does not affect the "↑↓" buttons. All locked buttons will be disabled and grayed out.
  • "-+" are the increment buttons. Pressing these by default will add or subtract 1 to or from the count number directly next to these buttons.
Precise Controls and Keybinds
  • If you click on the number itself, you can select a specific digit to increment. Increments for any digit are always 1, or rather 10digit-1. You will see the cursor blink on the digit being incremented.
  • You can also use the number keys to insert digits wherever the cursor is, as well as Backspace or Delete to delete digits at the cursor.
  • If you click the space at the end of the number you want to change, you can input or delete digits at the very end of the selected value.
  • The left and right arrow keys will move the cursor one digit at a time.
  • The Home and End keys may be used to move the cursor to the start and end of each number.
  • The up and down arrow keys will move the cursor between unlocked counters.
Setting the Max Value
  • The "M" button will enable the max number. Enabling this will not stop your counter from going above or below the set maximum, but it will display a percentage representing the counter's "completion" before the counter's name.
  • The "-+" next to the max number will increment the max number if max is enabled.
  • You may click on the max number and manipulate it with keybinds in the same way as the count number if it's enabled.
Additional Functions
  • Pressing Home twice will move the cursor from the start of max to the start of count.
  • Pressing End twice will move the cursor from the end of count to the end of max if max is enabled.
  • Pressing left when the cursor is at the start of the max number will move it to the end of the count number.
  • Pressing right when the cursor is at the end of the count number will move it to the start of the max number if max is enabled.
  • If you have more counters than can fit in your current screen, you may use the mouse wheel to scroll through the counters. The "Add" and "Exit" buttons will still be at the bottom of the list.
  • Counter data will be saved to a txt file in the root directory of your computer, so you can easily edit the file if you need to or want to for whatever reason.

This is my first time posting to these forums, but I've been practicing ComputerCraft Lua for over 7 years. I hope you enjoy my first post. ^-^

Edit: 2022/11/08 - Fixed a bug not displaying the counters correctly when scrolling.