TheAlexG

Veteran
Veteran
Joined
Feb 16, 2016
Messages
414
Reaction score
103
First Language
English
Primarily Uses
I'm not the best at explaining things, so I'll do the best I can, and thanks in advance.


So, I was wondering if there was a way to make it so that instead of making text show a specific value, it would instead show a word.


For example:


I know if you put; Hunger: \V[0001], it'll show something like Hunger: 80.


However, is there a way to make it display in a way like "Hunger: Very Hungry" instead of displaying a numerical value?
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,330
Reaction score
9,052
First Language
English
Primarily Uses
RMMV
Not that I'm aware, though that doesn't mean it's impossible. You could set dummy actors with the names of what you wanted displayed and call the actor name, I suppose.


I think what I would do though would be to create some conditional branches, without else statements. So, for example, If Variable = 1, show text "Hunger: Very Hungry"; If Variable = 2, show text "Hunger: Hungry", etc.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,751
Reaction score
8,964
First Language
German
Primarily Uses
RMMV
yes and no - you can store strings, but they need to come from somewhere, and you can't calculate with them anymore.


You have to keep the variable as a number to be able to work with that ingame, but you can use a second variable - one that won't be needed for calculations - to store a string inside, and then use a short conversion code somewhere to give different strings based on original numbers.
 

TheAlexG

Veteran
Veteran
Joined
Feb 16, 2016
Messages
414
Reaction score
103
First Language
English
Primarily Uses
Alright, I think I gotcha. Thanks again.
 

x3Darkie

Villager
Member
Joined
Jan 11, 2014
Messages
9
Reaction score
2
First Language
Chinese
Primarily Uses
Like this:
VeryHungry.jpg
But like Andar said, you can't calculate with them. You're gonna have to manipulate the string with another command.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,330
Reaction score
9,052
First Language
English
Primarily Uses
RMMV
No, that is not what is meant by "Script" there - that is a place to input RGSS3 code, not display text.
 

Sarlecc

Veteran
Veteran
Joined
Sep 16, 2012
Messages
453
Reaction score
211
First Language
English
Primarily Uses
RMMV
Um setting a string to a variable is valid code? Which I think is what @TheAlexG was asking.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,330
Reaction score
9,052
First Language
English
Primarily Uses
RMMV
Okay, I misunderstood what it was saying.


No, actually I don't think I did. OP wanted to know how to display a certain text based on the value of the variable. So, even if it could set the value of a variable equal to the number of letters in a string of text, it's not what they are asking.


However, I don't think just typing the string into the Script section would work. You would need to add a line of code in the Script section, not just a string of text.
 
Last edited by a moderator:

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
734
Reaction score
601
First Language
French
Primarily Uses
Hum. Variables are fully capable of holding strings.


Using the method @x3Darkie showed and a few conditional branches you could very well do a system to have an automated message.


Well I mean it would be almost  the same as using conditionnals and placing a show text command after each hunger text possibilty, just less maintenance if you want to change the message.


You can store anything in a variable using the script command really, whole objects (like windows, actors,...) if you wanted. You have to make the following calculations using the script command after but in that case it's not needed. It's very useful to modify the display without creating a whole plugin for example.


Using control variable script: "very hungry" and then using \V[your_number] will display very hungry. 100% certain, I use it all the time. And unless I completely misunderstood the OP it's indeed what was asked here.
 
Last edited by a moderator:

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,330
Reaction score
9,052
First Language
English
Primarily Uses
RMMV
Okay, wow, well, I just learned something.


I wanted to test out inputting the string of text into the Script line, to see if it would return a value. It actually returned the string of text. So, apparently you can use \V[n] to directly display text. My apologies. Perhaps this is what Andar was saying and I just wasn't getting that?


I had thought you would need a script call or something there, as opposed to just text. Thanks for teaching me something new.
 
Last edited by a moderator:

TheAlexG

Veteran
Veteran
Joined
Feb 16, 2016
Messages
414
Reaction score
103
First Language
English
Primarily Uses
They pretty much have the right of it. I got the basis down, which was a great jumping point. I just need to fix the code, since I'm getting a bit of an error. It'll display Hunger: Very Hungry, and then numerals after as when you move from each area, I have an event in each area adding or decreasing stats. So it's displaying Hunger: Not Hungry5555etc. I just have to figure out what it's doing to stop it. XP
 

x3Darkie

Villager
Member
Joined
Jan 11, 2014
Messages
9
Reaction score
2
First Language
Chinese
Primarily Uses
As previously mentioned, you can't do calculations with strings. What you can do instead is to hold the string in a different variable. Say variable 2. So you'd have variable 1 to hold the hunger value, and variable 2 to hold the string and use that to display your text. And make a common event with conditional branches for each stage of hunger. At >80 variable 1, set variable 2 to "Very Hungry," and so on and so forth.

I have no idea what you're trying to do with this as I don't have the context, but if you don't want to use a second variable to hold the text, you may as well just simply use conditional branches to read the hunger stage. This method is only really useful when you're working with multiple conditions dialogues or texts. I managed to shaved off an entire nest of conditional branches of texts using this method.

Oh, and for the record, I found out you can hold a string in a variable in one of the older threads in the VX Ace subforums, so I wasn't the one who figured this out in the first place.
 
Last edited by a moderator:

TheAlexG

Veteran
Veteran
Joined
Feb 16, 2016
Messages
414
Reaction score
103
First Language
English
Primarily Uses
Basically, I'm trying to make a journal that reads off various stats. I tried doing this as a whole page, with Yanfly's Message Core plugin, but each time I use an if statement, it counts as a new page. So I have to get them to read stats on a whole page, while also counting it as one page. Numbers work fine, but when you're trying to use anything else, it starts to get wonky.


None the less, I think I have it working, so thanks.
 

Latest Threads

Latest Profile Posts

Ugh, can't decide what to make next!
The Dystopia
ikW0BYF.png
Recently got RPG Maker MZ. A bit slower with my current PC but I will be getting a new one soon.
evening progress; pretty happy where this is at so i'll take the rest of the night to myself =w=
5NJGyKY.png
It would seem learning JS is not a know it all for making plugins. While it has enabled me to understand what I'm looking at, I still have to find the relevant information in the core scripts. This is much harder than learning JS IMO.

Forum statistics

Threads
118,403
Messages
1,115,673
Members
155,343
Latest member
sograyish
Top