HttT [else][if] s/b [elseif]; [if] requires conditional

This commit is contained in:
Gregory A Lundberg 2016-08-06 13:00:00 -05:00
parent a2811dd620
commit 2cf5c075ca
3 changed files with 180 additions and 188 deletions

View File

@ -266,147 +266,145 @@
message= _ "With these gryphon eggs we should be able to breed gryphons that will serve us. When they are large enough to carry mounts, we can hire gryphon riders!" message= _ "With these gryphon eggs we should be able to breed gryphons that will serve us. When they are large enough to carry mounts, we can hire gryphon riders!"
[/message] [/message]
[/then] [/then]
[else] [elseif]
[if] [and]
[and] [variable]
[variable] name=gryphon_disposition
name=gryphon_disposition greater_than_equal_to=2
greater_than_equal_to=2 [/variable]
[/variable] [have_unit]
[have_unit] side=3
[/have_unit]
[/and]
[then]
[message]
speaker=Konrad
message= _ "It is a shame we could not get those gryphon eggs. I am glad we did not slaughter any gryphons. They are magnificent animals (looks back at the mountain). Still..."
[/message]
[message]
speaker=Konrad
message= _ "Whoa!!"
[/message]
#
# Wake up all the sleeping gryphons
#
[store_unit]
variable=gryphon_store
[filter]
side=3 side=3
[/have_unit] [/filter]
[/and] [/store_unit]
[then] [foreach]
[message] array=gryphon_store
speaker=Konrad [do]
message= _ "It is a shame we could not get those gryphon eggs. I am glad we did not slaughter any gryphons. They are magnificent animals (looks back at the mountain). Still..." {VARIABLE this_item.type Gryphon}
[/message] [unstore_unit]
[message] variable=this_item
speaker=Konrad [/unstore_unit]
message= _ "Whoa!!"
[/message]
#
# Wake up all the sleeping gryphons
#
[store_unit]
variable=gryphon_store
[filter]
side=3
[/filter]
[/store_unit]
[foreach]
array=gryphon_store
[do]
{VARIABLE this_item.type Gryphon}
[unstore_unit]
variable=this_item
[/unstore_unit]
[/do] [/do]
[/foreach] [/foreach]
{CLEAR_VARIABLE gryphon_store} {CLEAR_VARIABLE gryphon_store}
# #
# Figure out where Konrad is standing # Figure out where Konrad is standing
# #
[store_unit] [store_unit]
variable=konrad_store variable=konrad_store
[filter] [filter]
id=Konrad id=Konrad
[/filter] [/filter]
[/store_unit] [/store_unit]
[if] [if]
[variable] [variable]
name=konrad_store.x name=konrad_store.x
greater_than=13 greater_than=13
[/variable] [/variable]
[then] [then]
{VARIABLE destination_x 24} {VARIABLE destination_x 24}
[/then] [/then]
[else] [else]
{VARIABLE destination_x 1} {VARIABLE destination_x 1}
[/else] [/else]
[/if] [/if]
[if] [if]
[variable] [variable]
name=konrad_store.y name=konrad_store.y
greater_than=16 greater_than=16
[/variable] [/variable]
[then] [then]
{VARIABLE destination_y 39} {VARIABLE destination_y 39}
[/then] [/then]
[else] [else]
{VARIABLE destination_y 1} {VARIABLE destination_y 1}
[/else] [/else]
[/if] [/if]
# #
# Put some more gryphons up there and view the mountain # Put some more gryphons up there and view the mountain
# #
{NAMED_LOYAL_UNIT 3 (Gryphon) 13 14 (Graik) ( _ "Graik")} {NAMED_LOYAL_UNIT 3 (Gryphon) 13 14 (Graik) ( _ "Graik")}
{NAMED_LOYAL_UNIT 3 (Gryphon) 13 18 (Griak) ( _ "Griak")} {NAMED_LOYAL_UNIT 3 (Gryphon) 13 18 (Griak) ( _ "Griak")}
[scroll_to] [scroll_to]
x,y=13,16 x,y=13,16
[/scroll_to] [/scroll_to]
[message] [message]
speaker=narrator speaker=narrator
image="wesnoth-icon.png" image="wesnoth-icon.png"
message= _ "Indeed, the majestic beasts were now circling the mountains peak. Several glared in Konrads direction, their eagle eyes fixed on him at an incredible distance." message= _ "Indeed, the majestic beasts were now circling the mountains peak. Several glared in Konrads direction, their eagle eyes fixed on him at an incredible distance."
[/message] [/message]
[sound] [sound]
name=gryphon-shriek-1.ogg name=gryphon-shriek-1.ogg
[/sound] [/sound]
[store_unit] [store_unit]
variable=gryphon_store variable=gryphon_store
[filter] [filter]
side=3
[/filter]
[/store_unit]
[foreach]
array=gryphon_store
[do]
{VARIABLE temp_x $this_item.x}
{VARIABLE temp_y $this_item.y}
{VARIABLE range_x ("$temp_x|, $destination_x")}
{VARIABLE range_y ("$temp_y|, $destination_y")}
[kill]
x=$temp_x
y=$temp_y
[/kill]
[move_unit_fake]
type=Gryphon
side=3 side=3
[/filter] x=$range_x
[/store_unit] y=$range_y
[foreach] [/move_unit_fake]
array=gryphon_store [/do]
[do] [/foreach]
{VARIABLE temp_x $this_item.x} {CLEAR_VARIABLE konrad_store}
{VARIABLE temp_y $this_item.y} {CLEAR_VARIABLE gryphon_store}
{VARIABLE range_x ("$temp_x|, $destination_x")} {CLEAR_VARIABLE temp_x}
{VARIABLE range_y ("$temp_y|, $destination_y")} {CLEAR_VARIABLE temp_y}
[kill] {CLEAR_VARIABLE range_x}
x=$temp_x {CLEAR_VARIABLE range_y}
y=$temp_y {CLEAR_VARIABLE destination_x}
[/kill] {CLEAR_VARIABLE destination_y}
[move_unit_fake] [message]
type=Gryphon speaker=Delfador
side=3 message= _ "Amazing! I have never before heard of such behavior in gryphons."
x=$range_x [/message]
y=$range_y [message]
[/move_unit_fake] speaker=Konrad
[/do] message= _ "What does it mean?"
[/foreach] [/message]
{CLEAR_VARIABLE konrad_store} [message]
{CLEAR_VARIABLE gryphon_store} speaker=Delfador
{CLEAR_VARIABLE temp_x} message= _ "I do not know. Come now, the show is over."
{CLEAR_VARIABLE temp_y} [/message]
{CLEAR_VARIABLE range_x} [/then]
{CLEAR_VARIABLE range_y} [/elseif]
{CLEAR_VARIABLE destination_x} [else]
{CLEAR_VARIABLE destination_y} [message]
[message] speaker=Konrad
speaker=Delfador message= _ "It is a shame we could not get those gryphon eggs — they would surely have given us an advantage sometime. Still, we must continue."
message= _ "Amazing! I have never before heard of such behavior in gryphons." [/message]
[/message]
[message]
speaker=Konrad
message= _ "What does it mean?"
[/message]
[message]
speaker=Delfador
message= _ "I do not know. Come now, the show is over."
[/message]
[/then]
[else]
[message]
speaker=Konrad
message= _ "It is a shame we could not get those gryphon eggs — they would surely have given us an advantage sometime. Still, we must continue."
[/message]
[/else]
[/if]
[/else] [/else]
[/if] [/if]
[message] [message]

View File

@ -306,28 +306,6 @@
name=dk_kill_count name=dk_kill_count
numerical_equals=4 numerical_equals=4
[/variable] [/variable]
[else]
[if]
[variable]
name=dk_kill_count
numerical_equals=3
[/variable]
[then]
[message]
speaker=narrator
image="wesnoth-icon.png"
message= _ "A final blow destroys the lich, releasing a small shock wave of energy outwards. The last of his minions silently falls like a puppet with its strings cut. A cloud of dust billows outwards as the remnants of the lichs once-mortal body disintegrate for the last time."
[/message]
[/then]
[else]
[message]
speaker=narrator
image="wesnoth-icon.png"
message= _ "A final blow destroys the lich, releasing a small shock wave of energy outwards. His minions fall like puppets with their strings cut. A cloud of dust billows out as the remnants of the lichs once-mortal body disintegrate for the last time."
[/message]
[/else]
[/if]
[/else]
[then] [then]
[message] [message]
speaker=narrator speaker=narrator
@ -335,6 +313,26 @@
message= _ "A final blow destroys the lich, releasing a small shock wave of energy outwards. A giant cloud of dust billows out as the remnants of the lichs once-mortal body disintegrate for the last time." message= _ "A final blow destroys the lich, releasing a small shock wave of energy outwards. A giant cloud of dust billows out as the remnants of the lichs once-mortal body disintegrate for the last time."
[/message] [/message]
[/then] [/then]
[elseif]
[variable]
name=dk_kill_count
numerical_equals=3
[/variable]
[then]
[message]
speaker=narrator
image="wesnoth-icon.png"
message= _ "A final blow destroys the lich, releasing a small shock wave of energy outwards. The last of his minions silently falls like a puppet with its strings cut. A cloud of dust billows outwards as the remnants of the lichs once-mortal body disintegrate for the last time."
[/message]
[/then]
[/elseif]
[else]
[message]
speaker=narrator
image="wesnoth-icon.png"
message= _ "A final blow destroys the lich, releasing a small shock wave of energy outwards. His minions fall like puppets with their strings cut. A cloud of dust billows out as the remnants of the lichs once-mortal body disintegrate for the last time."
[/message]
[/else]
[/if] [/if]
[message] [message]
speaker=Delfador speaker=Delfador

View File

@ -609,48 +609,44 @@ Soooo... It is you who sent your subordinates to attack us. Now when weve des
[/then] [/then]
[else] [else]
[if]
[then]
#ifdef EASY #ifdef EASY
{VARIABLE_OP spawn_level rand "1,2"} {VARIABLE_OP spawn_level rand "1,2"}
#else #else
{VARIABLE_OP spawn_level rand "1,2,2,3"} {VARIABLE_OP spawn_level rand "1,2,2,3"}
#endif #endif
[switch] [switch]
variable=spawn_level variable=spawn_level
[case] [case]
value=1 value=1
{VARIABLE_OP spawn_type rand "Drake Fighter,Drake Burner,Drake Glider"} {VARIABLE_OP spawn_type rand "Drake Fighter,Drake Burner,Drake Glider"}
{GENERIC_UNIT 2 $spawn_type $this_item.x $this_item.y} {GENERIC_UNIT 2 $spawn_type $this_item.x $this_item.y}
[+unit] [+unit]
ai_special=guardian ai_special=guardian
[/unit] [/unit]
{CLEAR_VARIABLE spawn_type} {CLEAR_VARIABLE spawn_type}
[/case] [/case]
[case] [case]
value=2 value=2
{VARIABLE_OP this_item.spawn_type rand "Drake Warrior,Drake Flare,Fire Drake,Sky Drake"} {VARIABLE_OP this_item.spawn_type rand "Drake Warrior,Drake Flare,Fire Drake,Sky Drake"}
{VARIABLE this_item.delayed_spawning_on_turn "$($turn_number + 1)"} {VARIABLE this_item.delayed_spawning_on_turn "$($turn_number + 1)"}
[/case] [/case]
[case] [case]
value=3 value=3
{VARIABLE_OP this_item.spawn_type rand "Drake Blademaster,Drake Flameheart,Inferno Drake,Drake Enforcer,Drake Warden,Hurricane Drake"} {VARIABLE_OP this_item.spawn_type rand "Drake Blademaster,Drake Flameheart,Inferno Drake,Drake Enforcer,Drake Warden,Hurricane Drake"}
{VARIABLE this_item.delayed_spawning_on_turn "$($turn_number + 2)"} {VARIABLE this_item.delayed_spawning_on_turn "$($turn_number + 2)"}
[/case] [/case]
[/switch] [/switch]
{CLEAR_VARIABLE spawn_level} {CLEAR_VARIABLE spawn_level}
[/then]
[/if]
[/else] [/else]
[/if] [/if]
[/then] [/then]