Updates in 8.0 mess up your Brackets. (HOW to FIX.)

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Post Reply
Message
Author
Rinzai Gigen
Newbie
Posts: 4
Joined: Tue Jul 21, 2020 11:38 pm
itch: rinzai-gigen.itch.io
Discord: Rinzai Gigen.#3371
Contact:

Updates in 8.0 mess up your Brackets. (HOW to FIX.)

#1 Post by Rinzai Gigen »

As many of you know by now, the recent versions of the ren'py program, prior to the 8.0 release which we were all but forced to download, had been flexible in how we use square brackets. Placing text in "[" and "]" would be unlikely to disrupt your code, although it might not always look the way you want it to, unless you know what you are doing. To be more specific, there were three scenarios available, depending on the format of the quotes:

Scenario the First: (Let's call this "Situation A".) In this case, that which is contained within the brackets is the name of an established variable "PIE".

The text appears, in code, as follows:

Code: Select all

"Let's all have some [PIE]."
(Example 1.)

In this scenario, this text would follow yet another line of code which would define the terms:

Code: Select all

"$ PIE = "Cherry Pie"
(Example 2.)

The outcome would appear in-game as:

"Let's all have some Cherry Pie." (Example 3.)

The brackets would thus vanish from the player's P.O.V. and, in the place of what was nested in them, we would see the value that had been assigned to "PIE" (the variable's name).

Yet this was not the limit of the program's capabilities, back then, at least.

Scenario the Second: ("Situation B".) In this case, let's suppose that "PIE" is not defined. How would the aforementioned text appear, as programmed in Example 1?

It would have looked as follows:

"Let's all have some [PIE]." (Example 4.)

Now, that may not look very pretty, but it has its use. For instance, let's suppose I want for brackets to appear in-game. How would I code this? Easy:

Code: Select all

"[RINZAI eyes the PIE with RELISH and DESIRE most perverse.]"
(Example 5.)

Now, how would this appear before the player? But exactly as I wrote it!!

"[RINZAI eyes the PIE with RELISH and DESIRE most perverse.]" (Example 6.)

Convenient.

Scenario the Third: Let's call this "Situation C". In this case, let's suppose I want to make a statement that's in brackets, but I also wish for such a statement to contain a value "PIE".

At first, of course, I'd have to make this "PIE" defined, as in Example 2 above. Yet then I'd be inclined, were I a novice, to produce as follows:

Code: Select all

"[RINZAI eyes the [PIE] with RELISH and DESIRE most perverse.]"
(Example 7.)

This would disappoint me when I'd see that it appears exactly as I coded it, not as I meant it:

"[RINZAI eyes the [PIE] with RELISH and DESIRE most perverse.]" (Example 8.)

The fix was simple, though. By adding one more open bracket to the first, I could allow for both the Situations A and B to coexist. So:

Code: Select all

"[[RINZAI eyes the [PIE] with RELISH and DESIRE most perverse.]"
(Example 9.)

... would then appear as:

"[RINZAI eyes the Cherry Pie with RELISH and DESIRE most perverse.]" (Example 10.)

The double-bracket "[[" would resolve the issue, and it would appear as just ONE bracket in the final version of the text. The function of the double-bracket would be to distinguish brackets that were meant for the enjoyment of the reader from those brackets meant for the translation of the code from "[PIE]" to "Cherry Pie".

= = == === ===== ======== ALAS!! NO MORE. = = == === ===== ========

In ren'py 8.0, the Situation B scenario is utterly impossible. If "PIE" is not defined, then "[PIE]" becomes invalid. So, Example 1, without the advent of Example 2, would NOT appear as text (Example 4) but rather as an ERROR MESSAGE.

Only by resolving the discrepancy with double-brackets can we hope to salvage ANY text wherein the brackets do not corresponds to variables.

Code: Select all

"Let's all have some [[PIE]."
(11.)

... is thus necessary to produce this:

"Let's all have some [PIE]." (Example 4.)

How does one fix, then, all the damage that was done?

With patience and a steady hand:

1. Type "[" in the "Find" Bar of your Atom, and then type the "[[" in "Replace".
2. Select the "Find" Bar and press ENTER to select a bracket that appears within your code.
3. Now,
a. if the bracket is stylistic (Situation B) instead of meant to call a variable value (Situation A), hit TAB to switch to the "Replace" Bar, then hit ENTER.
b. Otherwise, hit ENTER from the "Find" Bar to proceed to the next bracket.
4. Use the TAB key in this fashion to switch back and forth between the "Find" Bar and "Replace" Bar, using ENTER in the "Find" to skip and ENTER in "Replace" to make a double-bracket, as appropriate.

My Novel, in its current draft, contains a whopping 1697 open brackets. Editing the script took less than 20 minutes, by this method.

I hope all of you recover what you've lost.

Sincerely, Rinzai.

P.S.: ren'py, for the love of God, please let us keep your early versions. Some of us don't want your flashy and newfangled updates, and it's not because we're dinosaurs; we're still alive, and we would like to keep the projects we have started from extinction, too. <3

Post Reply

Who is online

Users browsing this forum: No registered users