with dialogue (between two or more npcs), conceptually, you're doing: a '3 way handshake' (coding~programming), as you got to check on both (or all) of their states (flags), to determine what the response~output will be for that scenario of their states.
http://www.inetdaemon.com/tutorials/int ... hake.shtml1. HK says (sends) 'hi' SYN to OJ
2. OJ says (sends) 'yes, I heard your "hi" to me' ACK to HK, and also OJ says (sends) 'hi' SYN to HK. Aka, a SYN-ACK is sent to HK.
(2.5. if OJ doesn't send the ACK to HK, then HK will resend his 'hi' SYN to OJ)
3. HK says (sends) 'yes, I heard your "hi" to me' ACK to OJ
(3.5. if HK doesn't send the ACK to OJ, then OJ will resend his 'hi' SYN to HK)
4. Greetings completed.
and we ourselves do this too, but our brains do it instantaneously, so we're completely unaware that we do communication exactly as how computers do communication, as there's ONLY 1 WAY to communicate, which is why humans and computers use the same method to communicate: it is the only method to communicate!
---------
here's an analogy example:
bob, bill, red shirts, blue shirts
how many combinations do we have?
1. bob:red and bill:blue
2. bob:red and bill:red
3. bob:blue and bill:red
4. bob:blue and bill:blue
if (bob:red and bill:red) {
-> msg (blah1)
} else if (bob:red and bill:blue) {
-> msg (blah2)
} else if (bob:blue and bill:red) {
-> msg ("blah3)
} else if (bob:blue and bill:blue) {
-> msg ("blah4")
}
---------------
npc1 = bob
npc2 = bill
red shirt = 0
blue shirt = 1
if (npc1.shirt = 0 and npc2.shirt = 0) {
-> msg ("blah1")
} else if (npc1.shirt = 0 and npc2.shirt = 1) {
-> msg ("blah2")
} else if (npc1.shirt = 1 and npc2.shirt = 0) {
-> msg ("blah3")
} else if (npc1.shirt = 1 and npc2.shirt = 1) {
-> msg ("blah1")
}
-------------
bill.dialogue = 0
bob.dialogue = 0
Bill:
Verb: talk
if (bill.dialogue = 0 and bob.dialogue = 0) {
-> msg ("Hi, I'm Bill. Go say hi to my friend Bob.")
-> bill.dialogue = 1
} else if (bill.dialogue = 0 and bob.dialogue = 1) {
-> msg ("Hi, I'm Bill. I see you already met my friend, Bob.")
-> bill.dialogue = 1
} else if (bill.dialogue = 1 and bob.dialogue = 0) {
-> msg ("Go say hi to my friend bob.")
} else if (bill.dialogue = 1 and bob.dialogue = 1) {
-> msg ("Go say goodbye to my friend, bob.")
-> bill.dialogue = 2
} else if (bill.dialogue = 2 and bob.dialogue = 1) {
-> msg ("Again, Go say goodbye to my friend, bob.")
} else if (bill.dialogue = 2 and bob.dialogue = 2) {
-> msg ("You've won the game!")
-> finish
}
Bob:
Verb: talk
if (bill.dialogue = 0 and bob.dialogue = 0) {
-> msg ("Hi, I'm Bob. Go say hi to my friend bill.")
-> bob.dialogue = 1
} else if (bill.dialogue = 0 and bob.dialogue = 1) {
-> msg ("Go say hi to my friend Bill.")
} else if (bill.dialogue = 1 and bob.dialogue = 0) {
-> msg ("Hi, I'm Bob. I see you already met my friend, Bill.")
-> bob.dialogue = 1
} else if (bill.dialogue = 1 and bob.dialogue = 1) {
-> msg ("Go say goodbye to my friend, bill.")
-> bob.dialogue = 2
} else if (bill.dialogue = 1 and bob.dialogue = 2) {
-> msg ("Again, Go say goodbye to my friend, bill.")
} else if (bill.dialogue = 2 and bob.dialogue = 2) {
-> msg ("You've won the game!")
-> finish