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]
[/then]
[else]
[if]
[and]
[variable]
name=gryphon_disposition
greater_than_equal_to=2
[/variable]
[have_unit]
[elseif]
[and]
[variable]
name=gryphon_disposition
greater_than_equal_to=2
[/variable]
[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
[/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
[/filter]
[/store_unit]
[foreach]
array=gryphon_store
[do]
{VARIABLE this_item.type Gryphon}
[unstore_unit]
variable=this_item
[/unstore_unit]
[/filter]
[/store_unit]
[foreach]
array=gryphon_store
[do]
{VARIABLE this_item.type Gryphon}
[unstore_unit]
variable=this_item
[/unstore_unit]
[/do]
[/foreach]
{CLEAR_VARIABLE gryphon_store}
#
# Figure out where Konrad is standing
#
[store_unit]
variable=konrad_store
[filter]
id=Konrad
[/filter]
[/store_unit]
[if]
[variable]
name=konrad_store.x
greater_than=13
[/variable]
[then]
{VARIABLE destination_x 24}
[/then]
[else]
{VARIABLE destination_x 1}
[/else]
[/if]
[if]
[variable]
name=konrad_store.y
greater_than=16
[/variable]
[then]
{VARIABLE destination_y 39}
[/then]
[else]
{VARIABLE destination_y 1}
[/else]
[/if]
#
# 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 18 (Griak) ( _ "Griak")}
[scroll_to]
x,y=13,16
[/scroll_to]
[message]
speaker=narrator
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]
[sound]
name=gryphon-shriek-1.ogg
[/sound]
[store_unit]
variable=gryphon_store
[filter]
{CLEAR_VARIABLE gryphon_store}
#
# Figure out where Konrad is standing
#
[store_unit]
variable=konrad_store
[filter]
id=Konrad
[/filter]
[/store_unit]
[if]
[variable]
name=konrad_store.x
greater_than=13
[/variable]
[then]
{VARIABLE destination_x 24}
[/then]
[else]
{VARIABLE destination_x 1}
[/else]
[/if]
[if]
[variable]
name=konrad_store.y
greater_than=16
[/variable]
[then]
{VARIABLE destination_y 39}
[/then]
[else]
{VARIABLE destination_y 1}
[/else]
[/if]
#
# 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 18 (Griak) ( _ "Griak")}
[scroll_to]
x,y=13,16
[/scroll_to]
[message]
speaker=narrator
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]
[sound]
name=gryphon-shriek-1.ogg
[/sound]
[store_unit]
variable=gryphon_store
[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
[/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
x=$range_x
y=$range_y
[/move_unit_fake]
[/do]
[/foreach]
{CLEAR_VARIABLE konrad_store}
{CLEAR_VARIABLE gryphon_store}
{CLEAR_VARIABLE temp_x}
{CLEAR_VARIABLE temp_y}
{CLEAR_VARIABLE range_x}
{CLEAR_VARIABLE range_y}
{CLEAR_VARIABLE destination_x}
{CLEAR_VARIABLE destination_y}
[message]
speaker=Delfador
message= _ "Amazing! I have never before heard of such behavior in gryphons."
[/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]
x=$range_x
y=$range_y
[/move_unit_fake]
[/do]
[/foreach]
{CLEAR_VARIABLE konrad_store}
{CLEAR_VARIABLE gryphon_store}
{CLEAR_VARIABLE temp_x}
{CLEAR_VARIABLE temp_y}
{CLEAR_VARIABLE range_x}
{CLEAR_VARIABLE range_y}
{CLEAR_VARIABLE destination_x}
{CLEAR_VARIABLE destination_y}
[message]
speaker=Delfador
message= _ "Amazing! I have never before heard of such behavior in gryphons."
[/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]
[/elseif]
[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]
[message]

View file

@ -306,28 +306,6 @@
name=dk_kill_count
numerical_equals=4
[/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]
[message]
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]
[/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]
[message]
speaker=Delfador

View file

@ -609,48 +609,44 @@ Soooo... It is you who sent your subordinates to attack us. Now when weve des
[/then]
[else]
[if]
[then]
#ifdef EASY
{VARIABLE_OP spawn_level rand "1,2"}
{VARIABLE_OP spawn_level rand "1,2"}
#else
{VARIABLE_OP spawn_level rand "1,2,2,3"}
{VARIABLE_OP spawn_level rand "1,2,2,3"}
#endif
[switch]
variable=spawn_level
[switch]
variable=spawn_level
[case]
value=1
[case]
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}
[+unit]
ai_special=guardian
[/unit]
{CLEAR_VARIABLE spawn_type}
[/case]
{GENERIC_UNIT 2 $spawn_type $this_item.x $this_item.y}
[+unit]
ai_special=guardian
[/unit]
{CLEAR_VARIABLE spawn_type}
[/case]
[case]
value=2
[case]
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)"}
[/case]
{VARIABLE this_item.delayed_spawning_on_turn "$($turn_number + 1)"}
[/case]
[case]
value=3
[case]
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)"}
[/case]
[/switch]
{CLEAR_VARIABLE spawn_level}
[/then]
[/if]
{VARIABLE this_item.delayed_spawning_on_turn "$($turn_number + 2)"}
[/case]
[/switch]
{CLEAR_VARIABLE spawn_level}
[/else]
[/if]
[/then]