I'm relatively new but rather ambitious with the ADRIFT engine, and I've been trying to create a system for generating dynamics descriptions for the player character within my game. I've determined that I should use expressions within the description text box to accomplish this, and I've managed to work around a few of the problems I've had... but they certainly feel like workarounds rather than elegant solutions.
Basically, I've been working with something a bit like this:
- adrift Code: Select all
<# if(%hair_score%=0,"%hair_array[RAND(1,2)]%","") #>
...Which works great! The first variable (hair_score) is used within the game itself, and the array (hair_array) picks one of the descriptions for that specific type of hair when the user calls the character's description. However, the moment I introduce another expression into the description, it only seems to care about the last one; so...
- adrift Code: Select all
<# if(%hair_score%=0,"%hair_array[RAND(1,2)]%","") #>
<# if(%hair_score%=1,"%hair_array[RAND(3,4)]%","") #>
...only seems to return anything the first variable (hair_score) is equal to one. Even more confusing is that when the variable is equal to one, it seems to return the array result twice! I'm guessing that's because the second command overrides the first, which is a bit concerning considering this is just one element in the system I'm trying to implement. If I'm to actually use this in practice, I'm going to need to be able to define several other attributes. I suppose if the variables were different, it wouldn't override?...
Anyway, the workaround I found for this particular instance was the following:
- adrift Code: Select all
<# if(%hair_score%=0,"%hair_array[RAND(1,2)]%","") & if(%hair_score%=1,"%hair_array[RAND(3,4)]%","") #>
This seems to work properly, but doesn't look at all elegant or organized when I'm actually working with the expressions. Trying to format it in a different way seems to screw with how the expression is being read. So basically, I'm wondering if there is a more clean and elegant-looking solution to my problem.
Thanks for reading!

