Jump to content


Photo

Wanna do it the easy way, but...


  • Please log in to reply
48 replies to this topic

#1 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 03 July 2007 - 05:58 AM

Is something like this possible?

Where MWConAndia is non-joinable conversation, Ariena is joined NPC and there is made sure she is in the party

IF ~~ THEN BEGIN MWCONAndia10
SAY ~bla bla.~
IF ~See("Ariena") !CD_STATE_NON_VALID("Ariena")~ THEN REPLY ~jabba jabba~
IF ~~ THEN REPLY ~smeckydie the smeckydie~ GOTO MWCONAndia11
IF ~~ THEN REPLY ~talk talk talk~ GOTO MWCONAndia12
IF ~~ THEN REPLY ~small talk some more~ GOTO MWCONAndia13
END

or

IF ~~ THEN BEGIN MWCONAndia10
SAY ~bla bla.~
 == ARIENAJ ~jabba jabba~
 == MWANDIA ~jabb jabba 2~
 == ARIENAJ ~jabba jabba 3~
IF ~~ THEN REPLY ~smeckydie the smeckydie~ GOTO MWCONAndia11
IF ~~ THEN REPLY ~talk talk talk~ GOTO MWCONAndia12
IF ~~ THEN REPLY ~small talk some more~ GOTO MWCONAndia13
END

Yes, I know I am a bit .... trying to stretch the limit here, but I hate externing in and out all the time... certainly as the end the conversation should focus more on NPC and NPC-non-join whereas it starts as PC and NPC-non-join

Edited by Deathsangel, 03 July 2007 - 06:01 AM.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#2 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 03 July 2007 - 06:11 AM

Your state checks should take the form

!StateCheck("Ariena",CD_STATE_NOTVALID)

There's more, but I can't answer until tonight. If no one jumps in by then, I'll expand this input then.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#3 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 03 July 2007 - 06:56 AM

I know there are a bunch of tutorials on this, and berelinde has written some of them, but I am going to throw out a couple of things that look like "think" problems rather than "format" problems. "Think" problems are an area I am very familiar with - it takes a good deal of time to get a new thought into my brain in a functionable way :)

OK, some basics: what you are looking for here is something called a CHAIN. It is designed to do just what you are saying - taking the byplay of a few NPCs and sort of "automatically building" all the in-between states. It is a powerful tool, but can be confusing.

In a traditional structure, you have to stick with a variant of what you have posted.

IF ~~ THEN BEGIN MWCONAndia10 << has to be directly called from another state
SAY ~bla bla.~
IF ~See("Ariena") !CD_STATE_NON_VALID("Ariena")~ THEN REPLY ~jabba jabba~ <<2 problems - no transition, and malformed StateCheck)
IF ~~ THEN REPLY ~smeckydie the smeckydie~ GOTO MWCONAndia11
IF ~~ THEN REPLY ~talk talk talk~ GOTO MWCONAndia12
IF ~~ THEN REPLY ~small talk some more~ GOTO MWCONAndia13
END

So, yes, if you do this:
IF ~~ MWCONAndia10
SAY ~bla bla.~
IF ~See("Ariena") !StateCheck("Ariena",CD_STATE_NOT_VALID)~ THEN REPLY ~jabba jabba~ GOTO new_state
IF ~~ THEN REPLY ~smeckydie the smeckydie~ GOTO MWCONAndia11
IF ~~ THEN REPLY ~talk talk talk~ GOTO MWCONAndia12
IF ~~ THEN REPLY ~small talk some more~ GOTO MWCONAndia13
END
then when your dialoge file follows the link to MWCONAndia10 (NOT when she is talked to - you have this written as a reply state, called directly from another state), if the creature with DV "Ariena" is not invisible, is within a certain number of squares, etc., the reply leading to MWCONAndia11 will show up as a possibility.

It looks like you have set this up expecting the REPLY functions to be part of the NPC talk, though. Here is what you would see:

NPC(nonjoined): bla bla.
Replies =
PC: small talk some more
PC: talk talk talk
PC: smeckydie the smeckydie
PC(if Ariena is visible, in sightline, and ok): jabba jabba

Note the reversal - these are evaluated from the bottom up, so last in order is first evaluated.

== DIALOGUEFILE ~line said goes here~


is a CHAIN construction, and does not work within a traditionally constructed file.

If you established this:

CHAIN ~DIALOGUEFILE~ statename

CHAIN ~MWANDIA~ MWCONAndia10
~bla bla~
== ~ARIENAJ~ ~jabb jabba~
== ~MWANDIA~ ~jabb jabba 2~
== ~ARIENAJ~ ~jabba jabba 3~
==  ~BMINSC~ IF ~InParty("minsc") InMyArea("minsc") !StateCheck("minsc",CD_STATE_NOTVALID)~ THEN  ~jabb jabba 3 response if Ariena is in party and he is in party~
END
++ ~My (PC's) Reply to the above conversation~  DO ~GiveItemCreate("MyItem",Player1,1,1,0) SetGlobal("MyGlobal","GLOBAL",2)~ EXIT
This would look like this:

Nonjoined NPC: ~bla bla~
Ariena: ~jabb jabba~
Nonjoined NPC: ~jabb jabba 2~
Ariena: ~jabba jabba 3~
Minsc (if valid and present): ~jabb jabba 3 response if Ariena is in party and he is in party~
PC: ~My (PC's) Reply to the above conversation~

I would suggest grabbing some existing mods that use CHAIN and look at how they are constructed, in addition to hitting the tutorials again.

I would post code examples, but it isn't cool to post other folks stuff without permission; so I have an example here that can give you a start, pulled from work done by berelinde and myself. These are snippets from a non-joinable NPC conversation with joinable NPCs and <CHARNAME>:


BEGIN X#LP1REP

/* SAM */
/* Initial Meeting */
CHAIN IF ~NumTimesTalkedTo(0) Global("X#LakeP1RepTalk","GLOBAL",0)~ THEN ~X#LP1REP~ X#Troubador1Start
@0
END
++ @1 EXTERN ~X#LP1REP~ X#Troubador1OfferInterested
++ @2 EXTERN ~X#LP1REP~ X#Troubador1OfferInterested
+ ~OR(2) InParty("garrick") InParty("eldoth")~ + @3 EXTERN ~X#LP1REP~ X#Troubador1OwnBard
++ @4 EXTERN ~X#LP1REP~ X#Troubador1OfferHearMeOut
++ @5 EXTERN ~X#LP1REP~ X#Troubador1OfferDeclined
/* Sales pitch - NPCs interject here and meeting globals get set here */
CHAIN ~X#LP1REP~ X#Troubador1OfferInterested
@16
== ~_BSAFAN~ IF ~InParty("safana") InMyArea("safana") !StateCheck("safana",CD_STATE_NOTVALID) Global("X#SafanaRep","GLOBAL",0)~ THEN @17 DO ~IncrementGlobal("X#SafanaRep","GLOBAL",1)~
== ~_BSAFAN~ IF ~InParty("safana") InMyArea("safana") !StateCheck("safana",CD_STATE_NOTVALID) Global("X#SafanaRep","GLOBAL",1)~ THEN @18 DO ~IncrementGlobal("X#SafanaRep","GLOBAL",1)~
== ~_BSAFAN~ IF ~InParty("safana") InMyArea("safana") !StateCheck("safana",CD_STATE_NOTVALID) Global("X#SafanaRep","GLOBAL",2)~ THEN @19 DO ~IncrementGlobal("X#SafanaRep","GLOBAL",1)~
== ~_BJAHEI~ IF ~InParty("jaheira") InMyArea("jaheira") !StateCheck("jaheira",CD_STATE_NOTVALID) Global("X#JaheiraRep","GLOBAL",0)~ THEN @20 DO ~IncrementGlobal("X#JaheiraRep","GLOBAL",1)~
== ~_BJAHEI~ IF ~InParty("jaheira") InMyArea("jaheira") !StateCheck("jaheira",CD_STATE_NOTVALID) Global("X#JaheiraRep","GLOBAL",1)~ THEN @21 DO ~IncrementGlobal("X#JaheiraRep","GLOBAL",1)~ 
== ~_BJAHEI~ IF ~InParty("jaheira") InMyArea("jaheira") !StateCheck("jaheira",CD_STATE_NOTVALID) Global("X#JaheiraRep","GLOBAL",2)~ THEN @22 DO ~IncrementGlobal("X#JaheiraRep","GLOBAL",1)~
== ~_BKHALI~ IF ~InParty("khalid") InMyArea("khalid") !StateCheck("khalid",CD_STATE_NOTVALID) Global("X#KhalidRep","GLOBAL",0)~ THEN @23 DO ~IncrementGlobal("X#KhalidRep","GLOBAL",1)~
== ~_BKHALI~ IF ~InParty("khalid") InMyArea("khalid") !StateCheck("khalid",CD_STATE_NOTVALID) Global("X#KhalidRep","GLOBAL",1)~ THEN @24 DO ~IncrementGlobal("X#KhalidRep","GLOBAL",1)~
== ~_BKHALI~ IF ~InParty("khalid") InMyArea("khalid") !StateCheck("khalid",CD_STATE_NOTVALID) Global("X#KhalidRep","GLOBAL",2)~ THEN @25 DO ~IncrementGlobal("X#KhalidRep","GLOBAL",1)~
== ~_BMONTA~ IF ~InParty("montaron") InMyArea("montaron") !StateCheck("montaron",CD_STATE_NOTVALID) Global("X#MontaronRep","GLOBAL",0)~ THEN @26 DO ~IncrementGlobal("X#MontaronRep","GLOBAL",1)~
== ~_BMONTA~ IF ~InParty("montaron") InMyArea("montaron") !StateCheck("montaron",CD_STATE_NOTVALID) Global("X#MontaronRep","GLOBAL",1)~ THEN @27 DO ~IncrementGlobal("X#MontaronRep","GLOBAL",1)~
== ~_BMONTA~ IF ~InParty("montaron") InMyArea("montaron") !StateCheck("montaron",CD_STATE_NOTVALID) Global("X#MontaronRep","GLOBAL",2)~ THEN @28 DO ~IncrementGlobal("X#MontaronRep","GLOBAL",1)~
== ~_BXZAR~ IF ~InParty("xzar") InMyArea("xzar") !StateCheck("xzar",CD_STATE_NOTVALID) Global("X#XzarRep","GLOBAL",0)~ THEN @29 DO ~IncrementGlobal("X#XzarRep","GLOBAL",1)~
== ~_BXZAR~ IF ~InParty("xzar") InMyArea("xzar") !StateCheck("xzar",CD_STATE_NOTVALID) Global("X#XzarRep","GLOBAL",1)~ THEN @30 DO ~IncrementGlobal("X#XzarRep","GLOBAL",1)~
== ~_BXZAR~ IF ~InParty("xzar") InMyArea("xzar") !StateCheck("xzar",CD_STATE_NOTVALID) Global("X#XzarRep","GLOBAL",2)~ THEN @31 DO ~IncrementGlobal("X#XzarRep","GLOBAL",1)~
== ~_BGARRI~ IF ~InParty("garrick") InMyArea("garrick") !StateCheck("garrick",CD_STATE_NOTVALID) Global("X#GarrickRep","GLOBAL",0)~ THEN @32 DO ~IncrementGlobal("X#GarrickRep","GLOBAL",1)~
== ~_BGARRI~ IF ~InParty("garrick") InMyArea("garrick") !StateCheck("garrick",CD_STATE_NOTVALID) Global("X#GarrickRep","GLOBAL",1)~ THEN @33 DO ~IncrementGlobal("X#GarrickRep","GLOBAL",1)~
== ~_BGARRI~ IF ~InParty("garrick") InMyArea("garrick") !StateCheck("garrick",CD_STATE_NOTVALID) Global("X#GarrickRep","GLOBAL",2)~ THEN @34
== ~X#LP1REP~ IF ~InParty("garrick") InMyArea("garrick") !StateCheck("garrick",CD_STATE_NOTVALID) Global("X#GarrickRep","GLOBAL",2)~ THEN @35 DO ~IncrementGlobal("X#GarrickRep","GLOBAL",1)~
== ~_BELDOT~ IF ~InParty("eldoth") InMyArea("eldoth") !StateCheck("eldoth",CD_STATE_NOTVALID) Global("X#EldothRep","GLOBAL",0)~ THEN @36 DO ~IncrementGlobal("X#EldothRep","GLOBAL",1)~
== ~_BELDOT~ IF ~InParty("eldoth") InMyArea("eldoth") !StateCheck("eldoth",CD_STATE_NOTVALID) Global("X#EldothRep","GLOBAL",1)~ THEN @37 DO ~IncrementGlobal("X#EldothRep","GLOBAL",1)~
== ~_BELDOT~ IF ~InParty("eldoth") InMyArea("eldoth") !StateCheck("eldoth",CD_STATE_NOTVALID) Global("X#EldothRep","GLOBAL",2)~ THEN @38 DO ~IncrementGlobal("X#EldothRep","GLOBAL",1)~
== ~_BAJANT~ IF ~InParty("ajantis") InMyArea("ajantis") !StateCheck("ajantis",CD_STATE_NOTVALID) Global("X#AjantisRep","GLOBAL",0)~ THEN @39 DO ~IncrementGlobal("X#AjantisRep","GLOBAL",1)~
== ~_BAJANT~ IF ~InParty("ajantis") InMyArea("ajantis") !StateCheck("ajantis",CD_STATE_NOTVALID) Global("X#AjantisRep","GLOBAL",1)~ THEN @40 DO ~IncrementGlobal("X#AjantisRep","GLOBAL",1)~
== ~_BAJANT~ IF ~InParty("ajantis") InMyArea("ajantis") !StateCheck("ajantis",CD_STATE_NOTVALID) Global("X#AjantisRep","GLOBAL",2)~ THEN @41 DO ~IncrementGlobal("X#AjantisRep","GLOBAL",1)~
== ~_BIMOEN~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID) Global("X#ImoenRep","GLOBAL",0)~ THEN @42 DO ~IncrementGlobal("X#ImoenRep","GLOBAL",1)~
== ~_BIMOEN~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID) Global("X#ImoenRep","GLOBAL",1)~ THEN @43 DO ~IncrementGlobal("X#ImoenRep","GLOBAL",1)~
== ~_BIMOEN~ IF ~InParty("imoen") InMyArea("imoen") !StateCheck("imoen",CD_STATE_NOTVALID) Global("X#ImoenRep","GLOBAL",2)~ THEN @44 DO ~IncrementGlobal("X#ImoenRep","GLOBAL",1)~  
== ~_BFALDO~ IF ~InParty("faldorn") InMyArea("faldorn") !StateCheck("faldorn",CD_STATE_NOTVALID) Global("X#FaldornRep","GLOBAL",0)~ THEN @45 DO ~IncrementGlobal("X#FaldornRep","GLOBAL",1)~
== ~_BFALDO~ IF ~InParty("faldorn") InMyArea("faldorn") !StateCheck("faldorn",CD_STATE_NOTVALID) Global("X#FaldornRep","GLOBAL",1)~ THEN @46 DO ~IncrementGlobal("X#FaldornRep","GLOBAL",1)~
== ~_BFALDO~ IF ~InParty("faldorn") InMyArea("faldorn") !StateCheck("faldorn",CD_STATE_NOTVALID) Global("X#FaldornRep","GLOBAL",2)~ THEN @47 DO ~IncrementGlobal("X#FaldornRep","GLOBAL",1)~
== ~_BXANNN~ IF ~InParty("xan") InMyArea("xan") !StateCheck("xan",CD_STATE_NOTVALID) Global("X#XanRep","GLOBAL",0)~ THEN @48 DO ~IncrementGlobal("X#XanRep","GLOBAL",1)~
== ~_BXANNN~ IF ~InParty("xan") InMyArea("xan") !StateCheck("xan",CD_STATE_NOTVALID) Global("X#XanRep","GLOBAL",1)~ THEN @49 DO ~IncrementGlobal("X#XanRep","GLOBAL",1)~
== ~_BXANNN~ IF ~InParty("xan") InMyArea("xan") !StateCheck("xan",CD_STATE_NOTVALID) Global("X#XanRep","GLOBAL",2)~ THEN @50 DO ~IncrementGlobal("X#XanRep","GLOBAL",1)~
== ~_BKAGAI~ IF ~InParty("kagain") InMyArea("kagain") !StateCheck("kagain",CD_STATE_NOTVALID) Global("X#KagainRep","GLOBAL",0)~ THEN @51  DO ~IncrementGlobal("X#KagainRep","GLOBAL",1)~
== ~_BKAGAI~ IF ~InParty("kagain") InMyArea("kagain") !StateCheck("kagain",CD_STATE_NOTVALID) Global("X#KagainRep","GLOBAL",1)~ THEN @52  DO ~IncrementGlobal("X#KagainRep","GLOBAL",1)~
== ~_BKAGAI~ IF ~InParty("kagain") InMyArea("kagain") !StateCheck("kagain",CD_STATE_NOTVALID) Global("X#KagainRep","GLOBAL",2)~ THEN @53  DO ~IncrementGlobal("X#KagainRep","GLOBAL",1)~
== ~_BKIVAN~ IF ~InParty("kivan") InMyArea("kivan") !StateCheck("kivan",CD_STATE_NOTVALID) Global("X#KivanRep","GLOBAL",0)~ THEN @54 DO ~IncrementGlobal("X#KivanRep","GLOBAL",1)~
== ~_BKIVAN~ IF ~InParty("kivan") InMyArea("kivan") !StateCheck("kivan",CD_STATE_NOTVALID) Global("X#KivanRep","GLOBAL",1)~ THEN @55 DO ~IncrementGlobal("X#KivanRep","GLOBAL",1)~
== ~_BKIVAN~ IF ~InParty("kivan") InMyArea("kivan") !StateCheck("kivan",CD_STATE_NOTVALID) Global("X#KivanRep","GLOBAL",2)~ THEN @56 DO ~IncrementGlobal("X#KivanRep","GLOBAL",1)~
== ~_BYESLI~ IF ~InParty("yeslick") InMyArea("yeslick") !StateCheck("yeslick",CD_STATE_NOTVALID) Global("X#YeslickRep","GLOBAL",0)~ THEN @57 DO ~IncrementGlobal("X#YeslickRep","GLOBAL",1)~
== ~_BYESLI~ IF ~InParty("yeslick") InMyArea("yeslick") !StateCheck("yeslick",CD_STATE_NOTVALID) Global("X#YeslickRep","GLOBAL",1)~ THEN @58 DO ~IncrementGlobal("X#YeslickRep","GLOBAL",1)~
== ~_BYESLI~ IF ~InParty("yeslick") InMyArea("yeslick") !StateCheck("yeslick",CD_STATE_NOTVALID) Global("X#YeslickRep","GLOBAL",2)~ THEN @59 DO ~IncrementGlobal("X#YeslickRep","GLOBAL",1)~
== ~_BQUAYL~ IF ~InParty("quayle") InMyArea("quayle") !StateCheck("quayle",CD_STATE_NOTVALID) Global("X#QuayleRep","GLOBAL",0)~ THEN @60 DO ~IncrementGlobal("X#QuayleRep","GLOBAL",1)~
== ~_BQUAYL~ IF ~InParty("quayle") InMyArea("quayle") !StateCheck("quayle",CD_STATE_NOTVALID) Global("X#QuayleRep","GLOBAL",1)~ THEN @61 DO ~IncrementGlobal("X#QuayleRep","GLOBAL",1)~
== ~_BQUAYL~ IF ~InParty("quayle") InMyArea("quayle") !StateCheck("quayle",CD_STATE_NOTVALID) Global("X#QuayleRep","GLOBAL",2)~ THEN @62 DO ~IncrementGlobal("X#QuayleRep","GLOBAL",1)~
== ~_BSKIE~ IF ~InParty("skie") InMyArea("skie") !StateCheck("skie",CD_STATE_NOTVALID) Global("X#SkieRep","GLOBAL",0)~ THEN @63 DO ~IncrementGlobal("X#SkieRep","GLOBAL",1)~
== ~_BSKIE~ IF ~InParty("skie") InMyArea("skie") !StateCheck("skie",CD_STATE_NOTVALID) Global("X#SkieRep","GLOBAL",1)~ THEN @64 DO ~IncrementGlobal("X#SkieRep","GLOBAL",1)~
== ~_BSKIE~ IF ~InParty("skie") InMyArea("skie") !StateCheck("skie",CD_STATE_NOTVALID) Global("X#SkieRep","GLOBAL",2)~ THEN @65 DO ~IncrementGlobal("X#SkieRep","GLOBAL",1)~
== ~_BCORAN~ IF ~InParty("coran") InMyArea("coran") !StateCheck("coran",CD_STATE_NOTVALID) Global("X#CoranRep","GLOBAL",0)~ THEN @66 DO ~IncrementGlobal("X#CoranRep","GLOBAL",1)~
== ~_BCORAN~ IF ~InParty("coran") InMyArea("coran") !StateCheck("coran",CD_STATE_NOTVALID) Global("X#CoranRep","GLOBAL",1)~ THEN @67 DO ~IncrementGlobal("X#CoranRep","GLOBAL",1)~
== ~_BCORAN~ IF ~InParty("coran") InMyArea("coran") !StateCheck("coran",CD_STATE_NOTVALID) Global("X#CoranRep","GLOBAL",2)~ THEN @68 DO ~IncrementGlobal("X#CoranRep","GLOBAL",1)~
== ~_BMINSC~ IF ~InParty("minsc") InMyArea("minsc") !StateCheck("minsc",CD_STATE_NOTVALID) Global("X#MinscRep","GLOBAL",0)~ THEN @69 DO ~IncrementGlobal("X#MinscRep","GLOBAL",1)~
== ~_BMINSC~ IF ~InParty("minsc") InMyArea("minsc") !StateCheck("minsc",CD_STATE_NOTVALID) Global("X#MinscRep","GLOBAL",1)~ THEN @70 DO ~IncrementGlobal("X#MinscRep","GLOBAL",1)~
== ~_BMINSC~ IF ~InParty("minsc") InMyArea("minsc") !StateCheck("minsc",CD_STATE_NOTVALID) Global("X#MinscRep","GLOBAL",2)~ THEN @71 DO ~IncrementGlobal("X#MinscRep","GLOBAL",1)~
== ~_BDYNAH~ IF ~InParty("dynaheir") InMyArea("dynaheir") !StateCheck("dynaheir",CD_STATE_NOTVALID) InParty("minsc") !StateCheck("minsc",CD_STATE_NOTVALID) Global("X#DynaMinscRep","GLOBAL",0)~ THEN @72 DO ~IncrementGlobal("X#DynaMinscRep","GLOBAL",1)~
== ~_BDYNAH~ IF ~InParty("dynaheir") InMyArea("dynaheir") !StateCheck("dynaheir",CD_STATE_NOTVALID) InParty("minsc") !StateCheck("minsc",CD_STATE_NOTVALID) Global("X#DynaMinscRep","GLOBAL",1)~ THEN @73 DO ~IncrementGlobal("X#DynaMinscRep","GLOBAL",1)~
== ~_BDYNAH~ IF ~InParty("dynaheir") InMyArea("dynaheir") !StateCheck("dynaheir",CD_STATE_NOTVALID) InParty("minsc") !StateCheck("minsc",CD_STATE_NOTVALID) Global("X#DynaMinscRep","GLOBAL",2)~ THEN @74 DO ~IncrementGlobal("X#DynaMinscRep","GLOBAL",1)~
== ~_BDYNAH~ IF ~!InParty("minsc") InMyArea("minsc") InParty("dynaheir") InMyArea("dynaheir") !StateCheck("dynaheir",CD_STATE_NOTVALID) Global("X#DynaheirRep","GLOBAL",0)~ THEN @75 DO ~IncrementGlobal("X#DynaheirRep","GLOBAL",1)~
== ~_BDYNAH~ IF ~!InParty("minsc") InMyArea("minsc") InParty("dynaheir") InMyArea("dynaheir") !StateCheck("dynaheir",CD_STATE_NOTVALID) Global("X#DynaheirRep","GLOBAL",1)~ THEN @76 DO ~IncrementGlobal("X#DynaheirRep","GLOBAL",1)~
== ~_BDYNAH~ IF ~!InParty("minsc") InMyArea("minsc") InParty("dynaheir") InMyArea("dynaheir") !StateCheck("dynaheir",CD_STATE_NOTVALID) Global("X#DynaheirRep","GLOBAL",2)~ THEN @74 DO ~IncrementGlobal("X#DynaheirRep","GLOBAL",1)~
== ~_BEDWIN~ IF ~InParty("edwin") InMyArea("edwin") !StateCheck("edwin",CD_STATE_NOTVALID) Global("X#EdwinRep","GLOBAL",0)~ THEN @77 DO ~IncrementGlobal("X#EdwinRep","GLOBAL",1)~
== ~_BEDWIN~ IF ~InParty("edwin") InMyArea("edwin") !StateCheck("edwin",CD_STATE_NOTVALID) Global("X#EdwinRep","GLOBAL",1)~ THEN @78 DO ~IncrementGlobal("X#EdwinRep","GLOBAL",1)~
== ~_BEDWIN~ IF ~InParty("edwin") InMyArea("edwin") !StateCheck("edwin",CD_STATE_NOTVALID) Global("X#EdwinRep","GLOBAL",2)~ THEN @79 DO ~IncrementGlobal("X#EdwinRep","GLOBAL",1)~
== ~_BBRANW~ IF ~InParty("branwen") InMyArea("branwen") !StateCheck("branwen",CD_STATE_NOTVALID) Global("X#BranwenRep","GLOBAL",0)~ THEN @80 DO ~IncrementGlobal("X#BranwenRep","GLOBAL",1)~ 
== ~_BBRANW~ IF ~InParty("branwen") InMyArea("branwen") !StateCheck("branwen",CD_STATE_NOTVALID) Global("X#BranwenRep","GLOBAL",1)~ THEN @81 DO ~IncrementGlobal("X#BranwenRep","GLOBAL",1)~ 
== ~_BBRANW~ IF ~InParty("branwen") InMyArea("branwen") !StateCheck("branwen",CD_STATE_NOTVALID) Global("X#BranwenRep","GLOBAL",2)~ THEN @82 DO ~IncrementGlobal("X#BranwenRep","GLOBAL",1)~ 
== ~_BTIAX~ IF ~InParty("tiax") InMyArea("tiax") !StateCheck("tiax",CD_STATE_NOTVALID) Global("X#TiaxRep","GLOBAL",0)~ THEN @83 DO ~IncrementGlobal("X#TiaxRep","GLOBAL",1)~ 
== ~_BTIAX~ IF ~InParty("tiax") InMyArea("tiax") !StateCheck("tiax",CD_STATE_NOTVALID) Global("X#TiaxRep","GLOBAL",1)~ THEN @84 DO ~IncrementGlobal("X#TiaxRep","GLOBAL",1)~ 
== ~_BTIAX~ IF ~InParty("tiax") InMyArea("tiax") !StateCheck("tiax",CD_STATE_NOTVALID) Global("X#TiaxRep","GLOBAL",2)~ THEN @85 DO ~IncrementGlobal("X#TiaxRep","GLOBAL",1)~
== ~_BVICON~ IF ~InParty("viconia") InMyArea("viconia") !StateCheck("viconia",CD_STATE_NOTVALID) Global("X#ViconiaRep","GLOBAL",0)~ THEN @86 DO ~IncrementGlobal("X#ViconiaRep","GLOBAL",1)~ 
== ~_BVICON~ IF ~InParty("viconia") InMyArea("viconia") !StateCheck("viconia",CD_STATE_NOTVALID) Global("X#ViconiaRep","GLOBAL",1)~ THEN @87 DO ~IncrementGlobal("X#ViconiaRep","GLOBAL",1)~ 
== ~_BVICON~ IF ~InParty("viconia") InMyArea("viconia") !StateCheck("viconia",CD_STATE_NOTVALID) Global("X#ViconiaRep","GLOBAL",2)~ THEN @88 DO ~IncrementGlobal("X#ViconiaRep","GLOBAL",1)~ 
== ~_BSHART~ IF ~InParty("sharteel") InMyArea("sharteel") !StateCheck("sharteel",CD_STATE_NOTVALID) Global("X#SharTeelRep","GLOBAL",0)~ THEN @89 DO ~IncrementGlobal("X#SharTeelRep","GLOBAL",1)~ 
== ~_BSHART~ IF ~InParty("sharteel") InMyArea("sharteel") !StateCheck("sharteel",CD_STATE_NOTVALID) Global("X#SharTeelRep","GLOBAL",1)~ THEN @90 DO ~IncrementGlobal("X#SharTeelRep","GLOBAL",1)~ 
== ~_BSHART~ IF ~InParty("sharteel") InMyArea("sharteel") !StateCheck("sharteel",CD_STATE_NOTVALID) Global("X#SharTeelRep","GLOBAL",2)~ THEN @91 DO ~IncrementGlobal("X#SharTeelRep","GLOBAL",1)~ 
== ~_BALORA~ IF ~InParty("alora") InMyArea("alora") !StateCheck("alora",CD_STATE_NOTVALID) Global("X#AloraRep","GLOBAL",0)~ THEN @92 DO ~IncrementGlobal("X#AloraRep","GLOBAL",1)~ 
== ~_BALORA~ IF ~InParty("alora") InMyArea("alora") !StateCheck("alora",CD_STATE_NOTVALID) Global("X#AloraRep","GLOBAL",1)~ THEN @93 DO ~IncrementGlobal("X#AloraRep","GLOBAL",1)~ 
== ~_BALORA~ IF ~InParty("alora") InMyArea("alora") !StateCheck("alora",CD_STATE_NOTVALID) Global("X#AloraRep","GLOBAL",2)~ THEN @94 DO ~IncrementGlobal("X#AloraRep","GLOBAL",1)~
== ~X#LP1REP~ @95 
END
IF ~ReputationGT(Player1,10)~ THEN REPLY @96 DO ~SetGlobal("X#TroubadorRep","GLOBAL",1) SetGlobal("X#LakeP1RepTalk","GLOBAL",1)~ EXTERN ~X#LP1REP~ X#Troubador1WhyBadGood
IF ~ReputationLT(Player1,11)~ THEN REPLY @96 DO ~SetGlobal("X#TroubadorRep","GLOBAL",1) SetGlobal("X#LakeP1RepTalk","GLOBAL",1)~ EXTERN ~X#LP1REP~ X#Troubador1WhyBadEvil
IF ~~ THEN REPLY @97  DO ~SetGlobal("X#TroubadorRep","GLOBAL",1) SetGlobal("X#LakeP1RepTalk","GLOBAL",1) IncrementGlobal("X#UseTroubadorRep","GLOBAL",1)~ EXTERN ~X#LP1REP~ X#Troubador1MakeBad
IF ~Class(Player1,PALADIN_ALL)~ THEN REPLY @98 DO ~SetGlobal("X#TroubadorRep","GLOBAL",1) SetGlobal("X#LakeP1RepTalk","GLOBAL",1)~ EXIT
IF ~Class(Player1,THIEF_ALL)~ THEN REPLY @99 DO ~SetGlobal("X#TroubadorRep","GLOBAL",1) SetGlobal("X#LakeP1RepTalk","GLOBAL",1)~ EXIT
IF ~GlobalGT("X#TroubadorRep","GLOBAL",0) GlobalGT("X#LakeP1RepTalk","GLOBAL",0)~ THEN REPLY @100 EXTERN ~X#LP1REP~ X#Troubador1RepAlready


The second example is an extreme usage. Each and every BG1 Joinable NPC has three successive replies, different for each of the first three tmes this nonJoinable NPC is visited. So visiting the NPC with different party members or the same party members, the conversation is slightly different each time, and reflects that some party members have been in conversation with him before. Plus, replies by the PC reflect what has happened before.

This kind of extreme usage is not usual; but explains why CHAIN is useful - trying to manually script out that many independednt states manually would take (literally) months of work and playtesting to accomplish for most of us. With a framework in place, CHAIN canbe used to simplify such undertakings.

Edited by cmorgan, 03 July 2007 - 07:19 AM.


#4 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 03 July 2007 - 09:01 AM

Not to disagree with anything cmorgan said (the code works, it's currently in use by a mod) but it's a bit hard to understand if you're just trying to get your head around chain.

So I'm going to post a simpler example, to read and then go back and puzzle through the first one.

First, the nice clean code:
// The following makes a few assumptions:
// cmorgan is a party non-joinable NPC whose DV is "cmorgan" and whose dialogue file is CMORGAN.
// berelinde is a party joinable NPC whose DV is "bere" and whose joined dialogue file is BEREJ
// Minsc is a party joinable NPC whose DV is "Minsc" and whose joined dialogue file is MINSCJ
// This dialogue starts by the party, lead by the PC, walking up to cmorgan and initiating dialogue. This dialogue will only fire if berelinde is in the party, awake, not dead, not silenced, not stunned, and is visible to cmorgan.
// If you want to look for this banter after it's compiled, you will find the first line in cmorgan's dialogue file.

CHAIN
IF
~InParty("bere")
See("bere")
!StateCheck("bere",CD_STATE_NOTVALID)
Global("ExplainChain","GLOBAL",0)~
THEN CMORGAN ExplainChain
~I'm going to explain chain now, using a comprehensive example from BG1 NPC Project.~
DO ~SetGlobal("ExplainChain","GLOBAL",1)~
== BEREJ ~Um, Captain Morgan, the sound you are hearing is his head actually exploding.~
== CMORGAN ~Really?~
== BEREJ ~'Fraid so.~
== CMORGAN ~But it's a good example!~
== BEREJ ~It is, but it's visually imposing.~
== MINSCJ IF ~InParty("Minsc") InMyArea("Minsc") !StateCheck("Minsc",CD_STATE_NOTVALID)~ THEN ~Boo understands it!~
== BEREJ IF ~InParty("Minsc") InMyArea("Minsc") !StateCheck("Minsc",CD_STATE_NOTVALID)~ THEN ~You stay out of it, Minsc! Or don't you remember the trouble you had understanding the meaning of the command APPEND?~
== CMORGAN ~Let's ask <CHARNAME> what <PRO_HESHE> thinks!~
END
++ ~I understood it the first time!~ EXTERN CMORGAN ToldYou
++ ~I'm lost!~ EXTERN BEREJ AnyBetter
+ ~InParty("Minsc") InMyArea("Minsc") !StateCheck("Minsc",CD_STATE_NOTVALID)~ + ~What was that you said about APPEND?~ EXTERN BEREJ OhNo

CHAIN CMORGAN ToldYou
~See! <PRO_HESHE> gets it!~
== BEREJ ~So it would seem.~
== CMORGAN ~You owe me a coffee.~
== BEREJ ~Er, maybe tomorrow.~
EXIT

CHAIN BEREJ AnyBetter
~Is this any better?~
= ~Post your questions below.~
EXIT

CHAIN BEREJ OhNo
~Oh, no. I really can't get into that now.~
= ~Post your questions below.~
EXIT

Now, with comments to explain what each line does:
// The following makes a few assumptions:
// cmorgan is a party non-joinable NPC whose DV is "cmorgan" and whose dialogue file is CMORGAN.
// berelinde is a party joinable NPC whose DV is "bere" and whose joined dialogue file is BEREJ
// Minsc is a party joinable NPC whose DV is "Minsc" and whose joined dialogue file is MINSCJ
// This dialogue starts by the party, lead by the PC, walking up to cmorgan and initiating dialogue. This dialogue will only fire if berelinde is in the party, awake, not dead, not silenced, not stunned, and is visible to cmorgan.
// If you want to look for this banter after it's compiled, you will find the first line in cmorgan's dialogue file.


//chain lets you know you're starting a chain
CHAIN
IF

//berelinde is in the party, visible, and able to speak
~InParty("bere")
See("bere")
!StateCheck("bere",CD_STATE_NOTVALID)

//this dialogue hasn't happened yet
Global("ExplainChain","GLOBAL",0)~

//DIALOGUEFILE (8 characters MAXIMUM) followed by the state label
THEN CMORGAN ExplainChain

//you don't need SAY in chain
~I'm going to explain chain now, using a comprehensive example from BG1 NPC Project.~

//the beauty of CHAIN is that you can perform actions *anywhere* but the action is performed by the last speaker, and the actions won't take effect until the end of the chain.
DO ~SetGlobal("ExplainChain","GLOBAL",1)~

//now, it goes back and forth between cmorgan and berelinde for a while - the first "=" refreshes the dialogue window, the second changes the speaker
== BEREJ ~Um, Captain Morgan, the sound you are hearing is his head actually exploding.~
== CMORGAN ~Really?~
== BEREJ ~'Fraid so.~
== CMORGAN ~But it's a good example!~
== BEREJ ~It is, but it's visually imposing.~

//if Minsc is in the party, in the area, and available to speak, here's something for him to say, and an answer for berelinde to give. If he isn't in the party, it just goes straight to cmorgan's line
== MINSCJ IF ~InParty("Minsc") InMyArea("Minsc") !StateCheck("Minsc",CD_STATE_NOTVALID)~ THEN ~Boo understands it!~
== BEREJ IF ~InParty("Minsc") InMyArea("Minsc") !StateCheck("Minsc",CD_STATE_NOTVALID)~ THEN ~You stay out of it, Minsc! Or don't you remember the trouble you had understanding the meaning of the command APPEND?~

//this line will show no matter what
== CMORGAN ~Let's ask <CHARNAME> what <PRO_HESHE> thinks!~

//ending the chain before getting into the transitions (also called PC responses)
END

//The first "+" stands for IF, the second for THEN REPLY.  You should use EXTERN with CHAIN, followed by the name of the dialogue file and the state label
++ ~I understood it the first time!~ EXTERN CMORGAN ToldYou
++ ~I'm lost!~ EXTERN BEREJ AnyBetter
+ ~InParty("Minsc") InMyArea("Minsc") !StateCheck("Minsc",CD_STATE_NOTVALID)~ + ~What was that you said about APPEND?~ EXTERN BEREJ OhNo

//Hey! What's this? No END? Yes, that's right. You ended the chain before the transitions.


//This is a quicker way to code chain. If it's an unconditional state, or if there are no conditions between the ~~, you can just write CHAIN followed by the dialogue file and the state label
CHAIN CMORGAN ToldYou
~See! <PRO_HESHE> gets it!~
== BEREJ ~So it would seem.~
== CMORGAN ~You owe me a coffee.~
== BEREJ ~Er, maybe tomorrow.~

//When a chain doesn't end in PC responses, you still need to EXIT or EXTERN to another state.
EXIT

CHAIN BEREJ AnyBetter
~Is this any better?~
= ~Post your questions below.~
EXIT

CHAIN BEREJ OhNo
~Oh, no. I really can't get into that now.~
= ~Post your questions below.~
EXIT

Edited by berelinde, 03 July 2007 - 09:03 AM.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#5 Kulyok

Kulyok
  • Modder
  • 2450 posts

Posted 03 July 2007 - 09:10 AM

:D :D :D Full marks, berelinde.

#6 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 04 July 2007 - 01:06 AM

Okay, let me reply, as some know I am not that new to coding... or do I really look like that :unsure:... ;)

The CD state check thingie... I haven't incorperated it yet, I only added it not to get people to say you miss checks... that is really not the problem...

Now I thank both :hug:, but I have to turn to Berlinde cause indeed my head exploded. What I tried to do is to keep it simple... guess I can't do that.

Okay from MWAndia, a file belonging to Andia a new, by the MftW introduced non-joinable NPC.
The beginning of the file

BEGIN MWANDIA

IF ~~ THEN BEGIN MWConAndia1
SAY ~Hello, stranger. What can I do for you?~
IF ~!Dead("Shadelord")~ THEN REPLY ~Who do you think is behind the Umar Hills.~ GOTO MWCONAndia2
IF ~~ THEN REPLY ~I am very tired do you know of safe place to sleep?~ GOTO MWCONAndia3
IF ~CheckStatGT(Player1,12,WIS)~ THEN REPLY ~Well, I am a bit struck by your unusual eye colour.~ GOTO MWCONAndia5
IF ~~ THEN REPLY ~Oh, I know of several ways, hehe.~ GOTO MWCONAndia4
IF ~InParty("Ariena") See("Ariena") Global("Arperqu","GLOBAL",8) Global("RaOrKill","GLOBAL",1)~ THEN REPLY ~I have discovered that the mother of one my compatriots lives here in the guise of a midwife. No more use in hiding.~ GOTO MWCONAndia10
IF ~InParty("Ariena") See("Ariena") Global("Arperqu","GLOBAL",8) !Global("RaOrKill","GLOBAL",1)~ THEN REPLY ~Are you the alleged mother of Ariena? I've come by this information thanks to the Order of the Most Radient Heart.~ GOTO MWCONAndia20
END

IF ~~ THEN BEGIN MWCONAndia2
SAY ~I really don't know for sure, stranger, but I wouldn't be one bit suprised, if it was Umar herself. After all, Fearûn has seen more wonderous things than ancient evils returning.~
IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN MWCONAndia3
SAY ~There is but one place in our humble village that offers beds. It is at the west end of the town square, you can't miss it.~
IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN MWCONAndia4
SAY ~I disagree with your tone, please go away.~
IF ~~ THEN EXIT
END

And so on

This ought to work to my knowledge.

Now from one of these MWCONAndia's I want to get into a chain with a NPC Can I do that by?

IF ~~ THEN BEGIN MWConAndia11
SAY ~Can I help you?~
IF ~~ THEN REPLY ~Please do?~ EXTERN MWAndia MWCONAndia12
END

CHAIN MWAndia MWCONAndia12
~What help do you need?~
== ARIENAJ ~She no help~
== MWANDIA ~I will~
++ ~Please no fight, I am trying to understand this~
END

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#7 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 04 July 2007 - 06:13 AM

OK, but in the CHAIN, you'd want to put the END before the PC replies. There are more than one, right?

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#8 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 04 July 2007 - 07:04 AM

OK, but in the CHAIN, you'd want to put the END before the PC replies. There are more than one, right?


Yes,

and thanks

and... where are all your tutorials that explain these things? I mean your explanations are always marvels to wonder at... and I searched here, but I didn't find anything of you there (some others but not over topics like these).
Please, either (as said in another post I believe) bundle it or I will see myself to bundel it and cry for not being able to see this all in public :crying: :P

Oh small question can you do this than as well (so letting turn back to a true PC Non-joinable PC conversation)?

IF ~~ THEN BEGIN MWConAndia11
SAY ~Can I help you?~
IF ~~ THEN REPLY ~Please do?~ EXTERN MWAndia MWCONAndia13
END

IF ~~ THEN BEGIN MWConAndia12
SAY ~Okay~
IF ~~ THEN REPLY ~wonderful~ EXIT
END

CHAIN MWAndia MWCONAndia13
~What help do you need?~
== ARIENAJ ~She no help~
== MWANDIA ~I will~
== ARIENAJ ~You won't!~
== MWANDIA ~I will!~
END
++ ~Please no fight, I am trying to understand this~ GOTO MWCONAndia12

or do I need to keep on chaining?

Edited by Deathsangel, 04 July 2007 - 07:09 AM.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#9 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 04 July 2007 - 07:18 AM

Thanks!

My weekend project is assembling a links page for all the tutorials and coding examples I've found useful, whether I wrote them, or someone else.

As I've pretty much been answering questions as they arise, using other people's mod ideas, variables, dialogue, and situations, oftentimes on private forums or via PM, I am reluctant to link them directly, however I do see the need to make the most commonly asked questions available for easy reference. I'll see if I can clear them of mod-specific content so as not to spoil them for others.

Right now, I'm concentrating on the basics of dialogue: creating files, basic chain structure, with or without actions and PC responses, scripted dialogue, but I hope to move on to more advanced topics at a later date. If you have any topics you would like convered, I encourage you to let me know!

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#10 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 04 July 2007 - 07:40 AM

You can switch back and forth between CHAIN structure and long-form dialogue at your convenience, however, there are some things to consider.

CHAIN is a very powerful tool. It lets you set variables and insert actions anywhere you want, and it acts as its own APPEND and END. It also allows you to change dialogue files at your convenience. The only time I would recommend not using chain is where you want to set a variable and then use the same variable within the chain itself.

Long-form dialogue, the one that goes

IF ~~ THEN BEGIN FILE state
SAY ~Long-form dialogue has its uses, too!~
IF ~~ THEN EXIT
END

is useful when you want visual on-screen actions to take place while the dialogue is happening, or if you want to set a variable in one state, and use that variable as a trigger a couple responses down.

When you switch back and forth between CHAIN and long-form dialogue, you need to use APPEND and END.

For example, in this hypothetical dialogue, note where the APPEND and ENDs go:
CHAIN BEREJ Coffee
~How about that coffee, cmorgan?~
== CMORGAN ~Sounds good. There's a Starbucks down the street. Want to ask <CHARNAME> to join us?~
== BEREJ ~Sure. Hey <CHARNAME>, want to go get a coffee?~
END
++ ~Sounds good!~ EXTERN BEREJ MyTreat
++ ~Thanks anyway, but I thought I might duck into the Adventure Mart instesad.~ EXTERN BEREJ CatchYouLater

APPEND BEREJ

IF ~~ THEN BEGIN MyTreat
SAY ~Great! My treat!~
IF ~~ THEN EXTERN CMORGAN IGotTheTip
END

IF ~~ THEN BEGIN CatchYouLater
SAY ~OK, we'll meet back here in half an hour.~
++ ~Do you want anything?~ GOTO BEREJ NoThanks
++ ~Can you bring me back a latte?~ GOTO BEREJ SureThing
END

IF ~~ THEN BEGIN NoThanks
SAY ~No, thanks. I've got everything I need. See you in a bit.~
IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN SureThing
SAY ~Sure.~
IF ~~ THEN EXIT
END
END

CHAIN CMORGAN IGotTheTip
~OK, but I got the tip.~
== BEREJ ~You're supposed to tip at Starbucks?~
== CMORGAN ~Yes, actually.~
== BEREJ ~Wow, now I feel like a dope. Good thing you said something.~
EXIT

And with a few comments:
CHAIN BEREJ Coffee
~How about that coffee, cmorgan?~
== CMORGAN ~Sounds good. There's a Starbucks down the street. Want to ask <CHARNAME> to join us?~
== BEREJ ~Sure. Hey <CHARNAME>, want to go get a coffee?~

//here's that END, right before the PC responses. Here we use END to show that we are ending the chain, but not exiting out of the state.
END
++ ~Sounds good!~ EXTERN BEREJ MyTreat
++ ~Thanks anyway, but I thought I might duck into the Adventure Mart instesad.~ EXTERN BEREJ CatchYouLater

//We're leaving CHAIN structure, so we need to append the appropriate dialogue file
APPEND BEREJ

IF ~~ THEN BEGIN MyTreat
SAY ~Great! My treat!~

//Cmorgan has this line, so we're using EXTERN to switch to his file. It doesn't make any difference whether IGotTheTip uses CHAIN or long-form dialogue. EXTERN is EXTERN.
IF ~~ THEN EXTERN CMORGAN IGotTheTip

//When you use long-form dialogue, you still need to END the state, even if you use a transition like EXIT or EXTERN in the line before. If you forget, WeiDU will remind you, in the form of a parsing error.
END

IF ~~ THEN BEGIN CatchYouLater
SAY ~OK, we'll meet back here in half an hour.~

//No need for an END before the transitions here, as we aren't leaving the state, nor are we using CHAIN
++ ~Do you want anything?~ GOTO BEREJ NoThanks
++ ~Can you bring me back a latte?~ GOTO BEREJ SureThing

//Now we end the state.
END

IF ~~ THEN BEGIN NoThanks
SAY ~No, thanks. I've got everything I need. See you in a bit.~
IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN SureThing
SAY ~Sure.~
IF ~~ THEN EXIT
END

//This second END ends the APPEND state. This is necessary before moving to CHAIN format.
END


//I didn't feel like writing out a second APPEND/END block just for one CMORGAN state, so I made it a CHAIN. It uses EXIT to end the state and the CHAIN both.
CHAIN CMORGAN IGotTheTip
~OK, but I got the tip.~
== BEREJ ~You're supposed to tip at Starbucks?~
== CMORGAN ~Yes, actually.~
== BEREJ ~Wow, now I feel like a dope. Good thing you said something.~
EXIT

By the way, I know that you know how much of this works. I'm not being detailed to insult you, but just because it's easier to add the detail at the beginning and let you ignore what you don't need. :)

Edited by berelinde, 04 July 2007 - 07:41 AM.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#11 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 04 July 2007 - 07:55 AM

This is why berelinde is a Goddess, and should be worshipped accordingly. Sacrificing small code snippets in Her Name will be sufficient, I am sure - I start with simple and then jump to complex, with nothing to grab onto in the middle! Wicked good, and fun, berelinde :D

Edited by cmorgan, 04 July 2007 - 08:27 AM.
darn typos - darn slow fingers...


#12 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 04 July 2007 - 08:18 AM

You now that with the explanation you gave me you just solved an old 'not really but a bit' bug of mine... I was having during chains letting stuff happen, but it didn't. Now I know why, but yeah since the dialogue is complicated I have to return back to the long conversation....

Why do I feel like a newbie again, when I am in to modding like 2/3 years....

Oh yeah, I am no immortal

:Bow:

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#13 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 05 July 2007 - 02:43 AM

Oh I just got a short question again...

I thought the following order of things had to be:

Dailogues
Append's
Chain's

P.s. didn't feel insulted, more wanted to say that I wrote things quick down and that is why there were probably mistakes...

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#14 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 05 July 2007 - 02:52 AM

The order of a mod dialogue file doesn't really matter, as long as the code is right. Since CHAIN and INTERJECT_COPY_TRANS functions effectively end a continuous dialogue file, I like to keep my interjections at the beginning, but that is a matter of choice and convenience, not any kind of rule.

I mix CHAIN and long-form dialogue freely, with the appropriate APPEND/END commands. The reason for this is that it's just more convenient for me to be able to keep a particular dialogue together, in the same area of the D than go hunting up and down the file.

In the example I gave above, I switch back and forth twice. If I wanted, I could go back to long-form dialogue after cmorgan's CHAIN by just tacking on another APPEND/END block.

Does that make sense?

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#15 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 05 July 2007 - 04:43 AM

I know what you mean why you want it to be together, but I was once told to do otherwise because of problems with my mod, and stacking them in a certain order solved it...

[edit] Probably we need more of a WeiDu Ninja to say if I am right though...

Edited by Deathsangel, 05 July 2007 - 04:43 AM.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#16 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 05 July 2007 - 04:46 AM

Probably because you weren't using END before inserting a CHAIN, and then APPEND again before the long-form dialogues. Or at least that is what I always do... again and again, even though I know better. If you hit the problem again, you can always post the code around the parsing error, and get it sorted out.

Edited by berelinde, 05 July 2007 - 04:50 AM.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#17 Kulyok

Kulyok
  • Modder
  • 2450 posts

Posted 05 July 2007 - 04:48 AM

All dialogues that are scripted(and trigger when some variable=1, or 2, or 20) are to go first.

All dialogues that are not scripted(a usual Minsc-MyNPC banter, that usually triggers when some variable=0(and this variable sets to 1 after the banter)) are to go last.

That's it, really.

#18 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 05 July 2007 - 09:08 AM

All dialogues that are scripted(and trigger when some variable=1, or 2, or 20) are to go first.

All dialogues that are not scripted(a usual Minsc-MyNPC banter, that usually triggers when some variable=0(and this variable sets to 1 after the banter)) are to go last.

That's it, really.


Moment... does that make it so that all the start up's of every dialogue with the PC should be at the front??

I have like the conversations running down, starting the first being triggered by script and the right one picked out because it is said so with a global. These all need to go up and than the rest under it? That would make it: :wacko: To follow the dialogues through.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#19 berelinde

berelinde

    Troublemaker

  • Modder
  • 4916 posts

Posted 05 July 2007 - 09:38 AM

No, that isn't what she means.

Scripted banters are those that use script to get them to start, usually with an Interact() or StartDialogueNoSet() in the script to get the NPC to start talking.

Unscripted banters are those in the banter file, or the B file, that can be called by the banter engine.

The full and complete answer to this question will take some time. I'd like to leave it until this evening, when I get home from work.

"Imagination is given to man to console him for what he is not; a sense of humor, for what he is." - Oscar Wilde

berelinde's mods
TolkienAcrossTheWater website
TolkienAcrossTheWater Forum


#20 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 05 July 2007 - 11:10 AM

Of course you may leave it, as I got the answer.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~