Jump to content

Question to CHAIN2


jastey

Recommended Posts

Hi,

 

for BGII mod I want to use CHAIN2 instead of CHAIN (makes reading the .d-files a lot easier) but I don't know how the syntax should be. The WeiDU-help sais about CHAIN2:

 

CHAIN2 entryFilename entryLabel chain2Text list exitFilename exitLabel

 

This is legacy syntax that behaves somewhat like the D Action CHAIN but is considered a state. In addition, chain2Text is slightly different from chainText. Avoid this construction.

 

Who can tell me, how "chain2Text" has to look like? (And who knows why CHAIN2 is not recommended?)

 

I want to write something like the following CHAIN (this CHAIN is running) as CHAIN2. Is it possible?

 

CHAIN

IF ~~ THEN Bmyguy talk_1_chain

~text bla~

== BANOMEN IF ~InParty("ANOMEN") !Dead("ANOMEN") !StateCheck("ANOMEN",STATE_SLEEPING)~ THEN ~blabla~

== Bmyguy IF ~InParty("ANOMEN") !Dead("ANOMEN") !StateCheck("ANOMEN",STATE_SLEEPING)~ THEN ~blabla~

== BANOMEN IF ~InParty("ANOMEN") !Dead("ANOMEN") !Global("AnomenIsNotKnight","GLOBAL",1) !StateCheck("ANOMEN",STATE_SLEEPING) !Global("AnomenRomanceActive","GLOBAL",2)~ THEN ~bla~

== BANOMEN IF ~InParty("ANOMEN") !Dead("ANOMEN") Global("AnomenIsNotKnight","GLOBAL",1) !StateCheck("ANOMEN",STATE_SLEEPING)~ THEN ~bla~

= ~bla~

== BANOMEN IF ~InParty("ANOMEN") !Dead("ANOMEN") !StateCheck("ANOMEN",STATE_SLEEPING) Global("AnomenRomanceActive","GLOBAL",2) !Global("AnomenIsNotKnight","GLOBAL",1)~ THEN ~bla~

== Bmyguy ~blabla~

END

+ ~InParty("ANOMEN") !Dead("ANOMEN") !StateCheck("ANOMEN",STATE_SLEEPING) Global("AnomenRomanceActive","GLOBAL",2) !Global("AnomenIsNotKnight","GLOBAL",1)~ + ~bla~ EXTERN ~BANOMEN~ answer_1

++ ~bla~ EXTERN Bmyguy answer_2

++ ~bla~ EXTERN Bmyguy answer_3

 

 

Thanks for your answers!

 

PS: I am currently using WeiDU. 153

Link to comment

How about:

 

CHAIN Bmyguy talk_1_chain

~text bla~

== BANOMEN IF ~InParty("ANOMEN") !Dead("ANOMEN") !StateCheck("ANOMEN",STATE_SLEEPING)~ THEN ~blabla~

== Bmyguy IF ~InParty("ANOMEN") !Dead("ANOMEN") !StateCheck("ANOMEN",STATE_SLEEPING)~ THEN ~blabla~

== BANOMEN IF ~InParty("ANOMEN") !Dead("ANOMEN") !Global("AnomenIsNotKnight","GLOBAL",1) !StateCheck("ANOMEN",STATE_SLEEPING) !Global("AnomenRomanceActive","GLOBAL",2)~ THEN ~bla~

== BANOMEN IF ~InParty("ANOMEN") !Dead("ANOMEN") Global("AnomenIsNotKnight","GLOBAL",1) !StateCheck("ANOMEN",STATE_SLEEPING)~ THEN ~bla~

= ~bla~

== BANOMEN IF ~InParty("ANOMEN") !Dead("ANOMEN") !StateCheck("ANOMEN",STATE_SLEEPING) Global("AnomenRomanceActive","GLOBAL",2) !Global("AnomenIsNotKnight","GLOBAL",1)~ THEN ~bla~

== Bmyguy ~blabla~

END

+ ~InParty("ANOMEN") !Dead("ANOMEN") !StateCheck("ANOMEN",STATE_SLEEPING) Global("AnomenRomanceActive","GLOBAL",2) !Global("AnomenIsNotKnight","GLOBAL",1)~ + ~bla~ EXTERN ~BANOMEN~ answer_1

++ ~bla~ EXTERN Bmyguy answer_2

++ ~bla~ EXTERN Bmyguy answer_3

 

I remember reading somewhere why using CHAIN2 was a really bad idea, but I don't remember where it was. I don't think that using CHAIN2 over CHAIN makes things easier to read.

Link to comment

Is this the syntax for CHAIN 2 or are you guessing?

 

With "easier to read" I only meant that CHAIN2 doesn't have to be at the end of the .d-file like CHAIN because it is considered a state, so while reading the .d-file you don't have to "hop" to and fro.

Link to comment

CHAIN2 is wildly discouraged because...

 

- You cannot begin or end a dialogue in a CHAIN2 : something must always GOTO/EXTERN to it and you must always end it by going to another state.

- You cannot perform any conditional checks or any DO actions inside a CHAIN2

- You can only have two participants--so no room for interjections.

- Weimer says not to use it anymore.

 

That said, Kelsey-SOA as well as Solaufein have examples of CHAIN2 coding, but please don't. :(

Link to comment
CHAIN used to have a completely different syntax, then weimer changed it to = CHAIN3.

No, you're thinking of the CHAIN/CHAIN2 split, which was something different.

 

Okay, class. Gather 'round, it's story time.

 

IN THE BEGINNING, there was the "Weimer Dialogue Compiler & Utilities." ("dc" for short.) This is what Wes created Solaufein single-digit-versions in.

 

dc supported a function called CHAIN. It supported two participants ONLY. It did not support state or transition triggers, it did not support any ending except a goto/extern to ANOTHER state (i.e., you could not begin or end a conversation in a CHAIN, you always needed two long-form states to book-end it.)

 

Once Ghrey and I got interested in dc and started beating it to death porting Kelsey and inundating Wes with bug reports and feature requests, he grew tired of the programmed-in-C mess he'd created

 

Version 2.13 (The Wrath of Jason)

* Fixed an EXTEND bug that came about because I tried to skimp

on memory allocation. I should be using a real language! Augh!

 

and decided to start anew with the OcaML-coded WeiDU.

 

WeiDU included a number of improvements, and a few changes for the vast universe of other Weimeric mod developers (which at the time was pretty much, uh... Wes, me, Ghrey, Blucher, and Arian.)

 

One of the changes was that the CHAIN we had been using (see above) became CHAIN2.

 

What was now called CHAIN was abstracted so that it would support ANY number of participants, not two and only two.

 

In WeiDU V54, Weimer added the ability to do "conditional chaining." That is, the

 

== BANOMEN IF ~InParty("Anomen")~ THEN ~We should not be wasting our time in this manner!~

 

stuff.

 

Initially, this functionality was only available if you used the opcode "CHAIN3." He created a new opcode to be super-sure that he wouldn't break any old code, since he knew modders got cranky when they had to redistribute their mods with changes.

 

But I took a look at the syntax and pointed out to Weimer that there was actually no reason that CHAIN couldn't support what CHAIN3 was doing, because they were completely identical except for the optional conditional portions. So CHAIN and CHAIN3 became synonyms.

 

Over time, CHAIN evolved to allow transition lists, state triggers, DO actions, and all that other great stuff.

 

So, to sum up, the name "CHAIN3" is really just a historical accident born of Weimer being afraid I'd be cranky if conditional chaining happened to break the established CHAIN syntax, which, in fact, it didn't. Smiles all around.

Link to comment

Yes, in those wild frontier days, version histories had a sort of down-home charm. There was an entire rock block at one point (and note how wild and wooly those frontier days were, what with repeated version numbers and all.)

Version 2.11 (Jason and Ghrey strike back!)

* Fixed a bug where "REPLACE" could not possibly work because I

coded the wrong algorithm.

* Fixed a bug involving files with large raw-string pools.

Version 2.11 (Return of the Jason)

* Fixed yet another REPLACE bug.

Version 2.12 (Jason: The Final Frontier)

* Add the "--out" option back to DD.

* Fixed yet another REPLACE bug.

Link to comment
CHAIN used to have a completely different syntax, then weimer changed it to = CHAIN3.

No, you're thinking of the CHAIN/CHAIN2 split, which was something different.

 

Okay, class. Gather 'round, it's story time.

 

IN THE BEGINNING, there was the "Weimer Dialogue Compiler & Utilities." ("dc" for short.) This is what Wes created Solaufein single-digit-versions in.

 

dc supported a function called CHAIN. It supported two participants ONLY. It did not support state or transition triggers, it did not support any ending except a goto/extern to ANOTHER state (i.e., you could not begin or end a conversation in a CHAIN, you always needed two long-form states to book-end it.)

 

Once Ghrey and I got interested in dc and started beating it to death porting Kelsey and inundating Wes with bug reports and feature requests, he grew tired of the programmed-in-C mess he'd created

 

Version 2.13 (The Wrath of Jason)

* Fixed an EXTEND bug that came about because I tried to skimp

on memory allocation. I should be using a real language! Augh!

 

and decided to start anew with the OcaML-coded WeiDU.

 

WeiDU included a number of improvements, and a few changes for the vast universe of other Weimeric mod developers (which at the time was pretty much, uh... Wes, me, Ghrey, Blucher, and Arian.)

 

One of the changes was that the CHAIN we had been using (see above) became CHAIN2.

 

What was now called CHAIN was abstracted so that it would support ANY number of participants, not two and only two.

 

In WeiDU V54, Weimer added the ability to do "conditional chaining." That is, the

 

== BANOMEN IF ~InParty("Anomen")~ THEN ~We should not be wasting our time in this manner!~

 

stuff.

 

Initially, this functionality was only available if you used the opcode "CHAIN3." He created a new opcode to be super-sure that he wouldn't break any old code, since he knew modders got cranky when they had to redistribute their mods with changes.

 

But I took a look at the syntax and pointed out to Weimer that there was actually no reason that CHAIN couldn't support what CHAIN3 was doing, because they were completely identical except for the optional conditional portions. So CHAIN and CHAIN3 became synonyms.

 

Over time, CHAIN evolved to allow transition lists, state triggers, DO actions, and all that other great stuff.

 

So, to sum up, the name "CHAIN3" is really just a historical accident born of Weimer being afraid I'd be cranky if conditional chaining happened to break the established CHAIN syntax, which, in fact, it didn't. Smiles all around.

Ah, legendary times of modding community... :( Thank you for sharing, JC. I take it that I can switch from CHAIN3 to CHAIN now without fear and document myself as the latest person to have used it?

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...