Mostly Harmless

Editing UnrealScript

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 57: Line 57:
 
* Line 16 assigns a value to the local variable "GP" so it no longer is empty. To determine the value, the function accesses the variable "Level". This variable is not declared here, but in a parent class of DMRosterBeatTeam. The object referenced by "Level" has a variable of its own, called "Game", whose contained object in turn has a variable called "CurrentGameProfile". The content of that variable is assigned to our local "GP" variable.
 
* Line 16 assigns a value to the local variable "GP" so it no longer is empty. To determine the value, the function accesses the variable "Level". This variable is not declared here, but in a parent class of DMRosterBeatTeam. The object referenced by "Level" has a variable of its own, called "Game", whose contained object in turn has a variable called "CurrentGameProfile". The content of that variable is assigned to our local "GP" variable.
 
* On line 17 there's an [[If statement]] with a block of code that ends on line 20. That block of code is only executed if the expression in the parentheses following the keyword ''If'' returns the value ''True''. The ''If'' condition checks, whether the content of the local "GP" variable equals the special value ''None'', which simply means "empty".
 
* On line 17 there's an [[If statement]] with a block of code that ends on line 20. That block of code is only executed if the expression in the parentheses following the keyword ''If'' returns the value ''True''. The ''If'' condition checks, whether the content of the local "GP" variable equals the special value ''None'', which simply means "empty".
* Lines 18 and 19 are only executed if the condition (here: "GP is empty") is true. So, if GP is empty, first the function with the name "Log" is called to write a message to the log file, then the [[Return statement]] exits the function. In this case the code after the ''If'' block will not be executed. In other cases the ''If'' block might not contain a ''Return'' and code execution would continue after the ''If'' block.
+
* Line 18 and 18 are only executed if the condition (here: "GP is empty") is true. So, if GP is empty, first the function with the name "Log" is called to write a message to the log file, then the [[Return statement]] exits the function. In this case the code after the ''If'' block will not be executed. In other cases the ''If'' block might not contain a ''Return'' and code execution would continue after the ''If'' block.
 
* On line 23 there's a typical [[For loop]] that iterates over a [[dynamic array]]. The code on lines 25 to 27 is executed for each element of the "PlayerTeam" array in the object stored in the local "GP" variable. Notice how the ''If'' statement on line 17 ensured that "GP" actually contains an object.
 
* On line 23 there's a typical [[For loop]] that iterates over a [[dynamic array]]. The code on lines 25 to 27 is executed for each element of the "PlayerTeam" array in the object stored in the local "GP" variable. Notice how the ''If'' statement on line 17 ensured that "GP" actually contains an object.
 
* Line 34 calls another version of the "Initialize" function, that was declared in a parent class of DMRosterBeatTeam, passing on the TeamBots parameter. This call tells us, that the "Initialize" function of the DMRosterBeatTeam class actually [[wp:Method overriding (programming)|overrides]] a function with the same name in its parent class xDMRoster or another parent class further up the class hierarchy.
 
* Line 34 calls another version of the "Initialize" function, that was declared in a parent class of DMRosterBeatTeam, passing on the TeamBots parameter. This call tells us, that the "Initialize" function of the DMRosterBeatTeam class actually [[wp:Method overriding (programming)|overrides]] a function with the same name in its parent class xDMRoster or another parent class further up the class hierarchy.

All contributions to Unreal Wiki are considered to be released under the Attribution-Noncommercial-Share Alike 3.0 (see Unreal Wiki:Copyrights for details). Submitting material that doesn't fall under that license is only allowed for images and other media. When adding content, you are promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Copyright is still maintained by the original author.

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)

Templates used on this page: