Blockland Forums > Modification Help
CityRP Help
<< < (2/3) > >>
DrenDran:
Return, does this:
First it can stop a function, and just end it's execution.
For example...

--- Code: ---function returntest(%a)
{
echo("Statement one.");
if(%a==1)
return;
echo("Statement two.");
}

--- End code ---
If that function is passed with %a as a 1 then it will 'return' where it says return, if not it won't, so it would output "statement one" and "statement two" if %a is not equal to 1 and if it is equal to one it would just output "statement one".

Return can also be used to make functions 'return' variables:

--- Code: ---function anothertest(%a)
{
return %a/1.2;
}

--- End code ---
Now you could use "anothertest(<var>);" for example, to do work for you, for example:

--- Code: ---echo(anothertest(5));

--- End code ---
Would print out 5*1.2 in the console.
Blaze0:

--- Quote from: DrenDran on January 26, 2011, 07:12:36 AM ----snip-

--- End quote ---
English, please.

I guess TorqueScript just isn't for me...
halcynthis:

--- Quote from: Blaze0 on January 26, 2011, 02:45:57 PM ---English, please.

I guess TorqueScript just isn't for me...

--- End quote ---

You just need to start off simple, then work your way up.
otto-san:

--- Quote from: Blaze0 on January 26, 2011, 02:45:57 PM ---English, please.

I guess TorqueScript just isn't for me...

--- End quote ---

--- Quote from: otto-san on January 25, 2011, 11:31:01 PM ---Torque is not going to come so easily as you seem to want it to. It takes time, but we'd be glad to help you get on your feet.

--- End quote ---
Bauklotz:

--- Quote from: otto-san on January 25, 2011, 11:31:01 PM ---1. Local is within a function or assigned to an object. Global is, like, server prefs and things like that.

--- End quote ---

...
Local variables are variables that are removed from their current scope when it is destroyed.
Example, the eval call it was used in ends, it's function is over, etc.
Global variables are variables that are constantly consistent, only removed when the 'deleteVariables' function is called with a mask that matches the variable.
Field variables are variables that are assigned to an object, and are removed when the object is destroyed.
Navigation
Message Index
Next page
Previous page

Go to full version