Difference between revisions of "Talk:Label"
imported>DragoonWraith |
imported>DragoonWraith |
||
Line 37: | Line 37: | ||
Does the message also occur in GameMode? Can't imagine that, since it would make those blocktypes useless, but it's left open in the article.<br>[[User:Diarrhoe|Diarrhoe]] 12:09, 5 May 2011 (EDT) | Does the message also occur in GameMode? Can't imagine that, since it would make those blocktypes useless, but it's left open in the article.<br>[[User:Diarrhoe|Diarrhoe]] 12:09, 5 May 2011 (EDT) | ||
:# No, Label needs to be run before Goto in a give run-through of a script for the Goto to work. Also, this would be a generally bad idea, from the perspective of good coding practices. See [http://en.wikipedia.org/wiki/Go_To_Statement_Considered_Harmful ''Go To Statement Considered Harmful] for the most famous criticism of label/goto — the only reason we have it at all, I suspect, is because While was not available originally. Note that it ''is'' viable, and the linked page will discuss how some programmers disagree, nonetheless goto is considered a major potential problem in any code it is used in. See also: [http://xkcd.com/292/ humorous graphical explanation] | :# No, Label needs to be run before Goto in a give run-through of a script for the Goto to work. Also, this would be a generally bad idea, from the perspective of good coding practices. See [http://en.wikipedia.org/wiki/Go_To_Statement_Considered_Harmful ''Go To Statement Considered Harmful''] for the most famous criticism of label/goto — the only reason we have it at all, I suspect, is because While was not available originally. Note that it ''is'' viable, and the linked page will discuss how some programmers disagree, nonetheless goto is considered a major potential problem in any code it is used in. See also: [http://xkcd.com/292/ humorous graphical explanation] | ||
:# I have absolutely no idea, but for the same reasons that Goto is ''usually'' bad, that use strikes me as ''awful''. That would make your code an ''absolute nightmare'' to read/follow. | :# I have absolutely no idea, but for the same reasons that Goto is ''usually'' bad, that use strikes me as ''awful''. That would make your code an ''absolute nightmare'' to read/follow. | ||
:[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 17:18, 6 May 2011 (EDT) | :[[User:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">D</span>ragoon <span style="font-family: Oblivion, Daedric Runes; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion, Daedric Runes; size=2;">TALK</span>]] 17:18, 6 May 2011 (EDT) |
Latest revision as of 16:18, 6 May 2011
Questions on the use of Label/GoTo[edit source]
Since my computer lacks in a proper graphic card, I can't test it on my own:
1) In the article, it says label is used to create a certain label ID. This sounds to me like the command has to be run before goTo can be called. Is that right? Because it would be a good way to exclude certain parts of a script without using if conditions for the sake clarity. For instance
short Var ;... if Var == 0 GoTo 1 endif ; code to exclude Label 1 ;...
as a workaround for
short Var ;... if Var ; code to exclude endif ;...
Does this work as expected? This would be useful especially for long exclusions.
2) Is label/goTo bound to only one blocktype or is it possible to switch between several blocks.
For example
Begin MenuMode Label 1 message "text" end Begin GameMode GoTo 1 end
Does the message also occur in GameMode? Can't imagine that, since it would make those blocktypes useless, but it's left open in the article.
Diarrhoe 12:09, 5 May 2011 (EDT)
- No, Label needs to be run before Goto in a give run-through of a script for the Goto to work. Also, this would be a generally bad idea, from the perspective of good coding practices. See Go To Statement Considered Harmful for the most famous criticism of label/goto — the only reason we have it at all, I suspect, is because While was not available originally. Note that it is viable, and the linked page will discuss how some programmers disagree, nonetheless goto is considered a major potential problem in any code it is used in. See also: humorous graphical explanation
- I have absolutely no idea, but for the same reasons that Goto is usually bad, that use strikes me as awful. That would make your code an absolute nightmare to read/follow.
- Dragoon Wraith TALK 17:18, 6 May 2011 (EDT)