Calculator

Category: Math functions & Calculations
Author:
Description: A fun (not so) little built-in calculator for DM. This contains many of the usual functions. The script is well annotated, so hopefully you get an idea of how dialogs work. You can customise the calculator either through adding new buttons, or modifying existing ones. Two of the buttons (e-) : charge on electron and (c) : velocity of light (note the latter is lowercase) - are designed to be customised; just modify the custom variables which appear at the start of this script.You also need to modify the response function - which is invoked when you press the key in question. These two functions are called presscustom1 and presscustom2. In the simplest form you simply modify the function to return a new constant. Alternatively, you can set it up to do a more complex calculation - see the other response functions for hints at how to do this. This was a fun little project, which grew and grew. I could have added lots more functions, but I'm over it now. Feel free to! add/change it and repost it here if you wish. I haven't tested it exhaustively, so please check it for accuracy. If you have complex calculations to perform, be aware that it is not aware of BODMAS (the order in which operators take precedence) and has no parentheses. Also do not type directly into the data line - it doesn't work. Generate negative exponents and powers by pressing the "-" key after pressing the 'exp' or 'x^y' keys. Any bugs - please advise.
Script version: 1.2
DM/GMS version: 3.8.2
Script written as a function: No
Source: Show code
Download Source Code: Download
Download Zip File: Download