Skip to content

Instantly share code, notes, and snippets.

@slippycheeze
Last active April 11, 2023 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save slippycheeze/27331a3f54483516a1f6a356154aaa4d to your computer and use it in GitHub Desktop.
Save slippycheeze/27331a3f54483516a1f6a356154aaa4d to your computer and use it in GitHub Desktop.
EDDI message received script update
{_ is this a duplicate of the previous value? _}
{set duplicate to [
"source": event.source = state.sc_last_message_source,
"from": event.from = state.sc_last_message_from,
"message": event.message = state.sc_last_message_message
]}
{SetState('sc_last_message_source', event.source)}
{SetState('sc_last_message_from', event.from)}
{SetState('sc_last_message_message', event.message)}
{_ Context _}
{SetState('eddi_context_last_subject', 'message')}
{SetState('eddi_context_last_action', 'receive')}
{SetState('eddi_context_message_name', event.from)}
{SetState('eddi_context_message_content', event.message)}
{_ "true" means spoken and "false" means muted.}
{_ "npc" controls whether NPC comms will be spoken.}
{_ "player" controls direct messages to you will be spoken.}
{_ "starsystem" controls whether player comms across game modes will be spoken.}
{set spokenChannels to [
"friend": true,
"local": true,
"multicrew": true,
"npc": true,
"player": true,
"squadron": true,
"starsystem": true,
"voicechat": true,
"wing": true,
]}
{_ "true" means spoken and "false" means muted.}
{_ "NPC" is the default source for NPC comms.}
{set spokenNpcSources to [
"Ambushed pilot" : true,
"Bounty hunter" : true,
"Capital ship" : true,
"Cargo hunter" : true,
"Civilian pilot" : true,
"Conflict zone" : true,
"Cruise liner" : false,
"Escort" : true,
"Exploration convoy" : true,
"Hitman" : true,
"Messenger" : true,
"Military" : true,
"Miner" : true,
"NPC" : true,
"Passenger hunter" : true,
"Passenger liner" : false,
"Pirate" : true,
"Police" : true,
"Propagandist" : true,
"Protester" : true,
"Refugee" : true,
"Rival power's agent" : true,
"Search and rescue" : true,
"Starship One" : true,
"Station" : false,
"Wedding convoy" : false,
]}
{_ Exclude the active voice and any other voices you include below from voice selections }
{set spokenVoiceExemptions to
[
VoiceDetails().name,
"Microsoft Hazel Desktop",
]}
{declare speakMessage(msg) as:
{set voiceNames to []}
{_ This sorts the available voices using the senderID as a seed value }
{for voiceDetail in VoiceDetails(event.seed):
{if find(spokenVoiceExemptions, voiceDetail.name) > 0:
{_ This is an excluded voice, skip it }
|else:
{set voiceNames to cat(voiceNames, [voiceDetail.name])}
}
}
{_ If any voices are left, speak using the first non-excluded voice name }
{if len(voiceNames) > 0:
{Log(cat("Message Received: in ", voiceNames[0], ": ", msg))}
{Transmit(Voice(msg, voiceNames[0]))}
|else:
{_ otherwise, use the default voice, because presumable the user only *has* one voice. _}
{Transmit(msg)}
}
}
{if spokenChannels[event.channel_invariant] = true:
{if event.player = true:
{set words to split(event.message, " ")}
{set msg to []}
{set cur to 0}
{while cur < len(words):
{set o7match to match(words[cur], "(?<!\\w)([o|O|0]7)(?!\\w)")}
{if len(o7match) > 0:
{set remainder to slice(words[cur], 2)}
{if len(words) = 1:
{if event.channel_invariant = 'player': {set you to " you"}}
{set salute to cat("salutes", you)}
{set msg to cat(msg, [cat(salute, remainder)])}
|else:
{set msg to cat(msg, [cat("salute", remainder)])}
}
|else:
{set msg to cat(msg, [words[cur]])}
}
{set cur to cur + 1}
}
{if !duplicate["from"]: {event.source} {event.from} sends:}
{speakMessage(join(msg, " "))}
|elif spokenNpcSources[event.source_invariant] = true:
{_ Replace common abbreviations in NPC messages}
{declare StringReplace(original, old, new) as:
{if original = old:
{return new}
|else:
{return original}
}
}
{set msg to event.message}
{set msg to join(split(msg, " cr of cargo"), " credits of cargo")}
{set msg to join(split(msg, "t of cargo"), " tons of cargo")}
{speakMessage(msg)}
}
}
@arnman713
Copy link

arnman713 commented Apr 11, 2023

Hi there, I attempted to exclude all french voice packs from the active voices by adding them like bellow, but it keep randomly try to read english using stupid french voices that mess up the immersion, any suggestion?

{set spokenVoiceExemptions to
[
VoiceDetails().name,
"Microsoft Hortense Desktop",
"Microsoft Julie Desktop",
"Microsoft Paul Desktop",
]}

ps: Hortense, Julie and Paul still get randomly selected for AI messages to be read in french while I'm playing the game in english and I can't remove the voice packs from windows.
pps: I will try to actually add the languages as they are displayed in regedit as for exemple for Hortense: "Microsoft Hortense - French (France)" and I'll test it later today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment