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
Points: 10

Re: Text Variable Bug?

Post by MOGz »

I think I figured out your problem Lumin. Looking at the wiki I browsed the Actions entry, which explained the variables.

The way it says variable arrays are utilized there is that the extra box sets the variable to the value you want to replace. So, if say, you have a text variable that is for eyes:

%eyes%
Brown
Blue
Hazel
Green

Then you use the task action to [set][%eyes%][3]=[RAND(1,4)]

Then it will just change the entry for "hazel" to read "RAND(1,4)" (hazel is the third entry, and the action told it to replace the third entry with your text).

Hence, if you get a different randomizer to work, then what will happen is every now and then, %eyes% will read "RAND(1,4)" instead of a color.

The better work around would be as discussed earlier (using text boxes to output the randomized entry...using correct case sensitivity) OR have a separate output variable, in this case a text variable (not an array). We will call this one %eyescall%

So, if you wanted to use the task action to set a variable, you would instead have it like this:

[Set][%eyescall%]=[%eyes[RAND(1,4)]%]

That will set %eyescall% to the random output originally run by that task action. So then you just need to have %eyescall% in a text box.

Should be fixed.
User avatar
Lumin
Posts: 2319
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Text Variable Bug?

Post by Lumin »

Glad to have the meaning of the mystery box cleared up. It's a shame there's no way to just randomize what line of the array it draws from when it's simple enough in anything not using a task.

I'll just stick with the other method that Maz worked out if I ever need something like that I suppose. It's not especially difficult, just extra work. Thanks MOGz....I hope you got things all figured out for your own game now in the process of figuring this out for me.
MOGz
Posts: 23
Joined: Sun Oct 13, 2019 12:41 am
Points: 10

Re: Text Variable Bug?

Post by MOGz »

It was a mutually beneficial endeavor. I was curious myself.

I can see some good functionality for that box on the set variable menu. It can allow unlockable content options in a variable array. So, say, for instance, that you want to set up a basic array of conversation topic responses in a randomizer (This seems like one of the most obvious ways for this to be used, though certainly there are others that could be considered). Our array will be called %convoA% for simplicity's sake, and let's make it be about flowers.

The Text Array will contain:
"I like red flowers ok I guess."
"Yellow flowers smell alright."
"Blue flowers give me allergies!"
"I really dislike purple flowers for some reason."

So in the character's conversation text box, however you get to this (YMMV), you set up your randomizer: %convoA[RAND(1,4)]% which gives the output of those 4 options.

Now there are several ways to use the Task Action to make use of this:

A) You create "dummies" in your original array. Make a duplicate of 2 of the other options like so:

"I like red flowers ok I guess."
"I like red flowers ok I guess."
"Yellow flowers smell alright."
"Yellow flowers smell alright."
"Blue flowers give me allergies!"
"I really dislike purple flowers for some reason."

Note how there are now 6 options, so your original randomizer has to include the variables (1,6)

Then, when a later event in the game would open up a different option (Let us say that the character picks up an orange flower, which triggers our task somehow), you run the task to do the following:
[set][%convoA%][2]=["I like orange flowers the best!"]

You could run this action 2 times to set both the second and third input in the randomizer to "I like orange flowers the best!", which could be used as an internal clue to the player that giving the NPC the orange flower might do something important (having two copies on the menu just makes that option more likely to appear in the randomizer, so it does indicate how important it is to the character).

there are other ways of doing the same thing, but this is one option, and the more ways to accomplish a task allows for more diverse minds to make use of the system.

B) You can also use the action to replace a variable for a more urgent response if certain conditions are met. Say your character is holding a blue flower. then you run your task action as follows (using only the initial 4 outputs in the Text Array):
[set][%convoA%][3]=["Is that a blue flower! keep it away! WAAAH!"]

This will replace the third response on the initial first list so that if the randomizer is called, you can allow it to show his displeasure with you holding the blue flower. Humorous and a bit more in depth for a randomized conversation.

now, how often a person *needs* to do this is up to their tastes. But it is there at least.
User avatar
DazaKiwi
Posts: 826
Joined: Thu Oct 21, 2010 10:05 am
Points: 61
Location: New Zealand

Re: Text Variable Bug?

Post by DazaKiwi »

Since it seems you aren't wanting to keep the random variations locked? you could just use..Her eyes were <#oneOf("red", "Brown","Blue","Hazel","Green")#>. And this will randomly choose one each time it is displayed. This is called an expression and is placed directly in the message output area. You just have to watch you have the syntax correct especially with the
"" as if you miss one it can through an error like when you have lots of full sentences and miss one ".
MOGz
Posts: 23
Joined: Sun Oct 13, 2019 12:41 am
Points: 10

Re: Text Variable Bug?

Post by MOGz »

One of functions are an option I have explored, but while they work very well in some places, they are tedious in others.

The way I have been seeing this work is that while variables work well to create numeric character traits for any given function, Properties accomplish that goal more elegantly and cover more characters.

Similarly, variables seem to offer a lot of functionality in hitting a wide spectrum of fluid options, while one of expressions work for specific cases.
User avatar
Lumin
Posts: 2319
Joined: Fri Aug 06, 2004 6:48 pm
Points: 54

Re: Text Variable Bug?

Post by Lumin »

I just woke up at 5am with the realization I can do what I originally intended without much fuss or using the extra step. Like the Script Fairy sprinkled me with idea dust in the night.

Just set all instances of %eyes% to %eyes[1]% in the description boxes, then when setting from a task, set 1 to a random number in the array.

I should've realized this reading MOGz' post last night, but I was half asleep.
Post Reply