Text Variable Bug?

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.
MOGz
Posts: 23
Joined: Sun Oct 13, 2019 12:41 am

Text Variable Bug?

Post by MOGz »

Well I didn't expect to be making a new post so soon after my first!

i have been working on compiling Text Array lists for use as a general feature randomizer. "Character A has %color% %hair%" as an example, where both variables would output hair color and style when called in a given text box or conversation. I have the variables set to Text Arrays, which is how I understand them to work when used for that function. And here is where the problem arises:

When inspected in the runner, the text reads as "Character A has %color% %hair%." NOT as "Character A has auburn pigtails" or whatever else would be in the Text Array.

I have tried numerous ways to get around this based on the Wiki, manual, and topics here, which incude:

Writing it as %NumberAsText[%hair%]% <----This gives me text that reads "zero" where "pigtails" should show.
Writing it as %hair[RAND(1,10)]% <----This gets me the text exactly the way it shows here.
Writing it as %hair[RAND(1,%ArrayVariable%)]% <----This also gives me the text exactly the way it is shown here.

I *have* had success with the alternative (which I wanted to avoid as it would be more tedious), which is to use <# oneof (Hair A, Hair B, Hair C, etc) #>. While I could do this, it will certainly bog down the process for what I am wanting to do.

So, are those previous forms obsolete and/or no longer functioning?
Am I using them wrong?
Am I crazy?
Is there a more efficient way to accomplish this which excludes creating a bazillion properties as well?
David Whyld
Posts: 7018
Joined: Sat Dec 18, 2004 5:15 pm
Points: 35
Location: United Kingdom

Re: Text Variable Bug?

Post by David Whyld »

Try not ticking the "variable is an array" box. When I tick just the "text" box, I get it to display as "Bob has red hair".
User avatar
Lumin
Posts: 2278
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Text Variable Bug?

Post by Lumin »

RAND drawing from an array works for me.

Image
User avatar
Lumin
Posts: 2278
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Text Variable Bug?

Post by Lumin »

If you still can't get it working, you can always attach an example file to a post for us to take a look at.

edit: Huh, now I'm having trouble myself. The example I screenshotted works fine, but I tried to have the game set the variables with a task action and I'm having %eyes% and so on just show up in the description too.

A single variable is no problem, it's drawing from the list that I'm having trouble with.

Image

I can only assume the issue is the middle box as I have no idea what should go there, and it's only there when you're using an array.
Last edited by Lumin on Mon Feb 10, 2020 1:17 am, edited 1 time in total.
User avatar
Lumin
Posts: 2278
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Text Variable Bug?

Post by Lumin »

Okay, Maz suggested a workaround in the Discord and I just tested it. It needs a few extra steps but it does work.

In addition to %eyes%, make a regular integer variable called %eyesRNG%. Do another one for hair and whatever else you want to set.

Set it to be a random number in whatever the range of options in the %eyes% array is, and in the description do this:

Image

Which happily, did work with a System task set to trigger immediately:

Image
The0didactus
Posts: 307
Joined: Sun Mar 30, 2014 9:20 pm
Points: 150

Re: Text Variable Bug?

Post by The0didactus »

I can confirm that Maz and Miz's solution is how I usually do this.
User avatar
Lumin
Posts: 2278
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Text Variable Bug?

Post by Lumin »

The0didactus wrote:I can confirm that Maz and Miz's solution is how I usually do this.
Shhh I'm Lumin here.

....i can see how this might be a thing that starts to turn confusing though as I reap the rewards of my long con of pretending to like CYOAs and start bringing more CYS people over. I may have to make a Mizal account. Probably would be better to publish games under that name anyway.
The0didactus
Posts: 307
Joined: Sun Mar 30, 2014 9:20 pm
Points: 150

Re: Text Variable Bug?

Post by The0didactus »

I can confirm that victoria and alphonse's solution is how I usually do this
MOGz
Posts: 23
Joined: Sun Oct 13, 2019 12:41 am

Re: Text Variable Bug?

Post by MOGz »

OK, so I made a file that exemplifies the issue I am facing. Using all the input here I put in the suggestions as well as the problem I have been facing. I attempted the unflag the Array setting suggestion, but it didn't do anything except delete out all the extra lines of text, so it is not included.

When I run this it just pulls up the issue as I have explained.
Attachments
Testfor Variable (hair).taf
(17.81 KiB) Downloaded 75 times
MOGz
Posts: 23
Joined: Sun Oct 13, 2019 12:41 am

Re: Text Variable Bug?

Post by MOGz »

For further context, this is what is displayed in my runner when I use the task I created (The same will display for me when I use examine on the character used in the example):
Attachments
Screenshot (2).png
Screenshot (2).png (49.54 KiB) Viewed 1117 times
User avatar
Denk
Posts: 739
Joined: Mon Feb 22, 2016 6:21 pm
Points: 291
Location: Hjørring, Denmark

Re: Text Variable Bug?

Post by Denk »

Note that variable names are case sensitive. In you "testfor hair" task, you have written "hair" everywhere instead of "Hair".

I added the following text to your "testfor hair" task and it works:

Code: Select all

CORRECT SYNTAX: The woman has %Hair[RAND(1,6)]% hair  
(note that it is important to write "Hair", not "hair", i.e. case sensitive)
It is important that "Hair" is an array for this to work like this.
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
User avatar
Lumin
Posts: 2278
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Text Variable Bug?

Post by Lumin »

Yeah if you unchecked the array, that's you telling it you only want the variable to store one thing instead of several.

When I'm back at my computer I'll give you a sample of the %eyesRNG% thing in a file, it may be easier when you can mess with it yourself.

I'm assuming that what you want is something that sets all the randomized elements at the beginning of the game.

%Hair[RAND(1,6)]% will work Denk said, but it will change it ever time you look at her.
MOGz
Posts: 23
Joined: Sun Oct 13, 2019 12:41 am

Re: Text Variable Bug?

Post by MOGz »

I checked with the alteration of case sensitivity for the variables. when entering %Hair% (Case sensitive) it turns up nothing new (Just reads as "The woman has %Hair% hair." as before), but the randomizers worked effectively (using the RAND function as well as the HairRNG as per Lumin's suggestion).

I wasn't aware that case sensitivity was the issue, which probably explains everything. I am unsure if that was explicitly stated somewhere on the Help Manual or the Wiki, or just implied in context, but otherwise yes it seems to work. Curse me and my penchant for capitalizing things for mental organization purposes.

Thanks Denk. I will report if I have any further issues.

Edit:
Tinkering a bit, the problem seems to be in that not all variables require case sensitivity, just arrays. I set up a few regular text variables and it doesn't seem to care whether I type %Variable% or %variable% (difference in the case sensitivity of the first letter) in text boxes, they show up fine either way. But if the variable is an array, THEN it becomes a problem.

Strange, but not impossible to work with.
Last edited by MOGz on Mon Oct 14, 2019 9:16 pm, edited 1 time in total.
MOGz
Posts: 23
Joined: Sun Oct 13, 2019 12:41 am

Re: Text Variable Bug?

Post by MOGz »

@Lumin, that would be a good thing to have, but I can figure out how to store the info (I think) using another Text variable. Something like a task that says [set][hairstore]= %Hair[RAND(1,6)]% or something, then have the task only run once at a certain time when certain conditions are met. Examine perhaps? I would have to play around with that, and it seems like a good way to create playthrough specific unqiue NPC's. How much practical purpose that has... *shrug*

but the usage I am thinking of is to create an array of emotive features. Smiling, laughing, thinking, stuff like that. That way in conversation the same query or conversation would have some variability, but not in a way that would be exhaustive to create.

An example would be:

Harold smiles and turns to you, saying "Let me be honest with you."

So in this example, using variables, I can create an expression array that would be:
"smiles reassuringly"
"grins enthusiastically"
"glowers menacingly"

Which would give 3 very different (and exaggerated here for purposes of the example) versions of the same conversation:

Harold smiles reassuringly and turns to you, saying "Let me be honest with you."
Harold grins enthusiastically and turns to you, saying "Let me be honest with you."
Harold glowers menacingly and turns to you, saying "Let me be honest with you."

That gives different feels to the same conversation. And, if I do not want to use the "glower" expression, I am sure I can sort it out using alternative functions. Either one which calls "smile" or one which sorts either of two options from my list.
User avatar
Lumin
Posts: 2278
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Text Variable Bug?

Post by Lumin »

Case sensitivity still doesn't explain the issue I was having with just directly the setting text variables. I used lower cased %eyes% each time and even Theo just has to use the workaround method. I wonder if that's a bug.
Post Reply