[LIB] Library: Find Voice ID

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

[LIB] Library: Find Voice ID

Post by Gazz » Fri, 18. Jul 08, 23:42

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.

[ external image ] (ZIP) Terran Conflict Version

[ external image ] (ZIP) Reunion Version
Last edited by Gazz on Thu, 13. Nov 08, 15:16, edited 2 times in total.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Sat, 19. Jul 08, 02:17

That's a nice time saver Gazz. :)

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV » Sat, 19. Jul 08, 17:35

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
:?:
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sat, 19. Jul 08, 19:50

That's because the sector names and speech are not on page 17. Read the first post. =P
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22224
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Sat, 19. Jul 08, 20:31

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

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV » Sat, 19. Jul 08, 20:51

LV knocks gazz across the forum with cycrow's lifeless torso

i tried 13 ladies :roll: :)
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sat, 19. Jul 08, 20:59

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.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22224
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Sat, 19. Jul 08, 21:13

7 = sector names
13 = misc voices
17 = object names

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV » Sat, 19. Jul 08, 21:30

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 ;)
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV » Mon, 21. Jul 08, 18:54

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:
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Mon, 21. Jul 08, 19:29

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.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22224
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Mon, 21. Jul 08, 20:11

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

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sun, 7. Sep 08, 11:59

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.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22224
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Sun, 7. Sep 08, 12:59

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

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV » Sun, 7. Sep 08, 17:05

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)

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sun, 7. Sep 08, 17:59

Go ahead.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

Post Reply

Return to “X³: Reunion - Scripts and Modding”