URL:
  <http://gna.org/bugs/?13042>

                 Summary: Objective; [show_if]
                 Project: Battle for Wesnoth
            Submitted by: darker_dreams
            Submitted on: Sunday 02/22/2009 at 00:14
                Category: Feature Request
                Severity: 1 - Wish
                Priority: 5 - Normal
              Item Group: WML
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 1.7.x
        Operating System: all

    _______________________________________________________

Details:

posting a feature request written by opensourcejunkie;

I'm posting this feature request as a response to the following thread:
viewtopic.php?f=12&t=22251&start=0&st=0&sk=t&sd=a.

The thread deals with a difficulty that a number of WML programmers (myself
included) have encountered when we try to create scenarios with dynamically
changing objectives. Basically, we would like to be able to create objectives
that will or will not be displayed, given a certain condition.

For example, in my campaign (Sceptre of Life) I have an optional NPC named
"Tanner" who, if the player has chosen to keep him, cannot be allowed to die.
So I need to be able to code a defeat objective telling the player that s/he
will lose if Tanner is lost, and that objective should only be displayed if
s/he has elected to keep Tanner.

Of course in my example, the problem is fairly simple to solve; I just coded
two sets of objectives - one including Tanner, and one discluding him.
However, if I had two optional NPCs (which I had planned to have, until I
realized the shortcomings of [objectives]) I would be required to code four
sets of objectives. Three NPCs would require nine sets of objectives; the
difficulty grows exponentially as the number of conditions increases.

Now, there are a few ways to accomplish such dynamically changing objectives
without a change to WML. The first is to use an [insert_tag] to replace the
[objective] tag. This requires you to have a preset number of objectives,
however, so it isn't a very expandable approach. The better approach is to
set one [objective], and then use string concatenation && text formatting to
make it look like there are multiple objectives. This method, of course, can
be very complex and hard to implement (especially for the non-programmer),
and it's more of a hack than a quality solution that would be present in a
robust language.

So, since the first solution is inadequate, and the second is overly complex,
and dynamically changing objectives seems like a natural "next step" to WML,
we feel that an expansion of WML is in order. The solution we arrived upon
uses two new tags: a [show_if] tag, and a [show_objectives] tag.

The [show_if] tag is borrowed from the [message]'s [option] tag, which is
also displayed conditionally. It would function like so:

[objectives]
##:: Victory Objectives
[objective]
condition=win
description= _ "Defeat all enemy leaders"
[/objective]

##:: Defeat Objectives
[objective]
condition=lose
description= _ "Death of Hero"
[/objective]
[objective]
condition=lose
description= _ "Death of Optional NPC 1"
[show_if]
[have_unit]
description=optional_npc_1
[/have_unit]
[/show_if]
[/objective]
[objective]
condition=lose
description= _ "Death of Optional NPC 2"
[show_if]
[have_unit]
description=optional_npc_2
[/have_unit]
[/show_if]
[/objective]
...
[objective]
condition=lose
description= _ "Death of Optional NPC N"
[show_if]
[have_unit]
description=optional_npc_n
[/have_unit]
[/show_if]
[/objective]
[/objective]


The [show_if] condition would be checked every time that the objectives
dialogue box is displayed - i.e. when the objectives are first changed, or
when they are viewed again by the player (using ctr+j or Menu > Scenario
Objectives). It wouldn't, however, be checked when the [show_if] conditions
change; such a check would have to take place every time that a variable was
changed, or a unit moved, etc., thus severely slowing down the wesnoth
engine.

Hence, a change in the game state could hypothetically change the objectives,
without alerting the player to the change. Thus the WML programmer must be
able to manually re-display the objectives to the player whenever a
significant change to the objectives takes place. Thus wml would need a
second new tag, [show_objectives], to re-display the current objectives.

[show_objectives] would have no keys, and would serve only to display the
current set of objectives, checking any [show_if] clauses to see if any
[objective]s need to be shown/hidden. [show_objectives] also helps to
separate WML's concerns
<http://en.wikipedia.org/wiki/Separation_of_concerns>, moving it toward
becoming a language in which the creation of objectives is separate from the
displaying of objectives.

Thanks for considering this feature request. Any questions about the
proposition can be posted on the afforementioned thread, or directed via pm
to Opensourcejunkie or Darker_Dreams (the creator of the thread).

Thanks again,
--OSJ




    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?13042>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to