An Easier Way to Code This

I am not experienced at coding so please bare with me. I’m trying to figure out the best way to code my game without trying to use “goto” or “gosub” a thousand or so times. The general story is completed. There are over a two dozen factions and seven weapons that change the most of the scenes slightly. For these scenes where everything is the same, I need to find the best way to add weapons and factions without creating whole new pages. There are only changes to actions or a few character lines, not any radical scene change per say. I assume it would be unnecessary to create so many pages and that I can change the factions/weapons somehow easily.

I hope I have spoken clearly, it maybe confusing. So I would appreciate any advice that would be helpful. Thanks!

2 Likes

If the changes are big, then If.

If the changes are small, Multireplace may be your best bet.

I’ve posted about multireplace here: Ultimate Noob Coding

Here: Ultimate Noob Coding (story examples)

And here: Code Help? Enableing and or disabling certain texts

I hope that helps!

3 Likes

@LeoXII Thanks, that’s exactly what I needed.

@liszante This makes things a lot easier to understand. It is very well put together, thanks.

Hopefully, this will work. I will give it a try.

You know this statement made me thinking if one could build and save entire PARAGRAPHS dynamically inside variables to spice things without rewrite entire scenes… hmmm.

what was the name of that command that permits one to concatenate two or more words in a variable?

*set full_text ({story_cene}&" ")&{random_scene}

As you arrived to your headquarters your aide said that your fleet have arrived at Highport but was unable to contact their mayor. It's said that ${full_text}. And this is probably the reason.

*fake_choice
  *selectable_if (commerce >= 50) #We already got a number of investments in that port. Lets send help.
    *gosub_scene admin form_expediction

  *selectable_if (commerce < 50)  # Tell them that this is not our place to meddle with their local affairs. Order them to resupply and wait and see what happens.

  #Tell them to replenish their supplies and prepare to sail to a new Port.

(...)

Like that?

1 Like

If you automate normal passages, it’s bound to read robotic, IMO. Unless it’s something like simple description inside a combat system (you slash X, you stab Y, etc.), it’s best to manually write your story.

And yes, concatenation is &

3 Likes

I see. Thanks buddy!

This is a great tip, so only focus in descriptions for random events will keep the strings sufficiently remarkable to the reader wile too much repetition can make things dull or too artificial, right?

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.