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/?CaseBasedReasoningA
 - - - - -
Index: CaseBasedReasoningA
===================================================================
RCS file: /home/wesnoth/cvsroot/wikiroot/CaseBasedReasoningA,v
retrieving revision 1.4
diff -u -r1.4 CaseBasedReasoningA
--- CaseBasedReasoningA 4 May 2005 19:10:36 -0000       1.4
+++ CaseBasedReasoningA 6 May 2005 12:24:46 -0000
@@ -1,78 +1 @@
-Use this to make deeply nested if-then-else logic look slightly more like a 
case statement.
-
-||Example of Use||
-
-For brevity the code to be executed is shown as macros in this example, but 
you can put raw WML there if you wish.
-
-A unit drinks an unidentified potion, and it's effect is...
- {RANDOM 
Strength,Agility,Haste,Experience,Health,Nightstealth,Sloth,Poison,Petrification}
- {IF_RANDOM_EQ Strength}
-    {QUAFF_POTION_OF_STRENGTH}
- {ELSE_IF_RANDOM_EQ Agility}
-    {QUAFF_POTION_OF_AGILITY}
- {ELSE_IF_RANDOM_EQ Haste}
-    {QUAFF_POTION_OF_HASTE}
- {ELSE_IF_RANDOM_EQ Experience}
-    {QUAFF_POTION_OF_EXPERIENCE}
- {ELSE_IF_RANDOM_EQ Health}
-    {QUAFF_POTION_OF_HEALTH}
- {ELSE_IF_RANDOM_EQ Nightstealth}
-    {QUAFF_POTION_OF_NIGHTSTEALTH}
- {ELSE_IF_RANDOM_EQ Sloth}
-    {QUAFF_POTION_OF_SLOTH}
- {ELSE_IF_RANDOM_EQ Poison}
-    {QUAFF_POISON}
- {ELSE_IF_RANDOM_EQ Petrification}
-    {QUAFF_POTION_OF_PETRIFICATION}
- [/then] # I suppose you could use a macro here, but it's only
- [/if]   # two lines, no matter how many cases you have.
- {CLOSE_ELSE_IF}
- {CLOSE_ELSE_IF}
- {CLOSE_ELSE_IF}
- {CLOSE_ELSE_IF}
- {CLOSE_ELSE_IF}
- {CLOSE_ELSE_IF}
- {CLOSE_ELSE_IF}
- {CLOSE_ELSE_IF}
-
-This could have been named CASE or such, but contrast its logic with 
CaseBasedReasoningB.
-
-If you can figure out a way to get rid of all the CLOSEs, replace this code 
with yours!
-
-||The Macro Definitions||
-
- 
#===============================================================================
- # Macros to make deep-nested if statements clearer:
- 
#-------------------------------------------------------------------------------
- # For testing equal-to:
- #define IF_RANDOM_EQ VALUE
-    [if]
-       [variable]
-          name=random
-          equals={VALUE}
-       [/variable]
-    [then]
- #enddef
- #define ELSE_IF_RANDOM_EQ VALUE
-    [/then]
-    [else]
-    [if]
-       [variable]
-          name=random
-          equals={VALUE}
-       [/variable]
-    [then]
- #enddef
- 
#-------------------------------------------------------------------------------
- #define CLOSE_ELSE_IF
-    [/else]
-    [/if]
- #enddef
-
-N.B. - The CLOSE_ELSE_IF macro is also used in the macros for 
CaseBasedReasoningB, so if you use them both you don't
-want to define it twice.
-
-||See Also||
-
-* CaseBasedReasoningB
-* 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