Left 4 Dead 2

Left 4 Dead 2

Not enough ratings
Simplified Talker Base Example
By senzawa
A side-by-side example of how to use the Simplified Talker Base
   
Award
Favorite
Favorited
Unfavorite
Overview
This is a guide written for the usage of Sayori's Simplified Talker Base, which seeks to reduce the boilerplate code rampant in VScript Talkers.
Base Usage
First, include the script.
IncludeScript("sayoritalker");

Function takes two needed arguments and one optional argument:
function register(concept,table,extra_criterias=[])

The first argument, "concept" is the Concept that needs to be fired for the response to play.
The second argument, "table" is a table with the survivor internal names for keys and a list of scenes for values. You can either use the full version, or, if you only pass a string, it will be parsed as a scenename.
The third, optional, argument, "extra_criterias" is exactly what is says on the tin.

Example:
register("some_concept", { "Manager":[ {scenename="scenes/Manager/PainReliefSigh02.vcd"}, // Ah "scenes/Manager/PainReliefSigh04.vcd", // Ohh ], "NamVet":[ "scenes/NamVet/PainReliefSigh02.vcd", {scenenanme="scenes/NamVet/PainReliefSigh02.vcd", func=SomeFunction}, ], // (note that you don't need to include all characters) },[["Coughing",0],["numberofteamdead", 1, 99]]);
Usage Example
Example used is part of the voicelines in Reviving Shot (Script)
which fires the characters' adrenaline usage voicelines after "sayori_reviveshotgiven" is fired.

New code w/ Simplified Talker Base:
IncludeScript("sayoritalker") printl("<Sayori> ReviveShot voicelines loading.") register("sayori_reviveshotgiven", { "Biker":[ "scenes/Biker/PainReliefSigh01.vcd", // Ahhh "scenes/Biker/PainReliefSigh05.vcd", // ohh ], "Coach":[ "scenes/Coach/PainRelieftFirstAid01.vcd", //Aahhh... "scenes/Coach/PainRelieftPills01.vcd", //Ooff, ahh. ], "Gambler":[ "scenes/Gambler/Adrenaline03.vcd", //[shaking self awake] "scenes/Gambler/PainRelieftPills01.vcd", //Bbbbrrrrrrr ], "Manager":[ "scenes/Manager/PainReliefSigh02.vcd", // Ah "scenes/Manager/PainReliefSigh04.vcd", // Ohh ], "NamVet":[ "scenes/NamVet/PainReliefSigh02.vcd", // ah "scenes/NamVet/PainReliefSigh02.vcd", // ah ], "Mechanic":[ "scenes/Mechanic/Adrenaline03.vcd", //[shaking self awake] ], "Producer":[ "scenes/Producer/Adrenaline05.vcd", //[shaking self awake] "scenes/Producer/Adrenaline06.vcd", //[shaking self awake] "scenes/Producer/PainRelieftPills03.vcd" // Ahhh. Ooohh. ], "TeenGirl":[ "scenes/TeenGirl/PainReliefSigh02.vcd", // Ahhh "scenes/TeenGirl/PainReliefSigh08.vcd", // Ahhh ] },[]); // extra Criteria, if exists, goes in here // if not, you can safely leave this argument out, since it defaults to [] // it is included here only for the sake of clarity

Original code w/o Simplified Talker Base
IncludeScript("response_testbed", this) printl("<Sayori> ReviveShot voicelines loading.") // adrenaline lines with no predelay local reviveshot_adrenalinerules = [ { name="Adrenaline_Francis", criteria = [ ["concept","sayori_reviveshotgiven"], ["who","Biker"] ], responses = [ { scenename = "scenes/Biker/PainReliefSigh01.vcd", } //Ahhh { scenename = "scenes/Biker/PainReliefSigh05.vcd", } //ohh ], group_params = g_rr.RGroupParams({}) }, { name="Adrenaline_Coach", criteria = [ ["concept","sayori_reviveshotgiven"], ["who","Coach"] ], responses = [ { scenename = "scenes/Coach/PainRelieftFirstAid01.vcd", } //Aahhh... { scenename = "scenes/Coach/PainRelieftPills01.vcd", } //Ooff, ahh. ], group_params = g_rr.RGroupParams({}) }, { name="Adrenaline_Nick", criteria = [ ["concept","sayori_reviveshotgiven"], ["who","Gambler"] ], responses = [ { scenename = "scenes/Gambler/Adrenaline03.vcd", } //[shaking self awake] { scenename = "scenes/Gambler/PainRelieftPills01.vcd", } //Bbbbrrrrrrr ], group_params = g_rr.RGroupParams({}) }, { name="Adrenaline_Louis", criteria = [ ["concept","sayori_reviveshotgiven"], ["who","Manager"] ], responses = [ { scenename = "scenes/Manager/PainReliefSigh02.vcd", } //Ah { scenename = "scenes/Manager/PainReliefSigh04.vcd", } //Ohh ], group_params = g_rr.RGroupParams({}) }, { name="Adrenaline_Ellis", criteria = [ ["concept","sayori_reviveshotgiven"], ["who","Mechanic"] ], responses = [ { scenename = "scenes/Mechanic/Adrenaline03.vcd", } //[shaking self awake] ], group_params = g_rr.RGroupParams({}) }, { name="Adrenaline_Bill", criteria = [ ["concept","sayori_reviveshotgiven"], ["who","NamVet"] ], responses = [ { scenename = "scenes/NamVet/PainReliefSigh02.vcd", } //ah { scenename = "scenes/NamVet/PainReliefSigh02.vcd", } //ah ], group_params = g_rr.RGroupParams({}) }, { name="Adrenaline_Rochelle", criteria = [ ["concept","sayori_reviveshotgiven"], ["who","Producer"] ], responses = [ { scenename = "scenes/Producer/Adrenaline05.vcd", } //[shaking self awake] { scenename = "scenes/Producer/Adrenaline06.vcd", } //[shaking self awake] { scenename = "scenes/Producer/PainRelieftPills03.vcd", } //Ahhh. Ooohh. ], group_params = g_rr.RGroupParams({}) }, { name="Adrenaline_Zoey", criteria = [ ["concept","sayori_reviveshotgiven"], ["who","TeenGirl"] ], responses = [ { scenename = "scenes/TeenGirl/PainReliefSigh02.vcd", } //Ahhh { scenename = "scenes/TeenGirl/PainReliefSigh08.vcd", } //Ahhh ], group_params = g_rr.RGroupParams({}) }, ] g_rr.rr_ProcessRules( reviveshot_adrenalinerules );
Credits
ChimiChamo's Guide to VScript Talkers was a great help in both creating this base and examples, you can also use that guide's advanced scene usages here with no problem.
3 Comments
Pavka 23 Jun, 2024 @ 9:12am 
Niko:os_niko:
Wolf, The Technician 23 Jun, 2024 @ 12:15am 
niko spotted
ChimiChamo 21 Jun, 2024 @ 12:37am 
does it even count as a vscript talker if 80% of it isnt copy pasted each time