Results 1 to 8 of 8
  1. #1
    Caesar1928's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    45
    Reputation
    10
    Thanks
    14

    [Fab] Simple calculator command

    Alright this is nothing fantastic but I made it quickly cause I was extremely bored XD
    Code:
        internal class CalculateCommand : Command
        {
            public CalculateCommand()
                : base("calculate", 0)
            {
            }
    
            protected override bool Process(Player player, RealmTime time, string[] args)
            {
                int first = int.Parse(args[0]);
                var symbol = string.Join(" ", args[1]);
                int second = int.Parse(args[2]);
                int answer = 0;
                if (symbol == "+")
                {
                    answer = first + second;
                }
                if (symbol == "*")
                {
                    answer = first * second;
                }
                if (symbol == "-")
                {
                    answer = first - second;
                }
                if (symbol == "/")
                {
                    answer = first / second;
                }
                player.SendInfo(answer.ToString());
                return true;
            }
        }

  2. #2
    BlackRayquaza's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Posts
    574
    Reputation
    10
    Thanks
    186
    My Mood
    In Love
    What about powers? xD
    /useless
    YEP cock

  3. #3
    Caesar1928's Avatar
    Join Date
    Oct 2015
    Gender
    male
    Posts
    45
    Reputation
    10
    Thanks
    14
    Quote Originally Posted by BlackRayquaza View Post
    What about powers? xD
    /useless
    /suckmybutt

  4. #4
    lkdjnfoskjednfblksjdfn's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Location
    127.0.0.1
    Posts
    1,340
    Reputation
    198
    Thanks
    841
    My Mood
    Inspired
    Quote Originally Posted by Caesar1928 View Post
    Alright this is nothing fantastic but I made it quickly cause I was extremely bored XD
    Code:
        internal class CalculateCommand : Command
        {
            public CalculateCommand()
                : base("calculate", 0)
            {
            }
    
            protected override bool Process(Player player, RealmTime time, string[] args)
            {
                int first = int.Parse(args[0]);
                var symbol = string.Join(" ", args[1]);
                int second = int.Parse(args[2]);
                int answer = 0;
                if (symbol == "+")
                {
                    answer = first + second;
                }
                if (symbol == "*")
                {
                    answer = first * second;
                }
                if (symbol == "-")
                {
                    answer = first - second;
                }
                if (symbol == "/")
                {
                    answer = first / second;
                }
                player.SendInfo(answer.ToString());
                return true;
            }
        }
    Why not make something usefull instead then? The past commands you've made could be very usefull if they were gathered in one. My idea would be making a new version of a lottery machine like the old one from Doomed Realms Good job
    Last edited by lkdjnfoskjednfblksjdfn; 11-09-2015 at 04:22 AM.

  5. #5
    Stellar Spark's Avatar
    Join Date
    Jun 2013
    Gender
    female
    Posts
    724
    Reputation
    35
    Thanks
    799
    Quote Originally Posted by thenired View Post
    It seems like you know how to code
    before this turns into another big flame thread

    i'd like to point out that there are different levels of understanding

    for just about everything

  6. #6
    lkdjnfoskjednfblksjdfn's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Location
    127.0.0.1
    Posts
    1,340
    Reputation
    198
    Thanks
    841
    My Mood
    Inspired
    Quote Originally Posted by Roxy Lalonde View Post


    before this turns into another big flame thread

    i'd like to point out that there are different levels of understanding

    for just about everything
    Oh yhea, I see :/ I'm being such a problem generator atm. But atleast it keeps the community going.

  7. #7
    Stellar Spark's Avatar
    Join Date
    Jun 2013
    Gender
    female
    Posts
    724
    Reputation
    35
    Thanks
    799
    Quote Originally Posted by thenired View Post
    Oh yhea, I see :/ I'm being such a problem generator atm. But atleast it keeps the community going.
    there will always be times when your interests don't coincide with those of the community :P

    provided that you've got your friends and your knowledge ehh you should be fine

  8. The Following 2 Users Say Thank You to Stellar Spark For This Useful Post:

    BlackRayquaza (11-09-2015),lkdjnfoskjednfblksjdfn (11-09-2015)

  9. #8
    lkdjnfoskjednfblksjdfn's Avatar
    Join Date
    Apr 2014
    Gender
    male
    Location
    127.0.0.1
    Posts
    1,340
    Reputation
    198
    Thanks
    841
    My Mood
    Inspired
    Quote Originally Posted by Roxy Lalonde View Post


    there will always be times when your interests don't coincide with those of the community :P

    provided that you've got your friends and your knowledge ehh you should be fine
    Thanks ;D /99k chars

Similar Threads

  1. [Fab] Simple /kickall command
    By Caesar1928 in forum Realm of the Mad God Private Servers Tutorials/Source Code
    Replies: 8
    Last Post: 11-07-2015, 02:11 PM
  2. [Release] Simple Calculator Made by Me
    By Hitokiri~ in forum C# Programming
    Replies: 13
    Last Post: 02-07-2013, 10:10 PM
  3. Help with this simple calculator code
    By hislao in forum C++/C Programming
    Replies: 1
    Last Post: 07-27-2012, 05:34 AM
  4. [Solved] Fixing Simple Calculator
    By LEGiiTxCHAOTiiC in forum C++/C Programming
    Replies: 3
    Last Post: 02-01-2012, 08:38 PM
  5. Simple Calculator W/O Classes
    By Dev_Pump in forum C# Programming
    Replies: 11
    Last Post: 06-11-2010, 09:13 PM