Inactive [GEN/CHAT]SimpleCalc v2.4 - Simple but powerful calculator for Console and Chat[SPN1265/CB1.3.1-R2]

Discussion in 'Inactive/Unsupported Plugins' started by Lathanael, Aug 26, 2011.

  1. Offline

    Lathanael

    SimpleCalc

    - inspired by uCalc (Thx Sosser for giving me an idea on what to start making plugins for Bukkit) -
    BukkitDev

    SimpleCalc is a chat/console based calculator. It can calculate any mathematical expression containing decimals and the following operators:
    1. Addition: +
    2. Subtraction: -
    3. Multiplication: *
    4. Division: /
    5. Powers: ^
    6. Remainder: %
    7. Parentheses: ( and )
    8. ANS variable
    9. Functions: sqrt, sin, cos, ln, log, spawnX/Y/Z, locX/Y/Z
    10. Math constants: e, pi

    Here are some examples of propper expressions:
    * 5.6+3.3 or 5,6+3,3
    * 3*4+5
    * (3+4)*3/8
    * (7+2^4)/3
    * -5*3
    * (-7+3*(12%5))/32
    * *After executing one calculation: ANS()+3

    To use pi and the loc and spawn functions, append <font color="#ff0000">()</font>to them!

    You can separate the numbers/operators with spaces or not, both will be accepted and, if the expression is valid, will be calculated. The parantheses in ANS() are needed to work!


    If you have Spout installed and use the Spoutcraft client you can now open a Calculator Window by using "/calc" without any arguments!

    [​IMG]

    Command(s):
    DEV Version:

    Download & Source:
    SimpleCalc is released under GNU GPLv3 for more information, refer here.

    CB 1.1-R6 and Newer:
    <Edit by Moderator: Redacted bit url>
    Mirror v2.4 (BukkitDev)



    Download v2.3 (BukkitDev)

    CB 1.1-R3/CB 1.1-R4:
    Download v2.2 (BukkitDev)

    CB#1185 & CB#1240:
    Download v2.1
    Mirror v2.1 (BukkitDev)

    Download v2.0
    Mirror v2.0 (BukkitDev)

    CB#1060:
    Download v1.0
    Mirror v1.0 (BukkitDev)

    Source:
    Source on GitHub


    TO-DO:

    Changelog:
    * v2.4

    - * Fixed Listener throwing errors when spout was not installed
    * Fixed loading errors if spout was not installed
    * Added two new functions: distance2D() and distance3D(). It calculates the distance between the player and the spawn location either in the xz-plane(2D) and in xyz(3D)
    * Added possibility to use the keyboard while the GUI is open to enter an expression, but currently no capital letters are possible if the text field is not selected.
    * Added a Key-Binding when Spout is installed to open the GUI without the need to enter the command /calc. Default is C but it can be changed by the user!

    * v2.3

    - * Added variables: You can now set variables with /calc set <variable> <value>. A variable is any letter except small e. Like: a,B,Z,O and g
    * Added more functions like: sin, cos, sqrt, ln....
    * Added SpawnX(), SpawnY(), SpawnZ() and LocX(), LocY(), LocZ() to get the locations of the spawn from your current world and your current location. This does only work when used ingame from a player!
    * Added "Sience" window to the gui to use the new functions.

    * v2.2

    - * Updated to new EventSystem

    * Added ANS function.

    * Rearranged CalcWindow
    - v2.1:
    * Change in namespace
    * Made the error messages a bit more specific.
    - v2.0:
    * BUGFIX: Commas threw an error instead of beeing accepted
    * FEATURE: Spout support. You can now use /calc to open a Calculator Window
    * Update to CB #1185

    * v1.0:

    - * Initial release


    Show Spoiler
    Version 0.1 to 0.9 are merely a list of my development progression:
    * v0.1:

    - * Initial start of coding the plugin
    - v0.2:
    * Added all math functions i thought would be nice to have
    - v0.3:
    * Added RegEx functions for normal 2 arguments calculation (this means we do have a working 2 values calculator \o/)
    - v0.4:
    * Started working on a parser to make complex calculations possible
    - v0.5:
    * Removed original RegEx functions
    * Created logic for the parser
    - v0.6:
    * Created logic to compute the given equation
    - v0.7:
    * Created my own Exception class to pass through parser errors
    - v0.8 and v0.9:
    * Several bug fixes and corrections
     
    Last edited by a moderator: Feb 21, 2017
    r3Fuze likes this.
  2. Offline

    caloletti

    WORKING :D I've been looking for this! Thx
     
  3. Offline

    Lathanael

    NP. If you have any idea of what to add further give me a shout.
    I can add functions, like sin(x) etc. but i did not find any need for it.
     
  4. Offline

    MonsieurApple

    Approved, but please look to the future: BukkitDev.
     
    Lathanael likes this.
  5. Offline

    Lathanael

    It is already on DevBukkit but i'll make the Link more visible :)
     
  6. Offline

    Lathanael

    I am happy to announce SimpleCalc version 2.0!

    Now with Spout support!

    For more see BukkitDev or OP

    PS: Sorry for DoublePost
     
  7. Offline

    Lathanael

    New update: version 2.1!

    I know this is the 3rd Post in a row, but i can't change the fact that no one comments!
    There are over 100 Downloads for the v1.0 and v2.0, yet nobody did comment :(

    If you think SimpleCalc is missing something just leave a comment, either here or on BikkitDev!
    Or just comment if you like it (It makes me feel better and continue to work on this!)
    Also check my other Plugins i work on (shameless commercial :D)
     
  8. Offline

    MaggieThaDud

    Thanks, this made me very happy :D
     
  9. Offline

    Canio22

    Does this have permission support or can everybody use it as standard?

    Nice plugin btw! I love it, been looking for something like this for ages!
     
  10. Offline

    Lathanael

    Currently there is no permission used, as i did not see the need for it. But if you think it is needed i can add it :)
     
  11. Offline

    Canio22

    Nope i was just wonderin, cba having to re configure my permissions now lol.

    This plugin is very stable and is actually helping some of my other plugins last longer!

    A.K.A this plugin helps reduce lag as it increases the time until some plugins become unstable such as no-cheat and the auto-message i use!
     
  12. Offline

    Lathanael

    Releasing version 2.2!! have fun
     
  13. Offline

    SuperPyroManiac

    Its nice, but i'd rather just use the windows calculator, and save server ram.
     
  14. Offline

    Lathanael

    No one forces you to use it. But the amount of ram/resources used by this plugin arre minimal!
     
  15. Offline

    Lathanael

    I am hereby announcing the release of a new DEV version. I hope i have fixed most things but let me know if you encounter anything!

    For more infos look into the OP!
     
  16. Offline

    Lathanael

    Yet another post -.-:

    Released version 2.3 ;) Have fun!
     
  17. Offline

    Doc

    Bukkit-1.2.3-R0.2-b2060
    SimpleCalc v2.3
    Code:
    14:22:17 [SEVERE] Could not pass event PlayerQuitEvent to SimpleCalc
    org.bukkit.event.EventException
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:303)
            at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
            at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:441)
            at net.minecraft.server.ServerConfigurationManager.disconnect(ServerConfigurationManager.java:181)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:784)
            at lishid.orebfuscator.hook.NetServerHandlerProxy.a(NetServerHandlerProxy.java:101)
            at net.minecraft.server.NetworkManager.b(NetworkManager.java:234)
            at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:116)
            at lishid.orebfuscator.hook.NetServerHandlerProxy.a(NetServerHandlerProxy.java:60)
            at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
            at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:554)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:490)
    Caused by: java.lang.NoClassDefFoundError: org/getspout/spoutapi/player/SpoutPlayer
            at de.Lathanael.SimpleCalc.Listeners.SCPlayerListener.onPlayerQuit(SCPlayerListener.java:46)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301)
            ... 12 more
    Just thought I would give you a heads up!

    Thanks for a great plugin!
    -Doc
     
  18. Offline

    Lathanael

    OUPS!

    Do you have the spout plugin installed?

    Will have to fix this, the listener should not be registered if someone does not have spout!
     
  19. Offline

    Doc

    I had to remove spout due to the fact that it was de-registering w/ an incompatibility error.
     
  20. Offline

    Lathanael

    Ok thx. Have updated the DEV SNAPSHOT. That error should be gone :)
     
  21. Offline

    peng_bears

    finally got around to trying the more complex stuff i wanted and it did not seem to like it, but let me know if it is wrong syntax or something.

    first i went all the way and tried this - should return the distance from spawn - wanted to test then save as a variable
    /calc sqrt((locx()-spawnx())^2+(locz()-spawnz())^2) ... could not parse your input as a number

    then i went back and tried something more simple first
    /calc sqrt(locx()-spawnx()) ... the result of your expression is:
    no i did not forget to put the result it just never displayed one

    sqrt, loc and spawn all work alone but do not seem to like to play well together


    If i did something wrong or if it may be fixed in a dev build let me know and i would be more than happy to try your plugin again
     
  22. Offline

    Lathanael


    I'll have a closer look into it! It seems like somewhere on the way the parser thinks that it isn't a expression. Your input looks correct to me, so i guess i have a typo in the code ;)
     
  23. Offline

    peng_bears

    Suggestion

    with the spout interface you are greatly limited on number of characters, is there any way to make the text smaller and maybe 2 lines, or have it wrap... something for the future as you can always use /calc [expression]
     
  24. Offline

    Lathanael

    The tex thing is a bit tricky as the current GUI widgets from spout are not really well implemented and sometimes even bugged!

    About your advanced math:
    Are you 100% sure you did not put in a syntax error? Cause if i test it here locally ALL runs fine and i get a result :/ (Using a 2.4 SNAPSHOT)
     
  25. Offline

    peng_bears

    oops, must have grabbed 2.3 or something by mistake, works now. :oops:

    However I still cannot set is as a variable.. the cannot parse your input as a number. Does this mean no other variables including positions can be used in setting of variables?

    Maybe allowing in config to set some variables like distance so "/calc distance" could be set to an expression like this. Or even just allowing for global variables so "/calc d" could always be the same thing for all. I know there are other ways to do this with another plugin creating an alias but would be kind of nice to keep all the math stuff in one place.
     
  26. Offline

    Lathanael

    The current system only allows numbers to be set to variables, sorry.

    The next bigger step on my ToDo list is to implement some way of letting you use the keys of your keyboard if spout is installed and write the expression you have entered into the field.
    What i can implement fast would be a distance2D() and distance3D() function which will evaluate the same expression internally.
    The more complex storing of variables will take me some time, as i need to rewrite the system or add another one to handle such things.
     
  27. Offline

    peng_bears

    the distance variable would defiantly be nice and would take the place of that one last thing i was looking for before implement. While the other stuff would be nice this was the last real thing i was waiting on.
     
  28. Offline

    Lathanael

    Ok, will add it tomorrow as a distance2D() which calcutes only in the xz-plane and a distance3D() which is (who would have thought) in the xyz-plane(s) :D

    peng_bears

    New dev version available with the distance function integrated :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
    peng_bears likes this.
  29. Offline

    Lathanael

    Released version 2.4!! Have fun.
     
  30. Offline

    IsaiahRobichaud

    My understanding is when spout is installed it adds things but it is not required for players
    To use client unless they want the special features?
     

Share This Page