Different Branches in "Story"

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
Taurus
Inactive Developer
Posts: 674
Joined: May 4th, 2005, 8:16 pm
Location: Canada

Different Branches in "Story"

Post by Taurus »

I was woundering, is it possible to make branching storylines within the "story" tag?

For example, I have tried doing something like this:

Code: Select all


[story]

[part]
story= _ "Text"
[/part]

[if]
[variable]
name=branch1
numerical_equals=1
[/variable]

[then]

[part]
story=  _ "Branch 1 Text"
[/part]

[/then]

[/if]

[if]
[variable]
name=branch2
numerical_equals=1
[/variable]

[then]

[part]
story=  _ "Branch 2 Text"
[/part]

[/then]

[/if]

[/story]

Although this doesen't work period, I think it convays what I am trying to achieve. Any suggestions?
Creater of the campaign, "Northern Rebirth"

Compleater of the campaign, "Son of the Black Eye"

Fiach Dubh
Posts: 381
Joined: December 2nd, 2006, 4:10 am
Location: Thar an scáthán

Post by Fiach Dubh »

Refer to Heir to the Throne - in Bay of Pearls, there are two potential 'next scenarios'. In that particular case, both of them lead to the same scenario afterwards - but there's no reason why they have to, in theory they could branch in totally different directions.
Jetryl wrote:Normal people are like candy ravers. You look away for a moment and next thing you know they're spreading vaseline on your nipples and cooing like a pigeon.

User avatar
zookeeper
WML Wizard
Posts: 9740
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Someone once told me that there's an undocumented (most likely still undocumented because I actually never confirmed it myself) feature that indeed allows one to use an [if] inside [story] somehow. Of course, having not tried it, I can't be completely sure that's correct.

Maybe you should try something simpler, like having the [if] first and having only one of them and seeing if it works then. Maybe the [if] handling is done in some obsolete way in the story screens, since it's existence has probably mostly been forgotten.

User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

Just like to say that, if this is not possible, it would be greatly desired. I don't want to have to have two different identical scenarios just because I need one line different in the [story] tag...
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

Xan
Inactive Developer
Posts: 258
Joined: August 28th, 2005, 3:05 pm
Contact:

Post by Xan »

AFAICT, that above code should work...
"It is time people learned about their failures and my successes."

Taurus
Inactive Developer
Posts: 674
Joined: May 4th, 2005, 8:16 pm
Location: Canada

Post by Taurus »

turin wrote:Just like to say that, if this is not possible, it would be greatly desired. I don't want to have to have two different identical scenarios just because I need one line different in the [story] tag...
That is what I have now, two - or actually - three identical scenarios with slightly different [story] tags. It makes it hell to maintain, and it's pretty sloppy so I was hoping to change it.
Creater of the campaign, "Northern Rebirth"

Compleater of the campaign, "Son of the Black Eye"

Taurus
Inactive Developer
Posts: 674
Joined: May 4th, 2005, 8:16 pm
Location: Canada

Post by Taurus »

Ok, I have been fiddling around with the above code for a copule hours now and here are my findings: The first "if" works, the second one doesn't. When you run it through the game using "branch1" variable, everything goes as expected. If you run it thorugh with "branch2" variable, the story stops at the first part and skips right away into the [start] event.
Creater of the campaign, "Northern Rebirth"

Compleater of the campaign, "Son of the Black Eye"

Kaldred
Posts: 31
Joined: August 6th, 2006, 3:18 pm

Post by Kaldred »

For only 2 different branches you can use

Code: Select all

    [story]
    	[part]
        story= _ "Text"
        [/part]

        [if]
            [variable]
            name=hhpotion
            numerical_equals=1
            [/variable]

            [then]

                [part]
                	story=  _ "Branch 1 Text"
                [/part]

            [/then]
            [else]

                [part]
               		story=  _ "Branch 2 Text"
                [/part]

            [/else]

        [/if]
    [/story]

Kaldred
Posts: 31
Joined: August 6th, 2006, 3:18 pm

Post by Kaldred »

Sorry for doppelpost. =(
Here a code which use short fake scenarios for 1,2,3...n different storys.

Code: Select all

[scenario]
    id="branch1"
    name=_"branch1"
    next_scenario="really-next-scenario"

    [story]
    	[part]
        story= _ "branch1"
        [/part]
    [/story]

[event]
    name=prestart
    [endlevel]
        result=continue_no_save
    [/endlevel]
[/event]
[/scenario]

[scenario]
    id="branch2"
    .
    .
    .
[event]
    name=prestart
    [endlevel]
    	result=continue_no_save
    [/endlevel]
[/event]
[/scenario]

[scenario]
    id="branch3"
	.
	.
	.
[/scenario]

[scenario]
    id="really-next-scenario"
	.
	.
	.
[/scenario]

Taurus
Inactive Developer
Posts: 674
Joined: May 4th, 2005, 8:16 pm
Location: Canada

Post by Taurus »

I haven't had a chance to work on this for a while but I finally got it. Thanks again for all the help everyone.

To make three different branches in the story, I built onto Kaldred's first post a bit, and it works fine as of Version 1.2

For future reference, in case anyone else has the same question, here is the code I used:

Code: Select all

[story]

	[part]
	story= _ "Intro Text."

	[/part]

	[if]
	[variable]
	name=branch1
	numerical_equals=1
	[/variable]

	[then]

	[part]
	story= _ "Branch 1 Text"
	[/part]

	[/then]

	[else]

	[if]
	[variable]
	name=branch2
	numerical_equals=1
	[/variable]

	[then]

	[part]
	story= _ "Branch 2 Text"
	[/part]

	[/then]

	[else]

	[part]
	story= _ "Branch 3 Text"
	[/part]

	[/else]

	[/if]

	[/else]

	[/if]
	
	[/story]
Creater of the campaign, "Northern Rebirth"

Compleater of the campaign, "Son of the Black Eye"

Post Reply