Author Topic: Consolidating Text Conditionals  (Read 687 times)

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Consolidating Text Conditionals
« on: April 10, 2015, 08:05:09 pm »


               

Would it be possible to consolidate all journal based text conditionals into a single script?


 


Essentially I have many quests with text conditionals based on which stage of the quest the player is on. I'd like to consolidate these into a single script I could update as I added new quests.


 


If this is doable, what exactly would such a script look like?



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #1 on: April 10, 2015, 11:35:41 pm »


               Can you give an example of a "text conditional"?


Conditional text, e.g, "I'm <searching for | have found> the grail" can be added to journals using custom tokens, but I'm not sure if that's what you mean.
               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #2 on: April 11, 2015, 12:50:36 am »


               


Can you give an example of a "text conditional"?


Conditional text, e.g, "I'm <searching for | have found> the grail" can be added to journals using custom tokens, but I'm not sure if that's what you mean.




 


Basically a conditional for "text appears when" in a conversation.


 


Here's an example of one of quest specific conditionals:



int StartingConditional()
{

    // Inspect local variables
    if(!(GetLocalInt(GetPCSpeaker(), "NW_JOURNAL_ENTRY"  + "beyondthelimit") == 3))
        return FALSE;

    return TRUE;
}

This checks to see if the player is on stage 3 of the quest. If the player is on stage 3 then the dialogue is shown. Otherwise the dialogue does not appear. What I was wondering was if it were possible to use ONE script to handle this sort of thing for every stage of every quest in my module rather than using a script for each one. Like say something using the quest giver's tag as an identifier.



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #3 on: April 11, 2015, 01:55:10 am »


               

Probably not feasible in a clean fashion with a standard conversation, thanks to anyone for correcting me if I'm wrong.


 


ZDialog would allow you to do this and much more, however, but that's a rather advanced subject. The system itself, once trimmed(thanks to the improvements made by friends Henesua and Lightfoot8), contains 19 scripts, but once installed, it allows you to build as many convos as you wish, each one using a single script, whatever the number of checks or "actions taken". For instance, in my PW, all merchants, smiths, enchanters etc. use the same single convo, yet they offer different services and tell you different things, and I don't need to know in advance how many available PC replies will be displayed, which is the main strength of dynamic dialogs.


 


If you're building a few small convos and don't need such flexibility, you're better to stick to the standard system, as you'll end up with about the same number of scripts and the convos will be simpler to build. On the other hand, if you plan to build several medium/large convos, ZDialog will reduce the required number of scripts and you'll also gain a lot of flexibility in the process(personally I don't use a single standard convo in my mod).


 


 


Kato



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #4 on: April 11, 2015, 02:05:01 am »


               


Probably not feasible in a clean fashion with a standard conversation, thanks to anyone for correcting me if I'm wrong.


 


ZDialog would allow you to do this and much more, however, but that's a rather advanced subject. The system itself, once trimmed, contains 18 scripts, but once installed, it allows you to build as many convos as you wish, each one using a single script, whatever the number of checks or "actions taken". For instance, in my PW, all merchants, smiths, enchanters etc. use the same single convo, yet they offer different services and tell you different things, and I don't need to know in advance how many available PC replies will be displayed, which is the main strength of dynamic dialogs.


 


If you're building a few small convos and don't need such flexibility, you're better to stick to the standard system, as you'll end up with about the same number of scripts and the convos will be simpler to build. On the other hand, if you plan to build several medium/large convos, ZDialog will reduce the required number of scripts and you'll also gain a lot of flexibility in the process.


 


 


Kato




 


 


Hm... words like "advanced subject" are scary! I think I'll just stick with what I know I can do! ty for the input!


               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #5 on: April 11, 2015, 02:09:05 am »


               

Let me know if you ever choose to use ZDialog and need help.


 


 


Kato



               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #6 on: April 11, 2015, 02:59:50 am »


               

You can do it with "normal" conversations as well. You need to decide on how you want get your NPCs to know the name of the quest. Then you use that mechanism in the conditional script. You still need a handful, one for state == 1, one for state ==2 etc. Sometimes you need an inequality so you may have some of those.


 


For example, assume for now your NPCs only have one quest. Then you set a string variable on each NPC with the quest name ("beyondthelimit" in your example.  Then the conditionals can be like this:



int StartingConditional()
{

    // Inspect local variables
    if(!(GetLocalInt(GetPCSpeaker(), "NW_JOURNAL_ENTRY" + GetLocalString(OBJECT_SELF, "questname")) == 3))
        return FALSE;

return TRUE;
}

Edited to fix premature posting...


               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #7 on: April 11, 2015, 03:03:28 am »


               


You can do it with "normal" conversations as well. You need to decide on how you want get your NPCs to know the name of the quest. Then you use that mechanism in the conditional script. You still need a handful, one for state == 1, one for state ==2 etc. Sometimes you need an inequality so you may have some of those.


 


For example, assume for now your NPCs only have one quest. Then you set a string variable on each NPC with the quest name ("beyondthelimit" in your example.  Then the conditionals can be like this:



int StartingConditional()
{

    // Inspect local variables
    if(!(GetLocalInt(GetPCSpeaker(), "NW_JOURNAL_ENTRY" + GetLocalString(OBJECT_SELF, "questname")) == 3))
        return FALSE;

return TRUE;
}

Edited to fix premature posting...




 


interesting... might be worth exploring.


               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #8 on: April 11, 2015, 10:26:45 am »


               

Here's a general method for consolidating all conditional scripts into one.


 


Reasons for using it are


  1. It puts all the logic in one place, tagged by NPC, making everything easy to find.

  2.    
  3. You don't need to have many scripts before the toolset grinds to a halt.

  4.    
  5. Some checks are on quest states, but this allows all the rest, such as gold, items, companions or whatever.

The method is very simple. I'll give some examples that might seem complicated at first sight, but that's just to illustrate that one approach works for many different situations.


 


You still need a set of generic conditional scripts (check1, check2, check3...) for "Text Appears When..." which look like this:


 



   Spoiler
   


 


The check_master script looks like this:


 



   Spoiler
   


 


The same approach is used to consolidate "Actions Taken" scripts. We have a set of generic scripts action1, action2, action3...


 



   Spoiler
   


 


The action_master script looks like this:


 



   Spoiler
   


 


A footnote on multiplayer:


 



   Spoiler
   



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #9 on: April 11, 2015, 12:11:59 pm »


               

I'll give this a thorough look once I have some free time Proleric! Thank you for taking the time to really break this down for me. It's greatly appreciated!



               
               

               
            

Legacy_Nic Mercy

  • Full Member
  • ***
  • Posts: 154
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #10 on: April 11, 2015, 05:30:55 pm »


               

I love the way this looks but I fear my ability to comprehend and implement it properly is not up to the task. Thank you though. I will keep this post handy for reference.



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #11 on: April 11, 2015, 09:59:03 pm »


               No problem - feel free to PM if you'd like more insight later on.
               
               

               
            

Legacy_Verilazic

  • Sr. Member
  • ****
  • Posts: 263
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #12 on: April 13, 2015, 01:22:13 pm »


               


Let me know if you ever choose to use ZDialog and need help.


 


 


Kato




 


I found ZZ-Dialog 1.66 on the vault. Is that it, or is there a newer version?


               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #13 on: April 13, 2015, 02:09:21 pm »


               

zz-dialog and zdialog are not the same thing although the former is an offshoot of the latter. I personally did not like zz-dialog as much when I looked at it but that may have been because I was already used to zdialog.  YMMV. You can find what appears to be the latest on the new vault here. There is a thread which I don't have marked that shows how to collapse all the 12 starting conditional scripts to 1 to reduce the number of scripts, which Kato mentioned.


 


Edit : fixed reference to earlier post to Kato... sorry TR - did not mean to drag you into this '<img'>



               
               

               
            

Legacy_Kato -

  • Hero Member
  • *****
  • Posts: 747
  • Karma: +0/-0
Consolidating Text Conditionals
« Reply #14 on: April 13, 2015, 04:53:56 pm »


               

I agree with Meaglyn on his preference for ZDialog. ZZDialog ports the bugs already present in ZDialog and is a much larger system. As such, you DON'T want to use the original ZDialog either, but rather the version packaged with HGLL, since Funky(and PSpeed, on Funky's request) debugged it in the past and he did a great job. The collapsing idea was initially made and posted by Henesua, on a suggestion by Lightfoot8.


 


So, here is the debugged, trimmed version. And no, it does not break or suffers from missing entries if properly used.


https://drive.google...ew?usp=sharing 


 


Kato