Author Topic: extracting conversation strings ?  (Read 274 times)

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
extracting conversation strings ?
« on: May 12, 2011, 07:32:10 pm »


               Within a script, is there a way to grab the strings of a conversation from the conversation file and return them as a string? I know that conversation files are fairly involved and usually contain more than just a sequence of strings, but the ones I am dealing with are simple and linear. Because of the way they are used, they have only one or two lines of text, with no options to branch the conversation, no starting conditional checks, no variables set, etc. I was hoping that there might be a function that returned either one long string with the conversation lines delimited by some special character  or maybe a GetConvoFirstLine() & GetConvoNextLine() paired-function approach.

Why? I am fiddling with a mod where little "informational" conversations (e.g. "You notice that this part of the forest is unusually quiet...") start as a PC enters a trigger. The script that starts the conversation is a pretty generic conversetrigger.nss that calls ActionStartConversation with the conversation that has the same name as the trigger's tag name.

It's an okay system, but it has at least a couple unfortunate side-effects. First, it interrupts stealth. That's a disadvantage to stealthy characters but it's also immersion-breaking for a character to leave stealth mode just to notice that "This area is quite cold." Second, it interacts poorly with Tony K's AI, where a creature might have wandered near the trigger and being both de-stealthed and in a conversation doesn't ready the PC for a potentially hostile creature rushing up.

Anyway, I was toying with the idea of re-writing conversetrigger.nss so that, if it is called by a non-creature, it just delivers the conversation line as a floaty text and is done with it. The bottleneck is that I don't see an easy way to actually grab the text of the conversation. If there is a way to do this already written, it would be useful here.

Also, I am very new to the conversation functions. Obviously, if there is a way to use ActionStartConversation (or another function) in a way that doesn't break stealth, that would more neatly address the present issue without needing to extract conversation text.

BTW, Yes, I know that the right thing to do might be to use the toolset to go in and manually grab each conversation and turn it into floaty text, but this happens dozens of times during the module and I figured I would check into a less laborious workaround first. If there is a way to do what I am talking about, then I can just rewrite conversetrigger and be done with it. '<img'>
               
               

               


                     Modifié par MrZork, 12 mai 2011 - 06:32 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
extracting conversation strings ?
« Reply #1 on: May 12, 2011, 07:54:45 pm »


               It's sound like what you are trying to do(if it is even possible which I don't believe it is) would be more complicated than just going through an redoing the triggers. I wouldn't even use conversations. You could just use the SendMessageToPC function. You could even make the script universal so that all of these triggers use the same script. Just set a string variable on each trigger for the message that you want sent to the player. Then when player enters the trigger the script just checks for the message(string variable) and sends that to the player.

Sorry I couldn't have been more help in regards to your specific question but I'm pretty sure that would be a more complicated path.

Good luck.
               
               

               


                     Modifié par GhostOfGod, 12 mai 2011 - 06:59 .
                     
                  


            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
extracting conversation strings ?
« Reply #2 on: May 13, 2011, 04:01:13 am »


               Thanks, GoG. Since these triggers all call the same script, if I could get the text inside the conversation files, it would be easy to either use floaty text or use SendMessageToPC (which is a good suggestion). However, it may well be that the game doesn't make it easy to do file IO outside of the DB files and writing to the logs, so my hope to open the convo files in-game may not be realizable.

[BTW, is there a how-to for writing DLLs for the game? Just curious...]

I agree that conversation files aren't the ideal way to get what I want here. The problem is this is a tweak of an existing mod and it already has many of these triggers set up to start conversations.

I may write a function to parse all the conversation files offline and then write a string table to an include file that I can add to the conversetrigger.nss code. A little clumsy (and more complicated to tell which convo files will have the simple layout I will be looking for), but doable, I hope.

Ultimately, I am sure I will spend twice as long doing things that way than I would just opening each convo and editing each trigger script. But, that sounds tedious and the coding sounds at least moderately interesting. '^_^'
               
               

               


                     Modifié par MrZork, 13 mai 2011 - 03:03 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
extracting conversation strings ?
« Reply #3 on: May 13, 2011, 04:41:04 am »


               Question.   Does  the PC have responce nodes in the conversations?  

If it does That is most likely what is breaking your PC's stealth.   Try Editing a conversation to only have the NPC's first line of text.    

I just tested it.  Having my PC in stealth and a trigger starting a conversation, with only one line, with the PC's hidding was not broken by the conversation
               
               

               
            

Legacy_MrZork

  • Hero Member
  • *****
  • Posts: 1643
  • Karma: +0/-0
extracting conversation strings ?
« Reply #4 on: May 13, 2011, 04:52:56 am »


               Nice catch. I think that's the issue. There is either a End Dialog or Continue that the PC must hit in each of these.

Once again, I could edit each of the conversations - and that or using another way to notify the PC of these little things he notices would be the ideal way to go here. I was just hoping there would be an automated way to use the convo text without having to edit all the convos or copy-paste their text to one of the other methods manually.