From 38729dccffb427e316d3efad82b32e8f27edb022 Mon Sep 17 00:00:00 2001 From: Vamist Date: Thu, 10 Dec 2020 15:54:26 +0000 Subject: [PATCH] Added speed token --- CoreScripts/Character/BlobCharacter.as | 31 ++++++++++++++++++------ CoreScripts/Character/Configs/knight.cfg | 2 +- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/CoreScripts/Character/BlobCharacter.as b/CoreScripts/Character/BlobCharacter.as index f6aa303..bbbaeff 100644 --- a/CoreScripts/Character/BlobCharacter.as +++ b/CoreScripts/Character/BlobCharacter.as @@ -83,8 +83,12 @@ mixin class Character chars += currentChar; if (currentChar == "$") { - // Add in the next char so adding a token doesnt waste a text update - chars = CurrentText.substr(a + 1, 1); + string temp = CurrentText.substr(a + 1, 1); + if (isSpecialChar(temp)) + chars = ""; + else + chars = temp; + break; } } @@ -93,7 +97,7 @@ mixin class Character { // TODO -> Make more pretty string insides = ""; - string charAfterExit = ""; + for (int a = TextRenderLength + 1; a < CurrentText.length; a++) { string currentChar = CurrentText.substr(a, 1); @@ -101,7 +105,12 @@ mixin class Character if (currentChar == "}") { // Add in the next char so adding a token doesnt waste a text update - charAfterExit = CurrentText.substr(a + 1, 1); + string temp = CurrentText.substr(a + 1, 1); + if (isSpecialChar(temp)) + chars = ""; + else + chars = temp; + break; } @@ -113,17 +122,17 @@ mixin class Character if (action == "E_") { - chars = ""; set_emote(OwnerBlob, Emotes::names.find(content)); } + else if (action == "S_") + { + WriteSpeed = parseInt(content); + } else if (action == "K_") { - chars = ""; - // TODO set next text } TextRenderLength += 2 + action.length + content.length; - chars += charAfterExit; } else if (chars != ' ') // TODO -> Set custom audio and sort out what we are doing with audio { @@ -139,6 +148,12 @@ mixin class Character } } + + bool isSpecialChar(string input) + { + return (input == "{" || input == "}" || input == "$"); + } + void ResetText() { CurrentRenderOutput = ""; diff --git a/CoreScripts/Character/Configs/knight.cfg b/CoreScripts/Character/Configs/knight.cfg index 466a77a..664081f 100644 --- a/CoreScripts/Character/Configs/knight.cfg +++ b/CoreScripts/Character/Configs/knight.cfg @@ -1,5 +1,5 @@ # First response, is not required -main = {E_smile}Hello world! Second emote is a heart{E_heart}. +main = Now we{S_15}....{S_1}{E_heart}Kiss! # Keys, list every other reponse in the config file (add in ; in between each key) keys = next;ok -- knotmirror 0.0.1