Jump to content


Photo

Coding questions


  • Please log in to reply
24 replies to this topic

#1 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 14 November 2008 - 06:43 AM

I have a banter, or interjection, coded properly, I think, but how do I get WeiDU actually read it? And what the heck is an argument? Here's the Interjection I'm trying to get it to read:

INTERJECT INYALEE1 1 SarevokNyaleeValygarJaheira
== SAREVOKJ IF ~IsValidForPartyDialog ("Sarevok") ~ THEN
~Does this always happen around you?~
== VALYGARJ IF ~IsValidForPartyDialog ("Valygar") ~ THEN
~Most often, yes. Did I ever tell you about that time with the trolls? We were traipsing through-~
== JAHEIRAJ IF ~IsValidForPartyDialog ("Jaheira") ~ THEN
~Shh!~
END INYALEE1 1

Like I said, I think I have it coded properly, but I'm not sure. Another one is a banter I'm trying to code properly between Sarevok and Valygar. My question is since Valygar is starting the conversation, does this:

CHAIN
IF ~InParty("")
See("")

Go to him or Sarevok? And what should I use for STATE_CHECK? Sleeping or is there something else?

And also, when it's all done properly, what does WeiDU spit out? And what about this?

CHAIN
IF ~InParty("Valygar")
See("Valygar")
!StateCheck("Valygar",STATE_SLEEPING)
Global("ValygarSarevokTalk","LOCALS",0)

It appeared in a TEXTPAD called ss, but I didn't create it. Did WeiDU finally do what I wanted it too?

Or is my memory going? :unsure:

Any help would be greatly appreciated.

Edited by HighTimeRodeo, 14 November 2008 - 06:44 AM.

That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#2 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 14 November 2008 - 06:45 AM

Just for Notifications. I hit post before checking all the boxes. :rolleyes:
That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#3 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 14 November 2008 - 08:22 AM

Well, ok. That interjection is fine.

Basically, instead of IsValidForPartyDialog() I use !StateCheck(dV,CD_STATE_NOTVALID).

What you need now is two files, both are text. Copy that interjection to a textpad and save it as "interjections.d" (With ""). Place it in a Mod folder, (I will call it Mod).

Now, open up a new text document, and type
BACKUP ~Mod/Backup~ //So WeiDU can uninstall everything
AUTHOR ~HighTimeRodeo~ //So we know whom to blame when everything goes wrong

BEGIN ~Interjections~ //Replace the text in ~~ to whatever you like, it is the name of your mod

COMPILE ~Mod/Interjections.d~ //Compiles your .D file to a game readable .DLG

And save it as "Setup-Mod.tp2". Download WeiDU and rename WeiDU.exe as "Setup-Mod.exe". Run the renamed WeiDU executable, and your mod should compile it, and it will be a part of the game.

If it doesn't install, there is an error, and it would only be yours, so just either read it and go to where it tells you do, check for missing ~ and so on, if you missed an END and all that, and then run it again, and keep going until it works.

When it works, you will get your normal dialogue, how you coded it, but before you get your reply options, all these NPCs will have their say, should they be in your party. So it will go something like this:

"Original Text" -> Continue -> "NPC1 if NPC1 is in the party".... to NPC3 -> Replies -> GOTO....

Chain is similar, but it is it's own dialogue block, and cannot fit into others. There are ways of getting an INTERJECT type approach with CHAIN and EXTERN, but normally INTERJECT is best for, well, interjections. Your CHAIN is best for banters, and just thrown in the banter file. It automagically appends to your dialogue, so you can put a chain for anyone, anywhere. CHAIN is best for stand-alone talks, INTERJECT for interjections that can change the conversation, and things like INTERJECT_COPY_TRANS for one-off comments, but don't worry about that yet.

For the record, an argument is usually a field that needs filled, like a name or something.

Icen

Edited by Icendoan, 14 November 2008 - 08:31 AM.

Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#4 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 14 November 2008 - 10:11 AM

CD_STATE_NOTVALID still needs to be added to the ids. Though I don't remember the value...
(With "") - perhaps not with but without? ;)

Another one is a banter I'm trying to code properly between Sarevok and Valygar. My question is since Valygar is starting the conversation, does this:

CHAIN
IF ~InParty("")
See("")

Go to him or Sarevok?

That depends which dialog file you're appending. The owner of the dialog will consider themselves as 'Myself'. Since you want Val to be the initiater, then it may be simplier to APPEND his banter file (bvalyg25, iirc) with the ~InParty("sarevok") See("sarevok")~.

Retired from modding.


#5 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 14 November 2008 - 10:25 AM

No, with and you don't have to respecify the file type, ie, you don't have to select All Files (*.*) in lots of text editors.

Your CHAIN needs to be something like thus:
CHAIN
IF ~InParty("Sarevok")
See("Sarevok")
!StateCheck("Sarevok",CD_STATE_NOTVALID)
Global("##Banter","GLOBAL",0)~ bvalyg25 ##Valg-Sarevok
~Opening text...~
DO ~SetGlobal("##Banter","GLOBAL",1)~
== 25SAREJ ~Text...~
== bvalyg25 ~Response...~ EXIT

CD_STATE_NOT_VALID code.

APPEND ~STATE.IDS~ ~0x80101FEF CD_STATE_NOTVALID~
UNLESS ~CD_STATE_NOTVALID~

Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#6 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 15 November 2008 - 03:03 PM

Thanks for the help! I managed to create a .D file, a TP2 file and a setup exe. Now, I have another question.

The dialog won't compile because is says there's a parsing error when I put SAY into the dialog code line.

Help?
That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#7 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 15 November 2008 - 03:06 PM

Where is your SAY? If you aren't doing straight dialogue, and only CHAINs and INTERJECTions, SAY should be replaced with == dialogName ~text~ [GOTO statelabel/EXIT]

Icen

Edited by Icendoan, 15 November 2008 - 03:07 PM.

Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#8 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 15 November 2008 - 03:26 PM

Er, GOTO statelabel? What does that mean? You'll have to be patient with me, my head is awfully thick tonight.
That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#9 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 15 November 2008 - 04:21 PM

Take a look here : http://forums.gibber...showtopic=15692

and then here: http://forums.gibber...showtopic=15557

and it should help. There is a lot more there, but I would go for a bit of a tutorial run through K'aeloree's stuff after reading that first link. I used a cardplaying analogy that I think will help you out.



Shortcut, if you really aren't interested in reading:

every line is a building block. (state)
every building block has a label. (statename)
every building block gets created, labeled, and organized by a WeiDU command. (IF ~<<some_condition>>~ THEN BEGIN, SAY, IF ~~ THEN REPLY, etc.)
every building block could include an action for the engine to process (DO)
every building block has a transition to another building block, or an exit. (EXIT, GOTO, EXTERN)
every building block has a termination point (END)

CHAIN and INTERJECT/I_C_T hides some of these. But they are still there, just invisible.

INTERJECT INYALEE1 1 SarevokNyaleeValygarJaheira
== SAREVOKJ IF ~IsValidForPartyDialog ("Sarevok") ~ THEN
~Does this always happen around you?~
== VALYGARJ IF ~IsValidForPartyDialog ("Valygar") ~ THEN
~Most often, yes. Did I ever tell you about that time with the trolls? We were traipsing through-~
== JAHEIRAJ IF ~IsValidForPartyDialog ("Jaheira") ~ THEN
~Shh!~
END INYALEE1 1

is really (well, not really, but for the purposes of understanding sake let's simplify it to)

find file:INYALEE1, state 1, and add a new state called SarevokNyaleeValygarJaheira. Now, 

APPEND ~SAREVOKJ~
IF ~IsValidForPartyDialog ("Sarevok") ~ THEN SarevokNyaleeValygarJaheira1
 SAY ~Does this always happen around you?~
 IF ~~ THEN EXTERN ~VALYGARJ~ SarevokNyaleeValygarJaheira1
END
END

APPEND ~VALYGARJ~
  etc.
only a lot more complicated, because the CHAIN is doing all the work of setting up if just Jaheira is in the party, if just Valygar is there, etc - basically building a whole bunch of states for you and saving you hours of work and troubleshooting.

CHAIN does not use SAY. Traditional single-state-at-a-time coding uses SAY to declare the first line, then allows you to move on to other things:
IF ~<<some_condition_exists>>~ THEN BEGIN myNewState
  SAY ~Hey, i am talking now!~
  IF ~no_condition~ THEN REPLY ~The PC is replying, and I want to answer - I think I need to say more, so I will go to a new state~ GOTO myNewStateAnswer1
  IF ~some_condition_exists~ THEN REPLY ~The PC is saying that this conversation is over, so we are exiting dialog~ EXIT
END // of the state labled 'myNewState"

IF ~~ myNewStateAnswer1
  SAY ~Hey, I just took a GOTO transition to a new state! Cool!~
  IF ~have_not_read_tutorials~ THEN REPLY ~Why have you not taken a look at the tutorials on INTERJECT and CHAIN?~ EXIT
  IF ~have_read_tutorials_and_not_understood_them~ THEN REPLY ~That is ok, it takes some time to get the hang of things. I hope the link I gave you above helps explain a bit more.~ EXIT
END.

I could set this up as

#10 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 16 November 2008 - 05:57 PM

Cool thanks for the help.
That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#11 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 17 November 2008 - 09:29 AM

*bangs head against the wall* I'm having more problems with one Interjection than Michael Jackson trying to see his kids....

Okay, Icendoan's == dialogname ~text~ [GOTO statelabel/exit] worked great and it's acutally reading that there is something there. However, its now giving me this....


ERROR locating resource for 'CHAIN3'
Resource [1.DLG] not found in KEY file:
[./chitin.key]
ERROR: preprocessing APPEND_EARLY [Mod/Interjections.d]: Failure("resource [1.DLG] not found for 'CHAIN3'")
Stopping installation because of error.

I swear I'm not trying to drive you guys crazy. I created 1.DLG, but I'm not sure what to put in it. I looked it up on the readme, K'aorlee's (sp?) Coding Interjections Tutorials and then tilted my head sideways in a 'huh?' moment. You guys have been great and I'd really like to say this mod has turned out properly, but it seems to be laughing at me at the moment.

Edited by HighTimeRodeo, 17 November 2008 - 09:35 AM.

That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#12 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 17 November 2008 - 10:04 AM

In your .D file:
BEGIN 1

And you can append to it. :)

Is it in the override folder?
Icen

Edited by Icendoan, 17 November 2008 - 10:05 AM.

Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#13 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 17 November 2008 - 04:23 PM

Great!

Two questions. Is what in override file? And how do you append things? I'm dense, I know. :doh:
That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#14 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 17 November 2008 - 11:47 PM

First of all, the override folder (if I said file, it is because my brain doesn't work) is exactly what it sounds like. It is the first place a game checks for a file, so if you throw something in the override, you changes will override BioWares original, if they existed.

The other option for files is the Data folder, where they are compressed.The override folder was made so you could change the game without having to recompress everything.

To append dialogue, you remove your BEGIN at the start, if it was there, and use this format
APPEND dialogFile

/*-----dialog>-------*/

IF ~~ THEN BEGIN 1
SAY ~Hey, I am at the bottom of the specified file, and so therefore least important!~
IF ~~ THEN REPLY ~You were never important anyway.~ EXIT
++ ~ORLY?~ EXIT //++ is the same as IF ~~ THEN REPLY! Easy to type. If it was ++ ~text~ + the last + means GOTO
END //Of the state

END //Of the APPEND

As a note, the .DLG is NOT NEEDED! If I wanted to APPEND to AERIEJ.dlg, it would be APPEND AERIEJ only.

Icen

Edited by Icendoan, 17 November 2008 - 11:54 PM.

Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#15 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 18 November 2008 - 09:25 AM

Great thanks. Hopefully this is the last block between installing and not installing this mod. Thanks again for all the help.
That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#16 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 18 November 2008 - 09:28 AM

No problem! Always great to see more come up and try modding this game!

Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#17 HighTimeRodeo

HighTimeRodeo

    It's high time the rodeo came to town!

  • Member
  • 160 posts

Posted 19 November 2008 - 12:36 PM

Ya know, now I know why people say coding is so hard to deal with.

Here's my new problem:

[Mod/Interjections.d] PARSE ERROR at line 3 column 1-6
Near Text: APPEND
syntax error

[Mod/Interjections.d] ERROR at line 3 column 1-6
Near Text: APPEND
Parsing.Parse_error
ERROR: parsing [Mod/Interjections.d]: Parsing.Parse_error
ERROR: compiling [Mod/Interjections.d]!
Stopping installation because of error.

So, what exactly is parsing and why does WeiDU insist on it being just so? I've tried all I can think of, but nothing doing.

Help, again!
That gave Jarlaxle pause. "Because I love you as a brother, I pray that you will one day fathom the truth of it all, my friend."

"They're dragons," Entreri muttered. "And I know how Drow love their brothers."

-Road of the Patriarch

#18 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 19 November 2008 - 01:39 PM

Can you post ALL of Interjections.d please. It is likely a typo or missing tilde.

Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo

#19 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 19 November 2008 - 02:54 PM

Line 3 means that an error is located in the third line ('line' means a 'code line', if yours is a lo-ong SAY thing then you text editor may as well display it as several ones) from the top.
Column is, well, the position of character, the first one in line being 1, the second - 2, etc.

So, what weidu says is that your APPEND (columns from 1 to 6) command located at the 3rd line of .d is incorrect. Since APPEND is an opening command, it makes me to believe there's something in the first two lines that shouldn't be there (as usually it's hard to do something with just two lines, especially when compiling a dialog)

Retired from modding.


#20 Icendoan

Icendoan

    "An Infinite Deal of Nothing"

  • Member
  • 1723 posts

Posted 19 November 2008 - 03:25 PM

If it is a SAY, I would attribute it to a missing ~ myself, but having a BEGIN dialogName is a big mistake, as well.

Icen
Proud member of the 'I HATE Elminster!' Club!

Mods in development: Keeping Yoshimo