Skip to content

Commit

Permalink
[Fix] Swap [next] and [nextthisnow] usage
Browse files Browse the repository at this point in the history
  • Loading branch information
RhenaudTheLukark committed Apr 7, 2024
1 parent 6f68adc commit d1d6ad9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 6 additions & 3 deletions Assets/Scripts/Text/TextManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,9 @@ protected virtual void Update() {
if (!HandleShowLetter(ref soundPlayed, ref lastLetter))
break;

if (letterTimer < timePerLetter)
break;

if (!firstChar)
letterTimer -= timePerLetter;
else {
Expand Down Expand Up @@ -922,7 +925,7 @@ private bool HandleShowLetter(ref bool soundPlayed, ref int lastLetter, bool fro
currentReferenceCharacter++;
}

if (!string.IsNullOrEmpty(GetVoice()) && !muted && !soundPlayed && (GlobalControls.retroMode || textQueue[currentLine].Text[currentCharacter] != ' ')) {
if (!string.IsNullOrEmpty(GetVoice()) && !muted && !soundPlayed && (GlobalControls.retroMode || (currentCharacter < textQueue[currentLine].Text.Length && textQueue[currentLine].Text[currentCharacter] != ' '))) {
soundPlayed = true;
try { UnitaleUtil.PlayVoice("BubbleSound", GetVoice()); }
catch (CYFException e) { UnitaleUtil.DisplayLuaError("Playing a voice", e.Message); }
Expand Down Expand Up @@ -1067,9 +1070,9 @@ private void InUpdateControlCommand(DynValue command, int index = 0) {
break;

case "novoice": commandVoice = "none"; break;
case "next": autoSkip = true; break;
case "next": autoSkipAll = true; break;
case "finished": skippableToNextLine = true; break;
case "nextthisnow": autoSkipAll = true; break;
case "nextthisnow": autoSkip = true; break;
case "speed":
try {
//you can only set text speed to a number >= 0
Expand Down
8 changes: 5 additions & 3 deletions Documentation CYF 1.0/pages/api-text.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ <h3>Inline commands</h3><br>

<p class="exblock">
<br><span class="function">[next]</span>
Skips to the next dialogue of the current monster only, even if several monsters are speaking, effectively desyncing their text.
Skips to the next line of the current text object automatically.
If used in a monster's text object, skipe the dialogue of all monsters, without concern for the other monsters' dialogue's state.
You can also use this for textbox trickery.
Here's an example to replicate Flowey's text-changing effect if you dodge the Friendliness Pellets(tm) twice.
</p>
Expand All @@ -283,8 +284,9 @@ <h3>Inline commands</h3><br>

<p class="exblock">
<br><span class="function"><span class="CYF"></span> [nextthisnow]</span>
Skips to the next dialogue of all monsters automatically, without concern for the other monsters' dialogue's state.
It acts much like <span class="term">[next]</span> except it affects all monsters.
Skips to the next dialogue of the current monster only, even if several monsters are speaking, effectively desyncing their text.
It acts like <span class="term">[next]</span> outside of monster text objects, its only difference is that it only affects the current monster
if used on a monster's text object.
</p>

<p class="exblock">
Expand Down

0 comments on commit d1d6ad9

Please sign in to comment.