Frequency calculator

  • MachineMan
    18th Feb 2023 Member 0 Permalink

    I have an idea for a script that's sure to benefit us all.  Here it is:

     

    Frequency calculator

     

    It's a calculator that performs bitwise operations on numbers available in FILT frequency (or wavelength).  The number must be in decimal and the result of any equation will always be in decimal unless that result is an operator and not a number (more information below).  To turn on the calculator, press CTRL+K; this also pauses the simulation.  Available operator modes are:

     

    AND

    OR

    SUB

    XOR

    NOT

    *<< (variable red shift)

    *>> (variable blue shift)

     

    There are 4 boxes in which to type; IN1 (input 1), OPT (operator), IN2(input 2), and OUT(output).  You can, of course, solve an equation classically; setting IN1, OPT, and IN2 to find the OUT number.  You can also set one of the inputs, OPT, and OUT to find out what the number of the other input needs to be to get the OUT number.  You can even set IN1, IN2, and OUT to find out what the operator needs to be in order to get the the OUT number from IN1 and IN2 numbers.  Any negative number will count as the decimal number equal to every FILT bit turned on.  If an equation is invalid, i.e. if a number in any number box is too high or if a number box contains non-numeric characters, the calculator returns the message "INVALID ALGORITHM".  OPT can't be typed in, instead it will return a list of all the available operator modes when clicked; click an operator mode to set OPT.  After an equation is completed, a YES or NO prompt at the bottom of the calculator asking if you want to draw the equation will become clickable.  If NO is clicked, then the calculator will turn off and the simulation will unpause.  If YES is clicked, than then a box will appear at the bottom of the calculator where you can set the element in which the equation will be drawn; by default it's DMND, but you can change it.  With the desired element selected, click OK or press the enter key to turn off the calculator.  A stamp of the drawn equation will appear; click where you want to place it then it will be drawn and the simulation will unpause.

     

    Uses:

    It'll make the contruction of computer parts easier, especially for noobs.  By using a script that makes complex bitwise calculations for you, anyone can make a computer in tpt.

     

    Note:

    I've no idea how to make a script, but I think this script would be useful; I humbly ask for credit for the idea to anyone who makes this script.  The Lua scripting category was the best category of which I could think to place this thread; I apologize if it belongs in another category.

    Edited once by MachineMan. Last: 9th Apr 2023