irswat Posted November 28, 2015 Share Posted November 28, 2015 Wanted to help Lancer with his profanity filter mod. The poor guy is manually editing every single dialogue that has profanity. I wanted to write a script that searches dialogue trees for profanity, and when found replaces them with a censored copy. Are dialogues simply forms in GECK? I was looking at the functions available, and to my knowledge there is no way to GetDialogue, etc. The closest thing that I've found so far are the ar functions in the NVSE library. Does any one know if it is possible to dynamically read, write, copy dialogue tree forms via script?Matt Link to comment Share on other sites More sharing options...
irswat Posted November 28, 2015 Author Share Posted November 28, 2015 Some of these NVSE functions may be useful if there is a way to DeepCopy dialogue trees into string arrays. Is there a way to GetContents of a dialogue tree? ar_Construct ar_Size ar_Dump ar_DumpID ar_Erase ar_Sort ar_CustomSort ar_SortAlpha ar_Find ar_First ar_Last ar_Next ar_Prev ar_Keys ar_HasKey ar_BadStringIndex ar_BadNumericIndex ar_Copy ar_DeepCopy ar_Null ar_Resize ar_Insert ar_InsertRange ar_Append ar_List ar_Map ar_Range sv_Destruct sv_Construct sv_Set sv_Compare sv_Length sv_Erase sv_SubString sv_ToNumeric sv_Insert sv_Count sv_Find sv_Replace sv_GetChar sv_Split sv_Percentify sv_ToUpper sv_ToLower Link to comment Share on other sites More sharing options...
irswat Posted November 28, 2015 Author Share Posted November 28, 2015 (edited) PseudoCode:GetIsTalkingIf yesGetDialogueSpeakercopy dialogue tree into arraycopy array into text filesearch text file for profanityreplace profanity with censored dataread text file into arrayreplace dialogue tree with array Edited November 28, 2015 by irswat Link to comment Share on other sites More sharing options...
irswat Posted November 28, 2015 Author Share Posted November 28, 2015 another option would be writing something similar in C++ that extracts dialogue files from bsa/esp files censors profanity, and then repacks the bsa/esp.Does anyone know where the dialogue files are stored? Link to comment Share on other sites More sharing options...
TommInfinite Posted November 28, 2015 Share Posted November 28, 2015 (edited) This code will solve your problems. JiP plugin required however. (for GetUIString)It constantly running and is changing NPC text onscreen (in dialogue mode). I advice setting quest delay to 0.0014 to make it faster.There are also NVSE special NVSE events for that but they don't seem to work so you need to use this. Scriptname Myscript string_var sv_DialText begin menumode 1009 ; only in dialogue mode let sv_DialText := GetUIString "DialogMenu/NOGLOW_BRANCH/DM_SpeakerText/string" PrintD "LUNETTE:: Dialogue Text Value is " + $sv_DialText if eval (Sv_Find "Bad word", sv_DialText) >-1 ; of I found "Bad word" inside dialogue text Sv_Replace "Bad word|B#d W&$d", sv_DialText ; Replace "Bad word" with "B#d W&$d" SetUIString "DialogMenu/NOGLOW_BRANCH/DM_SpeakerText/string" $sv_DialText ; Set current text elseif eval (Sv_Find "Another Bad word", sv_DialText) >-1 Sv_Replace "Another Bad word|An^th%r B#d W&$d", sv_DialText SetUIString "DialogMenu/NOGLOW_BRANCH/DM_SpeakerText/string" $sv_DialText endif sv_destruct sv_DialText ; don't forget to clear it. endI never checked it ingame (I used original code for other purpose) but it should work. Important thing - don't separate check for strings by "||"- script might stop. Always use "elseif" instead.  Changing player prompt is trickier because there might be many entries to check. I can help you do it but do you really need it?Changing subtitle text (in gamemode) is possible I think but I never tried. And that would require knowing XML path to them too. Edited November 28, 2015 by TommInfinite Link to comment Share on other sites More sharing options...
TommInfinite Posted November 28, 2015 Share Posted November 28, 2015 So I made a test esp. The important thing - don't use "%" "&" (and maybe others) symbols as a replacement because game CTDs. Now I used "@' symbol and it works. http://s6.postimg.org/riz2toox9/Fallout_NV_2015_11_28_14_15_17_822.jpg http://www.mediafire.com/download/y5ew6ynq3aqe45f/NoProfanityv1Alpha.rar Link to comment Share on other sites More sharing options...
irswat Posted November 28, 2015 Author Share Posted November 28, 2015 Thanks a lot mate! I was looking at JIP NVSE plugin functions last night and saw a few that were of interest. That you went ahead and shared this, may God bless you. I'll share it with Lance and give you full credit. Link to comment Share on other sites More sharing options...
irswat Posted November 28, 2015 Author Share Posted November 28, 2015 Yea if I recall those are format operators in papyrus. Link to comment Share on other sites More sharing options...
irswat Posted November 28, 2015 Author Share Posted November 28, 2015 (edited) Im just going to use an or operator to cover all the curse words, but let me ask you a question, what is -1? If the string for a curse is found shouldn't it return 1, and if no curse is found 0? If you do >-1 this would encompass both 0 and 1. Would it be better to use something likeif eval (Sv_Find "Bad word", sv_DialText) == 1;Curse word found? Edited November 28, 2015 by irswat Link to comment Share on other sites More sharing options...
irswat Posted November 28, 2015 Author Share Posted November 28, 2015 (edited) I also noticed that you are searching for "Curse", but not "CURSE", or "curse" am I correct to assume that the string find function is no case sensitive or should I use ToLower to search the strings in lower case? Edited November 28, 2015 by irswat Link to comment Share on other sites More sharing options...
Recommended Posts