if you don't mind trying to use a Script Dictionary Attribute instead of a String List Attribute, it'd be an "easy" (riiight) way to do this stuff, as a Script Dictionary Attribute allows you to add Scripts (you'd use the 'msg' Script for your responses, and after that Script you can have your Boolean Attribute setting Script, and then an 'if' Script to check the Boolean Attribute, with Scripts for each condition, boolean = true vs boolean = false, though I think you'd have to do the randomization-selection of your responses a bit differently in code design, as I don't think dictionaries also have index numbers ~ I could be wrong):
Conceptually, a Script Dictionary Attribute:
key item 1: evil_wizard
value 1A: (whatever script)
value 1B: (whatever script)
value 1etc: (whatever script)
key item 2: dragon_slaying_sword
value 2A: (whatever script)
value 2B: (whatever script)
value 2etc: (whatever script)
key item 3: dragon
value 3A: (whatever script)
value 3B: (whatever script)
value 3etc: (whatever script)
key item 4: king
value 4A: (whatever script)
value 4B: (whatever script)
value 4etc: (whatever script)
key item 5: princess
value 5A: (whatever script)
value 5B: (whatever script)
value 5etc: (whatever script)
item key X: whatever
value XA: (whatever script)
value XB: (whatever script)
value Xetc: (whatever script)
instead of a stringlist using index~position numbers for its items, you use actual words~strings, so if "evil_wizard" is selected, you'd do all of its values (added scripts), if "dragon_slaying_sword" is selected, you'd do all of its values (scripts), etc etc etc
A stringlist is stuck to using just strings (a limited msg script only), whereas a scriptdictionary you can use scripts (which means you can do ANY script: a 'msg' Script, a 'set a variable or attribute' Script, an 'if' Script, and etc, AND as many scripts as you want too).
Conceptually a String List Attribute:
(the index, number ~ position, starts from: the first added item to your list if using the GUI~Editor ===or=== the leftmost item in your list if doing it in code)
key (index number~position): 0
value (string): (whatever phrase: a word or sentence or paragraph)
key (index number~position): 1
value (string): (whatever phrase: a word or sentence or paragraph)
key (index number~position): 2
value (string): (whatever phrase: a word or sentence or paragraph)
key (index number~position): #etc
value (string): (whatever phrase: a word or sentence or paragraph)
----------------------------
(you still want to have a stringlist of, to hold~store, your responses, but we'll be using a scriptdictionary for adding in our scripts)
------------------------------
(a very complex-advance example, lol - sorry this interested me, so I tried to make it as powerful as I could in my limited ability)
<command name="npc_response_command">
<pattern>response #object#</pattern>
<script>
if (ListContains (global_data_object.npc_response_list, object.name)) {
invoke (global_data_object.npc_selection_dictionary, object.name)
} else {
msg ("Your inputted object is not an npc or it is not an npc that can respond to you")
}
</script>
<unresolved>Your input is not a visable object, or is not an existing object in the game</unresolved>
</command>
<object name="global_data_object">
<npc_response_list type="stringlist">
<value>npc1</value>
<value>npc2</value>
// etc npcs
</npc_response_list>
<npc1_response_list type="stringlist">
<value>hi, how are you?</value>
<value>goodbye, have a nice day.</value>
// etc
</npc1_response_list>
<npc2_response_list type="stringlist">
<value>what time is it?</value>
<value>what day is it?</value>
// etc
</npc2_response_list>
// etc npcX response stringlists
<npc_selection_dictionary type="scriptdictionary">
<item key="npc1">
random_selection = GetRandomInt (0, ListCount (global_data_object.npc1_response_list) - 1)
invoke (StringListItem (global_data_object.npc1_response_list, random_selection))
invoke (ScriptDictionaryItem (global_data_object.npc1_response_dictionary, random_selection))
</item>
<item key="npc2">
random_selection = GetRandomInt (0, ListCount (global_data_object.npc2_response_list) - 1)
invoke (StringListItem (global_data_object.npc2_response_list, random_selection))
invoke (ScriptDictionaryItem (global_data_object.npc2_response_dictionary, random_selection))
</item>
// etc etc etc
</npc_selection_dictionary>
<npc1_response_dictionary type="scriptdictionary">
<item key="0">
// script that sets your flag Attribute for response '0', so, for this example, let's say: SetObjectFlagOn (npc1, "hi_boolean_flag")
// actually, with this design, you really don't need to set a flag attribute, you can just add your desired script (your script that runs when: as if we were using a boolean flag and its set to true) right here
</item>
<item key="1">
// script that sets your flag Attribute for response '1', so, for this example, let's say: SetObjectFlagOn (npc1, "bye_boolean_flag")
// actually, with this design, you really don't need to set a flag attribute, you can just add your desired script (your script that runs when: as if we were using a boolean flag and its set to true) right here
</item>
// etc etc etc
</npc1_response_dictionary>
<npc2_response_dictionary type="scriptdictionary">
<item key="0">
// script that sets your flag Attribute for response '0', so, for this example, let's say: SetObjectFlagOn (npc2, "time_boolean_flag")
</item>
<item key="1">
// script that sets your flag Attribute for response '1', so, for this example, let's say: SetObjectFlagOn (npc2, "day_boolean_flag")
</item>
// etc etc etc
</npc2_response_dictionary>
// etc npcX response dictionaries
</object>
------------
if you don't want to use a scriptdictionary attribute instead...
you need to be able to collect~store (aka: set to another Attribute, or use, set to, a variable in your scripting block) your randomly selected response or its flag attribute, so you can then check it, if~switch (response_or_flag_X), to do the conditional of whether you run that following~nested script or not.
my complex code does have some example ways of doing this, albiet possibly not easily to notice~recognize, though