From af22d38ebd86bacac52b1b6728d12e08f8d5a953 Mon Sep 17 00:00:00 2001 From: Vamist Date: Thu, 10 Dec 2020 00:05:22 +0000 Subject: [PATCH] Semi working emote token --- CoreScripts/Character/BlobCharacter.as | 35 +++++++++++++++++++++--- CoreScripts/Character/Configs/knight.cfg | 4 +-- Maps/CommonScripts/MapsCore.as | 2 -- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/CoreScripts/Character/BlobCharacter.as b/CoreScripts/Character/BlobCharacter.as index 666f36e..6318209 100644 --- a/CoreScripts/Character/BlobCharacter.as +++ b/CoreScripts/Character/BlobCharacter.as @@ -1,5 +1,7 @@ //#include "CharacterCore" +#include "EmotesCommon" + int SCREEN_HEIGHT = 0; int SCREEN_WIDTH = 0; @@ -69,18 +71,42 @@ mixin class Character // Grab the full token so users dont see a part of it when reading if (char == '$') { + string insides = ""; + string charAfterExit = ""; for (int a = CurrentRenderText.length + 1; a < CurrentText.length; a++) { string currentchar = CurrentText.substr(a, 1); - char += currentchar; - - if (currentchar == "$") + + if (currentchar == "$") { // Add in the next char so adding a token doesnt waste a text update - char += CurrentText.substr(a + 1, 1); + charAfterExit = CurrentText.substr(a + 1, 1); break; } + + insides += currentchar; + } + + string action = insides.substr(0, 2); + string content = insides.substr(2, insides.length); + + if (action == "E_") + { + char = ""; + set_emote(OwnerBlob, Emotes::names.find(content)); } + else if (action == "K_") + { + char = ""; + // TODO set next text + + } + else + { + char += action + "$"; + } + + char += charAfterExit; } else if (char != ' ') // TODO -> Set custom audio and sort out what we are doing with audio { @@ -89,6 +115,7 @@ mixin class Character CurrentRenderText += char; + // Need to fix (tokens excluding colours will make this invalid) if (CurrentRenderText.length == CurrentText.length) FinishedWriting = true; } diff --git a/CoreScripts/Character/Configs/knight.cfg b/CoreScripts/Character/Configs/knight.cfg index 4977e0e..68c5247 100644 --- a/CoreScripts/Character/Configs/knight.cfg +++ b/CoreScripts/Character/Configs/knight.cfg @@ -1,9 +1,9 @@ # First response, is not required -main = Hello world! +main = Hello world! $E_smile$ # Keys, list every other reponse in the config file (add in ; in between each key) keys = next;ok # A response -next = wow thats even more cool isnt it!! +next = wow thats even more cool isnt it!! {ok} ok = i think so diff --git a/Maps/CommonScripts/MapsCore.as b/Maps/CommonScripts/MapsCore.as index cec5dfb..34ac0ab 100644 --- a/Maps/CommonScripts/MapsCore.as +++ b/Maps/CommonScripts/MapsCore.as @@ -94,8 +94,6 @@ BlobCharacter@ addCharacterToBlob(CBlob@ blob, string &in characterName, string BlobCharacter@ character = BlobCharacter(blob, characterName); character.LoadTextConfig(textFile); - - //owner.set("character", character); character.PushToGlobalHandler(); return character; -- knotmirror 0.0.1