UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050403 
Galeon/1.3.20
IP: 128.83.57.150
URI: http://wesnoth.slack.it/?ProbabilityBasedBranching
 - - - - -
Index: ProbabilityBasedBranching
===================================================================
RCS file: /home/wesnoth/cvsroot/wikiroot/ProbabilityBasedBranching,v
retrieving revision 1.4
diff -u -r1.4 ProbabilityBasedBranching
--- ProbabilityBasedBranching   4 May 2005 18:50:26 -0000       1.4
+++ ProbabilityBasedBranching   6 May 2005 12:24:52 -0000
@@ -1,52 +1 @@
-Here is code that lets you specify a probability for doing something:
-
-||Examples of Use||
-
-||Example 1:|| Do something common with an 85% chance, otherwise do something 
uncommon. (Your code doesn't have to be a
-macro; the example just uses some bogus macros for brevity.)
-
- {PERCENT_CHANCE 85}
-    {YOUR_CODE_HERE}               # 85% chance of being executed
- {PERCENT_CHANCE_ELSE}
-    {YOUR_OTHER_CODE_HERE}         # executed if-and-only-if the previous one 
wasn't
- {PERCENT_CHANCE_END}
-
-||Example 2:|| Do something with a 37% chance, otherwise do nothing.
-
- {PERCENT_CHANCE 37}
-    {YOUR_CODE_HERE}               # done with an 37% chance; otherwise 
nothing happens at all
- {PERCENT_CHANCE_END_WITHOUT_ELSE} # notice that you have to use a different 
terminator
-
-||The Macro Definitions||
-
- 
#===============================================================================
- # Macros for probability-based branching:
- 
#-------------------------------------------------------------------------------
- #define PERCENT_CHANCE PERCENT
-    {RANDOM 1..100}
-    [if]
-       [variable]
-          name=random
-          less_than_equal_to={PERCENT}
-       [/variable]
-    [then]
- #enddef
- #define PERCENT_CHANCE_ELSE
-    [/then]
-    [else]
- #enddef
- #define PERCENT_CHANCE_END
-    [/else]
-    [/if]
- #enddef
- 
#-------------------------------------------------------------------------------
- # For when you don't want an 'else':
- #define PERCENT_CHANCE_END_WITHOUT_ELSE
-    [/then]
-    [/if]
- #enddef
-
-
-||See Also||
-
-* UsefulWMLFragments
+This page has been superceded by the macros at ProgrammingMacros.




_______________________________________________
Wesnoth-wiki-changes mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/wesnoth-wiki-changes

Reply via email to