JSH357

Joined: 02 Feb 2003 Posts: 1705
|
Posted: Sat Apr 19, 2008 9:19 am Post subject: |
|
|
Arguments are values that you pass into a script so that the script will have a different result for different values.
Let's consider fade screen out(). You should know what it does by now.
The fadscreenout() function can take three arguments: a red, blue and yellow value. By using this script, you can change the color that the screen flashes on the fade.
for instance:
fadescreenout(63,63,63) will make the screen flash white.
You use the same concept when adding arguments to your own scripts.
Let's say you're making a script add that returns the sum of two numbers.
You might call it in your main script like so:
Code: | variable(x,y,z)
x:= 5
y:=10
z:=add(x,y) // z should be 15 if the script works
|
Now, somewhere you'll have an autonumber function like this:
Code: | script, add, num1, num2, begin // num1 and num2 are arguments
return(num1 + num2)
// "returning" a value here means passing it back to the variable z in
// the main script.
end
|
You can use arguments for a variety of things. They aren't used so much when coding story scenes or typical OHR scripts, but for fancier features, it will serve you well to learn more about them. Check the wiki and HamsterSpeak specification for more details. |
|