Let's say you have a script called add_together, and you need it to add 2 numbers. You don't know what 2 numbers you might need to add together, so you can't just put the numbers directly into the script, but you can provide them as arguments. Let's have a look at how we would use the script:
Code:
add_together(1,2); // Here, we are providing 1 and 2 as arguments for the add_together script
Now, let's look at the code inside of the add_together script.
add_together script:
Code:
first_number = argument0; // This makes the variable first_number equal to argument0, which is 1
second_number = argument1; // This makes the variable second_number equal to argument1, which is 2
total_sum = first_number+second_number; // total_sum here will end up as 3, because 1+2 = 3
We could use the same script again and provide different numbers:
Now let's look at the script code again.
add_together script:
Code:
first_number = argument0; // Argument0 is 4 this time, not 1, because we gave different numbers to the script above, so first_number is equal to 4
second_number = argument1; // Argument1 is now 8, so second_number is equal to 8
total_sum = first_number+second_number; // total_sum here will end up equaling 12, because 4+8 = 12
So the arguments just end up being equal to whatever we put inside the () brackets of a script, and you access the arguments inside the () by using argument0, argument1, argument2, etc.[/code]