expand IF usefulness

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
User avatar
Darker_Dreams
Posts: 608
Joined: February 1st, 2008, 5:26 pm

expand IF usefulness

Post by Darker_Dreams »

I don't know if you still can't nest If's in WML (I missed it in the changelogs if you can now), but that would be cool.

the idea/request I'm more interested in is the ability to use if within [objectives] tags, to make individual [objective]s show/disappear as a scenario develops. Every other component of a scenario can be timed and triggered, but right now I have to list every possible combination of objectives at every phase in a scenario for them to be useful. Generally, this isn't a problem, but I've had this become (*very*) unwieldy at least once with a scenario where discovery of what's going on in the area is a significant feature.

-------Edit--------
I'm adding this information in an effort to clarify the "problem" to which I am attempting to create a "solution," and to demonstrate that it's not simply an attempt to get "nifty features."
The source of this post is from the discussion at;
http://www.wesnoth.org/forum/viewtopic.php?f=21&t=20617

The goal of the idea is to allow a list of objectives to be partially changed mid-scenario. This would allow somewhat less linear scenarios in which several "story lines" could be pursued at different paces without requiring every possible combination of objectives be listed.
Last edited by Darker_Dreams on September 26th, 2008, 8:26 pm, edited 1 time in total.
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: expand IF usefulness

Post by Ken_Oh »

You can't nest [if]? I do it all the time.
User avatar
Darker_Dreams
Posts: 608
Joined: February 1st, 2008, 5:26 pm

Re: expand IF usefulness

Post by Darker_Dreams »

like I said, I know at one point it was verboten... if that changed I must have missed it.

I only added that because I was already posting because I wanted to suggest/ask about [IF]ing [objective]s.
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: expand IF usefulness

Post by AI »

https://gna.org/bugs/?4539

What you want to do is best done using macros.
User avatar
Darker_Dreams
Posts: 608
Joined: February 1st, 2008, 5:26 pm

Re: expand IF usefulness

Post by Darker_Dreams »

AI wrote:https://gna.org/bugs/?4539

What you want to do is best done using macros.
sapient wrote:However, another way to accomplish your goal would be to support [if] inside the [scenario] tag to allow conditional modification before the prestart event.
unless I'm completely missing something, this is how I end up with roughly x^y [objectives] blocks each of which minor variations on one another.
I'm not sure how if-ing, the following [objectives] is less convoluted than having to list each possible combination of [objectives] seperately with their own, external, [if] triggers. Finally, (and this may be my own ignorance) I'm also not sure how outsourcing the [objectives] to a macro does anything but export the same insanity to a seperate file.
[objectives]
[if]
[variable]
name=Find_Castle
equals=no
[/variable]
[then]
[objective]
description= _"Check with the local lord."
condition=win
[/objective]
[/then]
[/if]
[if]
[variable]
name=search_villages
equals=no
[/variable]
[then]
[objective]
description= _"Check all villages"
condition=win
[/objective]
[/then]
[/if]
[if]
[variable]
name=find_villian
equals=no
[/variable]
[then]
[objective]
description= _"Find the source of the raiders"
condition=win
[/objective]
[/then]
[/if]
[if]
[variable]
name=find_villian
equals=no
[/variable]
[and]
[variable]
name=find_kill_villian
equals=no
[/variable]
[then]
[objective]
description= _"Kill the bandit leader."
condition=win
[/objective]
[/then]
[/if]
[objective]
description= _"Your hero dies"
condition=lose
[/objective]
[/objectives]
(the above is a, slighly modified and significantly trimmed, general outline of a scenario I've been working on)
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: expand IF usefulness

Post by AI »

Code: Select all

#define MY_OBJECTIVES CURRENT
[objectives]
    [objective]
        description={CURRENT}
        condition=win
    [/objective]
    [objective]
        description= _ "Your hero dies"
        condition=lose
    [/objective]
[/objectives]
#enddef
{MY_OBJECTIVES ( _ "Current goal" ) }
Yes, it will expand to quite a bit of wml, but allowing [if] everywhere is ugly on the implementation end.

Besides, how should your example work, should the game check those variables every turn to see whether they've changed?
User avatar
Darker_Dreams
Posts: 608
Joined: February 1st, 2008, 5:26 pm

Re: expand IF usefulness

Post by Darker_Dreams »

AI wrote:

Code: Select all

...
Yes, it will expand to quite a bit of wml, but allowing [if] everywhere is ugly on the implementation end.
I could be misreading what you've put together, but you essentially have a macro that will allow a single objective to be passed to an external [objectives] tag. I suppose you could expand it to accept more variables, allowing a longer list of objectives to be passed (and just leave some "empty" if you don't need the full number at the moment)... but is that really more elegant? Especially since you still have to have the full lists of possible combinations, each within their own [if] tag.
AI wrote:Besides, how should your example work, should the game check those variables every turn to see whether they've changed?
It would check the same time it checks when you put the [if] outside the [objectives] tag... if that requires an [event] to define, is it really going to be more ugly than a string of

Code: Select all

[if][objectives][objective][objective][objective]...[/objectives][/if][if][objectives][objective][objective][objective]...[/objectives][/if]...
or even

Code: Select all

[if]{MY_OBJECTIVES ( _ "Current goal1" ) (win/loss) ( _ "Current goal2" ) (win/loss) ( _ "Current goal3" ) (win/loss) }[/if][if]{MY_OBJECTIVES ( _ "Current goal1" ) (win/loss) ( _ "Current goal2" ) (win/loss) ( _ "Current goal3" ) (win/loss) }[/if]...
User avatar
Darker_Dreams
Posts: 608
Joined: February 1st, 2008, 5:26 pm

Re: expand IF usefulness

Post by Darker_Dreams »

Added to original post in an effort to clarify my reasons for suggesting this idea.
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: expand IF usefulness

Post by AI »

Well, these days (in 1.5) you can do it using [insert_tag].
User avatar
A Guy
Posts: 793
Joined: May 24th, 2008, 1:55 am

Re: expand IF usefulness

Post by A Guy »

You can make the objective a value of a variable and have that variable change depending on conditions, can't you?
I'm just... a guy...
I'm back for now, I might get started on some work again.
AI
Developer
Posts: 2396
Joined: January 31st, 2008, 8:38 pm

Re: expand IF usefulness

Post by AI »

That's the easier way. ;)
User avatar
Darker_Dreams
Posts: 608
Joined: February 1st, 2008, 5:26 pm

Re: expand IF usefulness

Post by Darker_Dreams »

AI wrote:Well, these days (in 1.5) you can do it using [insert_tag].
A Guy wrote:You can make the objective a value of a variable and have that variable change depending on conditions, can't you?
Ah, looking at the [insert_tag] I wasn't clear on how that would work.
I do have to admit would be a clear improvement over having to list every possible combination of variables statically.

It does, however, still require the objective have a definite and static (maximum) number of objectives, and makes each objective slot a fairly clear (linear) track. Primarily for this reason I still think that [if]ing would be better in terms of campaign design.

On the up side, however- as I understand it, if this works as advertised it should allow me to change the objective when whatever other events are happening. I'll have to make sure I understand how this works to be certain of that though.
opensourcejunkie
Posts: 547
Joined: August 11th, 2008, 3:19 pm

Re: expand IF usefulness

Post by opensourcejunkie »

sorry for resurrecting a dead thread, but I wanted to mention that this is a feature that others have sensed was lacking (myself included). I realize that it's not a pressing need, since there are a couple hacks that can be used to alleviate the problem. However, none of them are very elegant or painless, and this seems like the sort of feature that a lot of people want to use.

My contribution to the discussion would be this: steal the [show_if] tag from [message] [option]s, and use it inside of the [objective] tag:

Code: Select all

[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]
My two cents, anyway. Sorry again for resurrecting this, but I think that Darker_Dreams' idea has merit, and it seems like it's something the people want.
--OSJ
what if the Bible's claims about Christ depicted accurate, verifiable history? given some research, you might be surprised at the evidence...
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Re: expand IF usefulness

Post by turin »

I'll just add my support for this proposal; a [show_if] tag is a very good idea.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
opensourcejunkie
Posts: 547
Joined: August 11th, 2008, 3:19 pm

Re: expand IF usefulness

Post by opensourcejunkie »

thanks :-)
what if the Bible's claims about Christ depicted accurate, verifiable history? given some research, you might be surprised at the evidence...
Post Reply