Page 1 of 2

[LIB] Library: Find Voice ID

Posted: Fri, 18. Jul 08, 23:42
by Gazz
Put a sector, ware or object in, get the speech ID out.

Have your script speak that number on the proper page (sectors are on page 7, most other things on 17) and you get...

"Argon Prime"
"Nova"
"Asteroid"
"Cargo Life Support System"
"Federal Argon Shipyard"
etc.

Ship names are abbreviated. A Caiman Super Freighter is spoken as "Caiman".

Returns 0 if none could be found.

Image (ZIP) Terran Conflict Version

Image (ZIP) Reunion Version

Posted: Sat, 19. Jul 08, 02:17
by eladan
That's a nice time saver Gazz. :)

Posted: Sat, 19. Jul 08, 17:35
by LV

Code: Select all

236 @ $voice = [THIS] -> call script 'lib.gz.find.voice.ID' :  Sector=$inv.sec.b  Ship or Station=$anull  Ware or other object=$anull
237   write to player logbook $voice
238   = speak text: page=17 id=$voice priority=5
log returns the number but the imperial ears hear nothing
:?:

Posted: Sat, 19. Jul 08, 19:50
by Gazz
That's because the sector names and speech are not on page 17. Read the first post. =P

Posted: Sat, 19. Jul 08, 20:31
by Cycrow
Gazz wrote:That's because the sector names and speech are not on page 17. Read the first post. =P
Imperial eyes appear to be non functional too :P

Posted: Sat, 19. Jul 08, 20:51
by LV
LV knocks gazz across the forum with cycrow's lifeless torso

i tried 13 ladies :roll: :)

Posted: Sat, 19. Jul 08, 20:59
by Gazz
The ability to see or hear is insignificant next to the power of the Force.

PS: Seven shall be the number of thy counting and the number of thy counting shall be seven.
Eight shalt thou not count, neither shalt thou count six, excepting that thou then proceedeth to seven. Nine is right out.
Once the number seven, being the number of thy counting, be reached, then speaketh Betty the name of thy sector.

Posted: Sat, 19. Jul 08, 21:13
by Cycrow
7 = sector names
13 = misc voices
17 = object names

Posted: Sat, 19. Jul 08, 21:30
by LV
ok, test passed, you are still ok to advise the peasants of the forum in coding related matters.


Tis was a simple number error i chose to test you both with ;)

Posted: Mon, 21. Jul 08, 18:54
by LV
2 questions

1. If it try's one of my renamed sectors no audio so i assume i need to force it to say something (e.g specify UK sector index)

2. Where are the race sounds so i can get it to say argon titan not just titan

I appear to be turning blonde :roll:

Posted: Mon, 21. Jul 08, 19:29
by Gazz
The script searches 440001 for the sector name because for normal ES sectors the text ID and speech ID are identical.

If you want speech for your custom sectors you have to make sure they match.
The script does not check an infinite number range, though.
If your custom sectors do have a matching speech on the same ID, maybe it's outside the loop range of the script.

Posted: Mon, 21. Jul 08, 20:11
by Cycrow
you do know that the sector ids are based on thier coordinates, so you can generate the voice id for sectors without ever needing to read anything from the text files.

my Satalite Early Warning Network does that.

i create a library for it, lib.cycrow.getsound

Code: Select all

001   $x = $sector -> get universe x index
002   $y = $sector -> get universe y index
003   inc $x = 
004   inc $y = 
005   
006   if $x < 10
007    $x = sprintf: fmt='0%s', $x, null, null, null, null
008   else
009    $x = sprintf: fmt='%s', $x, null, null, null, null
010   end
011   if $y < 10
012    $y = sprintf: fmt='0%s', $y, null, null, null, null
013   else
014    $y = sprintf: fmt='%s', $y, null, null, null, null
015   end
016   $sound.num = sprintf: fmt='102%s%s', $y, $x, null, null, null
017   $sound.num =  string $sound.num to integer
018   return $sound.num

Posted: Sun, 7. Sep 08, 11:59
by Gazz
Cycrow wrote:you do know that the sector ids are based on thier coordinates, so you can generate the voice id for sectors without ever needing to read anything from the text files.
I only remembered that there was... something I forgot.
Is that system enforced by the engine so it always has to work or could mods arbitrary assign voice IDs to a sector?

Of course it would be far quicker than a string match but with all the mods and freaky workarounds out there I don't automatically trust every modder to do things "the right way". =)

BTW: why "Satalite Early Warning Network"
Is that polish or italian for Satellite?


Version 3 released.

Voice IDs were not reported properly for some factories.

Posted: Sun, 7. Sep 08, 12:59
by Cycrow
Gazz wrote:I only remembered that there was... something I forgot.
Is that system enforced by the engine so it always has to work or could mods arbitrary assign voice IDs to a sector?
the voices are hardcoded to those ids, so modders cant change them around ;)

adding new sectors, means adding the text at the correct id to match that system

Of course it would be far quicker than a string match but with all the mods and freaky workarounds out there I don't automatically trust every modder to do things "the right way". =)
Gazz wrote: BTW: why "Satalite Early Warning Network"
Is that polish or italian for Satellite?
basically coz im dyslexic and cant spell

Posted: Sun, 7. Sep 08, 17:05
by LV
gaz as this is the only 3rd party script i use would it be ok to rename it to plugin.lv~ when i do for the simple fact that there is a very good chance i will forget to pack it otherwise. ;)


If you'd like to keep the name no probs (i'll leave some credit with the code)