Jump to content

Dialog Coding Shorthand


Rabain

Recommended Posts

Take a state that looks like this:

 

IF ~~ THEN BEGIN State

SAY ~What's the weather like over there?~

IF ~~ THEN REPLY ~It's quite nice, really.~ GOTO State1

IF ~TimeOfDay(DAY)~ THEN REPLY ~It's a beautiful day.~ GOTO State1

IF ~TimeOfDay(NIGHT)~ THEN REPLY ~It's a nice night.~ GOTO State1

IF ~~ THEN REPLY ~It's a bit warm.~ GOTO State2

IF ~~ THEN REPLY ~Why don't you look out the window?~ GOTO State3

END

 

If you wanted to save yourself a bunch of keystrokes, you could reduce it to:

 

IF ~~ State

SAY ~What's the weather like over there?~

++ ~It's quite nice, really.~ + State1

+ ~TimeOfDay(DAY)~ + ~It's a beautiful day.~ + State1

+ ~TimeOfDay(NIGHT)~ + ~It's a nice night.~ + State1

++ ~It's a bit warm.~ + State2

++ ~Why don't you look out the window?~ + State3

END

 

You don't really need the "THEN BEGIN" part of the first line, for an unconditional state.

 

In the PC reply area,

  1. The first + means "IF".
  2. The second + means "THEN REPLY".
  3. The third + means "GOTO". Note that it means GOTO, not EXTERN, so if you're using chain, you're going to have to spell it out.

If you've got a state where the transition is a GOTO, like this one

 

IF ~~ THEN BEGIN State1

SAY ~That's nice.~

IF ~~ THEN GOTO State4

END

 

You could write it this way instead

 

IF ~~ State1

SAY ~That's nice.~

IF ~~ THEN + State4

END

 

The + there means GOTO, too.

 

As a little extra shorthand, if you're writing chain, you can shorten that a bit, too.

 

CHAIN

IF ~~ THEN BFILE State

~Heya.~

EXIT

 

Could be

CHAIN BFILE State

~Heya.~

EXIT

 

 

Oh, and I should point out that = is for multi-say.

 

Suppose you have this state:

 

IF ~~ THEN State

SAY ~I've had it with all this rain.~

IF ~~ THEN GOTO State1

END

 

IF ~~ THEN State1

SAY ~It's been a very wet summer.~

IF ~~ THEN EXIT

END

 

You could write it like this instead:

 

IF ~~ State

SAY ~I've had it with all this rain.~

= ~It's been a very wet summer.~

IF ~~ THEN EXIT

END

 

Now *that* is a timesaver!

Link to comment

You can do two replies that lead to the same state. You still can create an illusion of a choice, even if it's all railroading. But it is a very, very bad modding practice - and when Bioware did it, it was just as bad. It eliminates all possibility of role-playing, which is what the dialogue is all about.

 

 

@jastey: I think most new tutorials(My "How to ensure your banters always run when you want them to" and "How to avoid duplication in your dialogue files", for example) have this stuff. berelinde's SHS series might, too - though berelinde uses THEN, and I prefer it shorter.

Link to comment

The first time you meet the character he gives an intro speech and then takes you to another state (state2 for example) where he offers you options to choose as reply.

 

The second time you meet him he says something different but still takes you to state2 giving you the same options as reply.

 

To my mind this actually is better than your option as with mine at least there is the chance to say different things each time you meet. With your option I have to repeat the code that constitutes the reply in both the first meeting and the second meeting.

 

My example:

 

1st meeting ~Hi my name is Joe.~ goto offer

 

2nd meeting ~Ah, you have returned my friend.~ goto offer

 

state2 offer ~What can I do for you?~

Reply1

Reply2

Reply3

Link to comment

Ah, then we have misunderstood each other. You see,

++ ~~ + somestate is not the code for what your character says, it's the code for PC's reply.

 

What you're saying would be coded as:

 

// 1st meeting

 

IF ~NumTimesTalkedTo(0)~ state1

SAY ~Hi, my name is Joe.~

IF ~~ + state3

END

 

IF ~NumTimesTalkedToGT(0)~ state2

SAY ~Ah, you have returned, my friend.~

IF ~~ + state3

END

 

IF ~~ state3

SAY ~What can I do for you?~

++ ~Reply1~ + state3.1

++ ~Reply2~ + state3.2

++ ~Reply3~ + state3.3

END

 

 

- so, everything PC says is

++ ~~ + somestate

- and everything your character says has to have a SAY:

SAY ~~

Link to comment

Yes that is what I asked originally: could i use the shorthand "++ ~~ + somestate" as the only reply to the first state in order to take me to a second state that I could reuse later.

 

So for example where you have "IF ~~ + state3" in state1 above could I use "++ ~~ + state3" instead? Inserting globalchecks between ++ if necessary.

Link to comment

The way you have it written, it isn't really a PC reply. This is what the player would see, and it might look funny.

 

Joe: Hi, my name is Joe.

1

 

If you wanted it to just go to the second state, it would be

 

IF ~NumTimesTalkedTo(0)~ State
SAY ~Hi, my name is Joe.~
IF ~~ THEN + State2
END

 

Yes, I use THEN before the transition when it's a terminal transition because it's the only time I do, and it's a flag for me that the transition is a terminal transion (GOTO, EXIT).

 

Because of the way I write, I put in the code first, then fill in the dialogue. I'll copy and paste a series of states down a page and just fill them in. If I decide to add PC responses to them, I sometimes forget to take out the IF ~~ THEN EXIT State, which leads to a NVROL. The THEN makes it easier for me to spot them, after a series of PC replies.

 

This code will result in a NVROL (no valid replies or links)

IF ~~ State
SAY ~Why am I telling you this before I've even had my coffee?~
++ ~Because you're not awake enough to realize why you shouldn't?~ + State2
++ ~No idea.~ + State3
++ ~Because you're stoopid.~ + State4
++ ~I asked, remember?~ + State5
IF ~~ THEN EXIT
END

 

The THEN there stands out like a sore thumb, so it's easy for me to look at the dialogue afterward and realize I screwed up. So when I'm scanning the D before saving for the night, I'll just look for all the THENs, and make sure that I don't have PC replies above them. It really and truly does cut down on the amount of bugs I get first time I sit down to test. It took me ages to figure this out.

 

This is the right way to code the above state:

IF ~~ State
SAY ~Why am I telling you this before I've even had my coffee?~
++ ~Because you're not awake enough to realize why you shouldn't?~ + State2
++ ~No idea.~ + State3
++ ~Because you're stoopid.~ + State4
++ ~I asked, remember?~ + State5
END

Link to comment
So for example where you have "IF ~~ + state3" in state1 above could I use "++ ~~ + state3" instead? Inserting globalchecks between ++ if necessary.

 

If you put

++ ~~ + state3 - you automatically create a PC reply here, so, no, unless you want the PC to say something here, you should stick with

IF ~~ + state3

 

 

IF ~~ + state3 means "Just go to state 3"

++ ~reply~ + state3 means "Say 'reply' and go into state 3."

 

If you want conditions and global checks, you could put them after IF. For example:

 

IF ~~ state

SAY ~Hey! I like girls!~

IF ~Gender(Player1,FEMALE)~ + stateFemale

IF ~Gender(Player1,MALE)~ + statemale

END

 

IF ~~ stateFemale

SAY ~I like you!~

IF ~~ EXIT

END

 

IF ~~ statemale

SAY ~Say, who is that pretty girl right behind you?~

IF ~~ EXIT

END

 

- something like this.

Link to comment
IF ~~ + state3 means "Just go to state 3"

++ ~reply~ + state3 means "Say 'reply' and go into state 3."

 

Right that makes more sense.

 

So even if there was no text in ++ ~reply~ + state3 it would still offer a reply the player needs to click on to continue on?

Link to comment

Nope. You'd see what I've got in the quote box, just a 1 floating in space with nothing after it.

 

The game doesn't care what's between the ~~ there. It would treat

 

++ ~~ + State2

 

and

 

++ ~I need coffee!~ + State2

 

exactly the same.

 

 

At least I think so. Never actually tried that. I'm going to get some coffee, get dressed, go to work, and figure it out later.

Link to comment

Archived

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

×
×
  • Create New...