How to display variable as text

Hi, I want a time system in my game split into Morning, Noon, and Night. When searching how to display variables as text i found this code: $gameVariables.setValue([variable],"[text]"). But when applying to my game it crashes (variable 2 is the time), $gameVariables.setValue(2,"Morning").
The error is a SyntaxError, with the message of Invalid or unexpected token. I tried to read the console but I sadly cannot understand any of it
It also hopefully shouldn't be due to any of my plugins, I turned off all the ones I added.
Any help is appreciated and sorry for posting after posting yesterday.
Thank you.

Here's the actual event and console as well:
Not sure of a native way of doing it, but yanfly's message core allows you to do this easily.
If you were running that as a line of code in a plugin it would work, but the error is because you're running it from a Script event command.

The contents of a Script box are parsed as a string already encapsulated in quotes, which is then passed to eval(). If you have quotes inside of that, it will be read as closing the string and everything after that is invalid code.

Put 'Morning' inside single quotes.

Not sure of a native way of doing it, but yanfly's message core allows you to do this easily.
I don't see anything in the Message Core that allows you to store a string in a variable. Am I missing something?
copy pasted what was provided and it worked. not sure what might be happening here if all the plugins are off

Not sure of a native way of doing it
the in-editor control variable event lets you do it with the script field if you pass it as a string. no need for a plugin to do that

1715484927223.png

1715484938226.png
copy pasted what was provided and it worked. not sure what might be happening here if all the plugins are off
Curious! I didn't actually try making the event - I ran it as an eval() and got an error, so I assumed that was the issue.

But I also just put it into an event and it worked fine for me...so I dunno what's going on for the OP.
There should NOT be any problem with the code.
Even I've tried recreating everything in your event and there's no problem.
I've done this type of eventing many times, so if something went wrong it SHOULD be something else.
IDK, is there another parallel event running over there?
By the way, you can also set variables to text in the event command, as in the screenshot below.

Screenshot.png
you want to show today time as "morning","Noon","Night"?
I assume you have the var for time.. You want to show the text? or perhaps an icon?
if you want to show only icon on right corner.. You can use common event logic if kinda complex like the word need to save on variable.

fyi.. can you describe what you wanted? perhaps you don't need save the word on variable.. You just need to trigger the time and show up the text

Original thread: https://forums.rpgmakerweb.com/threads/how-to-display-variable-as-text.168590/