Issue with *if, *elseif and *else

I’m having trouble with showing a player siding with 3 different factions in a stats page, part of the issue is that the player can pick options of a different ideological leaning so the code has to account for if they choose to do a weird mix and match of ideas. Code posted below so for example if a player accumulated 1 liberal_republican and 1 centrist_republican then conservative_republican would still be 0 and not fall into the first *elseif and should go to the *else statement.

The error I’m getting is: It is illegal to fall into an *else statement, you must *goto or *finish before the end of the indented block.

My code looks like this:

*if part_rep = false
    You have not been informed of your party's status just yet
*elseif (part_rep = true) and ((liberal_republican = centrist_republican) and (conservative_republican = centrist_republican))
    The Republican party is currently riven between it's various factions and its ideological future is uncertain.
*elseif (part_rep = true) and ((liberal_republican > conservative_republican) and ( liberal_republican > centrist_republican))
    *if liberal_republican >= 6
        The Liberal Republican or Rockfeller Republican faction of the Republican party is ascendant and is working furiously to rebuild itself now that they have a President back in the White House. From party primaries to vulnerable Liberal Democratic seats the party is slowly preparing to ensure it's brand of progressive conservatism is the ruling philosophy on the Right for foreseeable future.
    *if liberal_republican = 5
        The Liberal Republicans have emerged for the moment as the dominant faction in the Republican party.
    *if liberal_republican = 4
        The Liberal Republicans have gained control of a majority of the Republican party at the moment.
    *if liberal_republican = 3
        The Liberal Republicans seem to be on the rise in the party and are slowly gaining control of the party leadership.
    *if liberal_republican = 2
        The Liberal Republicans have emerged as the most likely to rise as a result of the Presidents policies but much is still uncertain and the party's future is still in flux.
    *if liberal_republican <= 1
        The President has shown some favoritism for the Liberal Republicans and their policies lets seem if it lasts.
*elseif (part_rep = true) and ((centrist_republican > conservative_republican) and ( centrist_republican > liberal_republican))
    *if centrist_republican >= 6
        The Moderate Republicans in the Republican party have solidified their hold of the party for the foreseeable future while perhaps predictable based on the Presidents own record it is reassuring to the mainstream members of the party. The Right can look forward to the steady reform and improvement of the status quo for years to come.
    *if centrist_republican = 5
        The Moderate Republicans have maintained their position as the dominant faction in the Republican party.
    *if centrist_republican = 4
        The Moderate Republicans have maintained control of a majority of the Republican party at the moment.
    *if centrist_republican = 3
        The Moderate Republicans seem to be on the rise in the party and are slowly solidifying their hold of the party leadership.
    *if centrist_republican = 2
        The Moderate Republicans have emerged as the most likely to maintain control of the party as a result of the Presidents policies but much is still uncertain and the party's future is still in flux.
    *if centrist_republican <= 1
        The President has shown some favoritism for the Moderate Republicans and their policies lets see if it lasts.
*elseif (part_rep = true ) and ((conservative_republican > liberal_republican) and ( conservative_republican > centrist_republican))
    *if conservative_republican >= 6	
        The Conservative Republicans or Reagenite faction of the Republican party has grown ascendant and is working vigorously to spread the message of the Ford Revolution to the country. The dominant thought on the Right will remain classical liberalism and supply side tax cuts for years to come. 
    *if conservative_republican = 5
        The Conservative Republicans have emerged for the moment as the dominant faction in the Republican party.
    *if conservative_republican = 4
        The Conservative Republicans have gained control of a majority of the Republican party at the moment.
    *if conservative_republican = 3
        The Conservative Republicans seem to be on the rise in the party and are slowly gaining control of the party leadership.
    *if conservative_republican = 2
        The Conservative Republicans have emerged as the most likely to maintain control of the party as a result of the Presidents policies but much is still uncertain and the party's future is still in flux.
    *if conservative_republican <= 1
        The President has shown some favoritism for the Conservative Republicans and their policies lets see if it lasts.
*else
    The President has favored a variety of ideas and policies and no one wing of the Republican party has grown to dominate it.
    *finish

If you have an *if or and *elseif or an *else, you must have a *goto or a *finish after the text.

So I’ve added some *gotos above–if you fulfill the first *if, you *goto *label fancydressball; if you fulfill the next two, you *goto *label bbq.

You can’t just drop down and out of an *if/*elseif/*else in default Choicescript–you have to tell the code where to go.

1 Like

Let me try it out, it’s just supposed to be displaying something in the stats page so maybe I could theoretically redirect it back to the stats page.

So I’ve found a theoretical solution although I won’t be able to add anything to the stat page underneath it. This seems to be working in my own code even if it is a bit unwieldy.

*if part_rep = false
    You have not been informed of your party's status just yet.
    *finish
*elseif (part_rep = true) and ((liberal_republican = centrist_republican) and (conservative_republican = centrist_republican))
    The Republican party is currently riven between it's various factions and its ideological future is uncertain.
    *finish
*elseif (part_rep = true) and ((liberal_republican > conservative_republican) and ( liberal_republican > centrist_republican))
    *if liberal_republican >= 6
        The Liberal Republican or Rockfeller Republican faction of the Republican party is ascendant and is working furiously to rebuild itself now that they have a President back in the White House. From party primaries to vulnerable Liberal Democratic seats the party is slowly preparing to ensure it's brand of progressive conservatism is the ruling philosophy on the Right for foreseeable future.
        *finish
    *if liberal_republican = 5
        The Liberal Republicans have emerged for the moment as the dominant faction in the Republican party.
        *finish
    *if liberal_republican = 4
        The Liberal Republicans have gained control of a majority of the Republican party at the moment.
        *finish
    *if liberal_republican = 3
        The Liberal Republicans seem to be on the rise in the party and are slowly gaining control of the party leadership.
        *finish
    *if liberal_republican = 2
        The Liberal Republicans have emerged as the most likely to rise as a result of the Presidents policies but much is still uncertain and the party's future is still in flux.
        *finish
    *if liberal_republican <= 1
        The President has shown some favoritism for the Liberal Republicans and their policies lets seem if it lasts.
        *finish
    *finish
*elseif (part_rep = true) and ((centrist_republican > conservative_republican) and ( centrist_republican > liberal_republican))
    *if centrist_republican >= 6
        The Moderate Republicans in the Republican party have solidified their hold of the party for the foreseeable future while perhaps predictable based on the Presidents own record it is reassuring to the mainstream members of the party. The Right can look forward to the steady reform and improvement of the status quo for years to come.
        *finish
    *if centrist_republican = 5
        The Moderate Republicans have maintained their position as the dominant faction in the Republican party.
        *finish
    *if centrist_republican = 4
        The Moderate Republicans have maintained control of a majority of the Republican party at the moment.
        *finish
    *if centrist_republican = 3
        The Moderate Republicans seem to be on the rise in the party and are slowly solidifying their hold of the party leadership.
        *finish
    *if centrist_republican = 2
        The Moderate Republicans have emerged as the most likely to maintain control of the party as a result of the Presidents policies but much is still uncertain and the party's future is still in flux.
        *finish
    *if centrist_republican <= 1
        The President has shown some favoritism for the Moderate Republicans and their policies lets see if it lasts.
        *finish
    *finish
*elseif (part_rep = true ) and ((conservative_republican > liberal_republican) and ( conservative_republican > centrist_republican))
    *if conservative_republican >= 6	
        The Conservative Republicans or Reagenite faction of the Republican party has grown ascendant and is working vigorously to spread the message of the Ford Revolution to the country. The dominant thought on the Right will remain classical liberalism and supply side tax cuts for years to come.
        *finish
    *if conservative_republican = 5
        The Conservative Republicans have emerged for the moment as the dominant faction in the Republican party.
        *finish
    *if conservative_republican = 4
        The Conservative Republicans have gained control of a majority of the Republican party at the moment.
        *finish
    *if conservative_republican = 3
        The Conservative Republicans seem to be on the rise in the party and are slowly gaining control of the party leadership.
        *finish
    *if conservative_republican = 2
        The Conservative Republicans have emerged as the most likely to maintain control of the party as a result of the Presidents policies but much is still uncertain and the party's future is still in flux.
        *finish
    *if conservative_republican <= 1
        The President has shown some favoritism for the Conservative Republicans and their policies lets see if it lasts.
        *finish
    *finish
*else
    The President has favored a variety of ideas and policies and no one wing of the Republican party has grown to dominate it.
    *finish

Yeah just stick a *label next_part after it all and replace your *finish with *goto next_part.

3 Likes

I think you only need six of these *finish. If you’re doing “*if, *if, *if, etc.” you don’t have to put *goto or 'finish or any command that has same effect.

*if part_rep = false
    You have not been informed of your party's status just yet.
    *finish
*elseif (part_rep = true) and ((liberal_republican = centrist_republican) and (conservative_republican = centrist_republican))
    The Republican party is currently riven between it's various factions and its ideological future is uncertain.
    *finish
*elseif (part_rep = true) and ((liberal_republican > conservative_republican) and ( liberal_republican > centrist_republican))
    *if liberal_republican >= 6
        The Liberal Republican or Rockfeller Republican faction of the Republican party is ascendant and is working furiously to rebuild itself now that they have a President back in the White House. From party primaries to vulnerable Liberal Democratic seats the party is slowly preparing to ensure it's brand of progressive conservatism is the ruling philosophy on the Right for foreseeable future.
    *if liberal_republican = 5
        The Liberal Republicans have emerged for the moment as the dominant faction in the Republican party.
    *if liberal_republican = 4
        The Liberal Republicans have gained control of a majority of the Republican party at the moment.
    *if liberal_republican = 3
        The Liberal Republicans seem to be on the rise in the party and are slowly gaining control of the party leadership.
    *if liberal_republican = 2
        The Liberal Republicans have emerged as the most likely to rise as a result of the Presidents policies but much is still uncertain and the party's future is still in flux.
    *if liberal_republican <= 1
        The President has shown some favoritism for the Liberal Republicans and their policies lets seem if it lasts.
    *finish
*elseif (part_rep = true) and ((centrist_republican > conservative_republican) and ( centrist_republican > liberal_republican))
    *if centrist_republican >= 6
        The Moderate Republicans in the Republican party have solidified their hold of the party for the foreseeable future while perhaps predictable based on the Presidents own record it is reassuring to the mainstream members of the party. The Right can look forward to the steady reform and improvement of the status quo for years to come.
    *if centrist_republican = 5
        The Moderate Republicans have maintained their position as the dominant faction in the Republican party.
    *if centrist_republican = 4
        The Moderate Republicans have maintained control of a majority of the Republican party at the moment.
    *if centrist_republican = 3
        The Moderate Republicans seem to be on the rise in the party and are slowly solidifying their hold of the party leadership.
    *if centrist_republican = 2
        The Moderate Republicans have emerged as the most likely to maintain control of the party as a result of the Presidents policies but much is still uncertain and the party's future is still in flux.
    *if centrist_republican <= 1
        The President has shown some favoritism for the Moderate Republicans and their policies lets see if it lasts.
    *finish
*elseif (part_rep = true ) and ((conservative_republican > liberal_republican) and ( conservative_republican > centrist_republican))
    *if conservative_republican >= 6	
        The Conservative Republicans or Reagenite faction of the Republican party has grown ascendant and is working vigorously to spread the message of the Ford Revolution to the country. The dominant thought on the Right will remain classical liberalism and supply side tax cuts for years to come.
    *if conservative_republican = 5
        The Conservative Republicans have emerged for the moment as the dominant faction in the Republican party.
    *if conservative_republican = 4
        The Conservative Republicans have gained control of a majority of the Republican party at the moment.
    *if conservative_republican = 3
        The Conservative Republicans seem to be on the rise in the party and are slowly gaining control of the party leadership.
    *if conservative_republican = 2
        The Conservative Republicans have emerged as the most likely to maintain control of the party as a result of the Presidents policies but much is still uncertain and the party's future is still in flux.
    *if conservative_republican <= 1
        The President has shown some favoritism for the Conservative Republicans and their policies lets see if it lasts.
    *finish
*else
    The President has favored a variety of ideas and policies and no one wing of the Republican party has grown to dominate it.
    *finish
3 Likes

Let me test that out and if that’s true I’ll make it the solution instead.

Edit: Your right, Thanks!

*finish will take you to the next file on the scenes/chapter list. if you want to just go to the next bit of text *goto and *label will do, as mentioned above.
godspeed

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.