Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // How to set ints:
- // Ints have to be a integer value.
- // For example:
- int number = 500;
- // Here, you have a int set called number, and its value is 500 currently.
- // You can change the value of number by doing arithmetic operations on it
- number = number - 250;
- // In the example above, number is now 250 less, which means the value is (500 - 250), which is 250.
- // Here are more examples:
- number = number * 5; // number is now its previous value multiplied by 5
- number = number - 150; // number is now its previous value subtracted by 150
- number = number / 3; // number is now its previous value divided by 3
- // How to use ints
- // Here is a command I made up. It adds two numbers together if a user says !add <number> <number>
- if (command.StartsWith("!add")) // This line means if the command said is !add (Basically checks if someone says this command)
- {
- ... (Some code you will not understand currently I think)
- int number1 = Convert.ToInt32(split[1]); // this is the first number the user had said.. Since everything are strings
- // (a string is a line of text), it is required to convert that string
- // to a integer value for arithmetic operation..
- int number2 = Convert.ToInt32(split[2]); // The second number converted to an integer
- int number3 = number1 + number2; // number3 is the answer basically, its value is number1 added with number2
- con.Send("say", " Those two numbers added is " + number3); // chat message Bot will say "Those two numbers added is <answer>
- }
- // That is just an example for a command. There are far more practical and better ways to use ints, but their completely necessary
Advertisement
Add Comment
Please, Sign In to add comment