Jump to content


Photo

WeiDU Compiler Error


  • Please log in to reply
22 replies to this topic

#1 Quitch

Quitch

    Perfection

  • Modder
  • 1132 posts

Posted 25 September 2002 - 10:21 AM

WeiDU compiled the following without trouble:

@602 = ~"I do hope you enjoy a challenge, ." You get the feeling her words are more important than they seem.~
@603 = ~"C-challenge? Oh... oh, I hope not."~
@604 = ~"C-challenge? Oh... oh, me hope not."~
@605 = ~"Just so long as this isn't too rough, I should be okay."
@606 = ~"Me handle... some stuff. Me not handle lots, though."
@607 = ~"I have dealt with challenges before and can handle anything similar again."~
@608 = ~"Me no worry about challenge. Me done that before."~
@609 = ~"Nothing has challenged me thus far. I am ready for this."~
@610 = ~"Me no bat eyelid at other stuff. Me do this easy."~
@611 = ~"I doubt anything on the mortal plane could challenge me now."~
@612 = ~"My blood is Bhaal blood. Me no challenged by anything."~

Notice that both 605 and 606 are missing the tilde. I have had it reported that @605 displays:

"Just so long as this isn't too rough, I should be okay." @606 =

#2 weimer

weimer
  • Member
  • 1569 posts

Posted 25 September 2002 - 01:58 PM

Thank you for reporting this behavior.

This is like complaining that a C compiler compiles this program:

int main() {
 char * a[] = { "hello", "goodbye," "this" }; 
}

Even though the "clear" mistake is that that comma is in the wrong place with respect to the closing quote, it compiles fine (becoming a two-element array thanks to string pasting).

In WeiDU it is valid to say:

@55 = ~Hello, lovely lady.~ ~Hello, handsome man.~

Where the first string is used for male players and the second string is used for female players. This is important for international translations. Your particular example looks like this:

@605 = ~tilde string~ "quote string"

And thus fits that form. :-(

I cannot mechanically distinguish this typo from something you might have wanted to do. At least, I cannot think of any way. If you have any suggestions, I am open to them.

#3 Dyara

Dyara
  • Member
  • 262 posts

Posted 25 September 2002 - 10:44 PM

But string @606 is missing then because itīs inside string @605. Shouldīt WeiDU realize this somehow?

#4 weimer

weimer
  • Member
  • 1569 posts

Posted 25 September 2002 - 11:02 PM

Possibly. Quitch didn't mention his D file referencing @606. In addition, I cannot reproduce that error locally.

q.tra contains:

@602 = ~"I do hope you enjoy a challenge, ." You get the feeling her words are more important than they seem.~
@603 = ~"C-challenge? Oh... oh, I hope not."~
@604 = ~"C-challenge? Oh... oh, me hope not."~
@605 = ~"Just so long as this isn't too rough, I should be okay."
@606 = ~"Me handle... some stuff. Me not handle lots, though."
@607 = ~"I have dealt with challenges before and can handle anything similar again."~
@608 = ~"Me no worry about challenge. Me done that before."~
@609 = ~"Nothing has challenged me thus far. I am ready for this."~
@610 = ~"Me no bat eyelid at other stuff. Me do this easy."~
@611 = ~"I doubt anything on the mortal plane could challenge me now."~
@612 = ~"My blood is Bhaal blood. Me no challenged by anything."~

while test.d contains:

BEGIN FOO

IF ~~ THEN BEGIN s0
  SAY @606
END

Which is a use of @606 that is never defined. When we run WeiDU we get:

tani-no-yuri:/cygdrive/c/src/weidu$ ./weidu.asm.exe q.tra test.d 
[c:\src\weidu\weidu.asm.exe] WeiDU version 75
[C:\Program Files\Black Isle\BGII - SoA/chitin.key] loaded, 590551 bytes
[C:\Program Files\Black Isle\BGII - SoA/chitin.key] 182 BIFFs, 41793 resources
[C:\Program Files\Black Isle\BGII - SoA/dialog.tlk] loaded, 9649307 bytes
[C:\Program Files\Black Isle\BGII - SoA/dialog.tlk] 79991 string entries
[q.tra] parsed (10 translation strings)
[test.d] parsed
Adding FOO to internal list of available DLGs
ERROR: No translation provided for @606
ERROR: cannot resolve strings in FOO
ERROR: Cannot postprocess FOO
ERROR: problem processing D files: Not_found

ERROR: Not_found

Which looks like the correct behavior to me (given the dubious TRA parsing).

#5 Dyara

Dyara
  • Member
  • 262 posts

Posted 26 September 2002 - 01:00 AM

@606 is referenced in the *.d file.

Maybe thereīs a difference if the dialogue is compiled inside a big tp2 file?

#6 weimer

weimer
  • Member
  • 1569 posts

Posted 26 September 2002 - 07:21 AM

I'm not sure where you two are going with this. Can you show me an actual example of some WeiDU input for which WeiDU fails to notice the missing TRA string?

Here's test.tp2:

BACKUP ~mymod/backup~
AUTHOR ~weimer@cs.berkeley.edu~
BEGIN @606

and here's q.tra:

@602 = ~"I do hope you enjoy a challenge, ." You get the feeling her words are more important than they seem.~
@603 = ~"C-challenge? Oh... oh, I hope not."~
@604 = ~"C-challenge? Oh... oh, me hope not."~
@605 = ~"Just so long as this isn't too rough, I should be okay."
@606 = ~"Me handle... some stuff. Me not handle lots, though."
@607 = ~"I have dealt with challenges before and can handle anything similar again."~
@608 = ~"Me no worry about challenge. Me done that before."~
@609 = ~"Nothing has challenged me thus far. I am ready for this."~
@610 = ~"Me no bat eyelid at other stuff. Me do this easy."~
@611 = ~"I doubt anything on the mortal plane could challenge me now."~
@612 = ~"My blood is Bhaal blood. Me no challenged by anything."~

and here's WeiDU's output:

[c:\src\weidu\weidu.asm.exe] WeiDU version 75
[C:\Program Files\Black Isle\BGII - SoA/chitin.key] loaded, 590551 bytes
[C:\Program Files\Black Isle\BGII - SoA/chitin.key] 182 BIFFs, 41793 resources
[C:\Program Files\Black Isle\BGII - SoA/dialog.tlk] loaded, 9649307 bytes
[C:\Program Files\Black Isle\BGII - SoA/dialog.tlk] 79991 string entries
[q.tra] parsed (10 translation strings)
[WeiDU.log] Sys_error("WeiDU.log: No such file or directory")
[test.tp2] parsed (for uninstall)
ERROR: No translation provided for @606
ERROR: problem parsing TP file [test.tp2]: Not_found

ERROR: Not_found

This shows that WeiDU notices the problem in a "small" TP2 file. I then repeated a variant of the experiment using Setup-Solaufein.tp2 (the biggest TP2 file I have available) by removing one of the TRA string definitions from wsetup.tra and got the same results.

I admit that the @606 = ~this~"that" parsing is unintuitive, and I'll take suggestions from the floor on that one. However, I have every reason to believe that WeiDU will notice every used-but-not-defined TRA string. In Quitch's example, @606 probably did not appear in an executed section of his D or TP2 file.

#7 Quitch

Quitch

    Perfection

  • Modder
  • 1132 posts

Posted 26 September 2002 - 09:44 AM

IF ~~ THEN BEGIN eAI
SAY @354 = @602
IF ~CheckStatGT(Player1,7,INT)~ THEN REPLY @603 DO ~SetGlobal("RtWMyDifficulty","GLOBAL",0)~ GOTO eAIDifficultySet
IF ~!CheckStatGT(Player1,7,INT)~ THEN REPLY @604 DO ~SetGlobal("RtWMyDifficulty","GLOBAL",0)~ GOTO eAIDifficultySet
IF ~CheckStatGT(Player1,7,INT)~ THEN REPLY @605 DO ~SetGlobal("RtWMyDifficulty","GLOBAL",1)~ GOTO eAIDifficultySet
IF ~!CheckStatGT(Player1,7,INT)~ THEN REPLY @606 DO ~SetGlobal("RtWMyDifficulty","GLOBAL",1)~ GOTO eAIDifficultySet
IF ~CheckStatGT(Player1,7,INT)~ THEN REPLY @607 DO ~SetGlobal("RtWMyDifficulty","GLOBAL",2)~ GOTO eAIDifficultySet
IF ~!CheckStatGT(Player1,7,INT)~ THEN REPLY @608 DO ~SetGlobal("RtWMyDifficulty","GLOBAL",2)~ GOTO eAIDifficultySet
IF ~CheckStatGT(Player1,7,INT)~ THEN REPLY @609 DO ~SetGlobal("RtWMyDifficulty","GLOBAL",3)~ GOTO eAIDifficultySet
IF ~!CheckStatGT(Player1,7,INT)~ THEN REPLY @610 DO ~SetGlobal("RtWMyDifficulty","GLOBAL",3)~ GOTO eAIDifficultySet
IF ~CheckStatGT(Player1,7,INT)~ THEN REPLY @611 DO ~SetGlobal("RtWMyDifficulty","GLOBAL",4)~ GOTO eAIDifficultySet
IF ~!CheckStatGT(Player1,7,INT)~ THEN REPLY @612 DO ~SetGlobal("RtWMyDifficulty","GLOBAL",4)~ GOTO eAIDifficultySet
END

#8 weimer

weimer
  • Member
  • 1569 posts

Posted 26 September 2002 - 10:23 AM

Thank you for posting a more complicated example.

Here is q.tra:

@354 = ~string 354~
@602 = ~"I do hope you enjoy a challenge, ." You get the feeling her words are more important than they seem.~
@603 = ~"C-challenge? Oh... oh, I hope not."~
@604 = ~"C-challenge? Oh... oh, me hope not."~
@605 = ~"Just so long as this isn't too rough, I should be okay."
@606 = ~"Me handle... some stuff. Me not handle lots, though."
@607 = ~"I have dealt with challenges before and can handle anything similar again."~
@608 = ~"Me no worry about challenge. Me done that before."~
@609 = ~"Nothing has challenged me thus far. I am ready for this."~
@610 = ~"Me no bat eyelid at other stuff. Me do this easy."~
@611 = ~"I doubt anything on the mortal plane could challenge me now."~
@612 = ~"My blood is Bhaal blood. Me no challenged by anything."~

Here is test.d:

BEGIN FOO

   IF ~~ THEN BEGIN eAI
   SAY @354 = @602
   IF ~CheckStatGT(Player1,7,INT)~ THEN REPLY @603 DO
   ~SetGlobal("RtWMyDifficulty","GLOBAL",0)~ GOTO eAIDifficultySet
   IF ~!CheckStatGT(Player1,7,INT)~ THEN REPLY @604 DO
   ~SetGlobal("RtWMyDifficulty","GLOBAL",0)~ GOTO eAIDifficultySet
   IF ~CheckStatGT(Player1,7,INT)~ THEN REPLY @605 DO
   ~SetGlobal("RtWMyDifficulty","GLOBAL",1)~ GOTO eAIDifficultySet
   IF ~!CheckStatGT(Player1,7,INT)~ THEN REPLY @606 DO
   ~SetGlobal("RtWMyDifficulty","GLOBAL",1)~ GOTO eAIDifficultySet
   IF ~CheckStatGT(Player1,7,INT)~ THEN REPLY @607 DO
   ~SetGlobal("RtWMyDifficulty","GLOBAL",2)~ GOTO eAIDifficultySet
   IF ~!CheckStatGT(Player1,7,INT)~ THEN REPLY @608 DO
   ~SetGlobal("RtWMyDifficulty","GLOBAL",2)~ GOTO eAIDifficultySet
   IF ~CheckStatGT(Player1,7,INT)~ THEN REPLY @609 DO
   ~SetGlobal("RtWMyDifficulty","GLOBAL",3)~ GOTO eAIDifficultySet
   IF ~!CheckStatGT(Player1,7,INT)~ THEN REPLY @610 DO
   ~SetGlobal("RtWMyDifficulty","GLOBAL",3)~ GOTO eAIDifficultySet
   IF ~CheckStatGT(Player1,7,INT)~ THEN REPLY @611 DO
   ~SetGlobal("RtWMyDifficulty","GLOBAL",4)~ GOTO eAIDifficultySet
   IF ~!CheckStatGT(Player1,7,INT)~ THEN REPLY @612 DO
   ~SetGlobal("RtWMyDifficulty","GLOBAL",4)~ GOTO eAIDifficultySet
   END

Here is WeiDU's output:

[c:\src\weidu\weidu.asm.exe] WeiDU version 75
[C:\Program Files\Black Isle\BGII - SoA/chitin.key] loaded, 590551 bytes
[C:\Program Files\Black Isle\BGII - SoA/chitin.key] 182 BIFFs, 41793 resources
[C:\Program Files\Black Isle\BGII - SoA/dialog.tlk] loaded, 9649307 bytes
[C:\Program Files\Black Isle\BGII - SoA/dialog.tlk] 79991 string entries
[q.tra] parsed (11 translation strings)
[test.d] parsed
Adding FOO to internal list of available DLGs
ERROR: No translation provided for @606
ERROR: cannot resolve strings in FOO
ERROR: Cannot postprocess FOO
ERROR: problem processing D files: Not_found

ERROR: Not_found

This still looks right to me -- WeiDU notices that @606 is missing. Quitch, perhaps you could post (as attachments, or send to me via email) the complete D and TRA files *and* a clipboard cut-and-paste of the output that you get where WeiDU magically skips over this problem?

Oh, here's one possibility: maybe you are running this from inside a TP2 file *and* there is some other TRA file lying around that was loaded at the same time that defines a @606? The bug may be that TP2 processing is keeping some old TRA file around (which defines @606) when it should be dropping it, which masks the "missing @606" error. If so, I'd need to see your TP2 file and all of the TRA files to debug it properly.

I'm sorry that this is taking so long to nail down, but until I can reproduce it locally I can't really see the problem so I can't see how to fix it.

#9 Dyara

Dyara
  • Member
  • 262 posts

Posted 26 September 2002 - 01:06 PM

Yes, WeiDU uses an old string @606 from another *.tra file instead.

#10 weimer

weimer
  • Member
  • 1569 posts

Posted 26 September 2002 - 01:16 PM

OK.

If you think this is an error, I can try to fix it.

Note that if you have something like:

LANGUAGE ~american~ ~yada~ ~american.tra~
AUTO_TRA ~mymod/%s~

COMPILE ~this.d~
 USING ~a.tra~
            ~b.tra~

Then american.tra, mymod/american/this.tra, a.tra and b.tra are all valid, so if any of them supply @606 WeiDU is doing what I expected.

However, you might make a case that american.tra should not be included in that list.

Let me know what the problem is, I'd love to help you guys out.

#11 -Ghreyfain-

-Ghreyfain-
  • Guest

Posted 26 September 2002 - 05:43 PM

Why not just close @605 and @606 with another tilde? Or do you want an actual error message to be displayed by WeiDU when you forget to close it?

#12 Dyara

Dyara
  • Member
  • 262 posts

Posted 26 September 2002 - 11:23 PM

@weimer:

No, itīs like

AUTO_TRA ~RtW/TRA/%s~

LANGUAGE ~English (International)~
         ~english (international)~
         ~RtW/TRA/english (international)/setup.tra~

/* a lot of other stuff */

COMPILE

/* some dialogues  */

// Dasypus (big dialogue with @606 defined)

~RtW/D/RTWDasyp.d~

/* some more dialogues */

// Jarata (another big dialogue without @606 in the tra file but itīs in the d file)

~RtW/D/RTWJar01.d~

/* some more dialogues */

...

Since the error is in the tra file I wouldīt call it an error in WeiDU but perhaps a 'nice-to-have' feature :).

@Ghreyfain: Of course thereīs no problem to close @605 and @606 with another tilde. The problem is that maybe there are many more missing tildes. After putting text in a tra-file I realized that I had forgotten nearly 30% of the closing tildes :D. It wasnīt a problem because I compiled that dialogue separately, but if you only make small changes to an existing tra file you probably wonīt do this. So yes, itīs the error message.

#13 weimer

weimer
  • Member
  • 1569 posts

Posted 26 September 2002 - 11:30 PM

The best thing I can think of is to have TRA files warn you if any tra-string has @[0-9] inside it. Would that work?

#14 Dyara

Dyara
  • Member
  • 262 posts

Posted 26 September 2002 - 11:35 PM

Yes, it would help to find the error with @605/@606 and missing tildes.
But no, it wouldnīt find missing strings in a tra file, I guess.

Are there any reasons that WeiDU keeps old tra files in memory when it compiles another dialogue?

#15 weimer

weimer
  • Member
  • 1569 posts

Posted 27 September 2002 - 01:05 PM

Yes, that's a specific feature to ease foreign language translations. In general, the non-English translations lag a few strings behind the English default. So you just apply the English TRA and then the Foreign one on top of it. All of the translated strings go through correctly, and all of the ones that were not translated default back to the English. There are other benefits, but that's the main one.

#16 -jcompton-

-jcompton-
  • Guest

Posted 27 September 2002 - 04:10 PM

I'll just pipe up here and say that it's a syntax error and the fewer things we are prevented from doing inside a SAY string (because WeiDU filters it out or thinks it's an error), the better.

#17 Dyara

Dyara
  • Member
  • 262 posts

Posted 27 September 2002 - 09:52 PM

@weimer: Okay, but why does WeiDU take strings from RtWDasyp.tra when it compiles RtWJar01.tra. It seems to me that we are talking from different things ;). Itīs not a problem with an English tra file and a non-English tra file :).

#18 weimer

weimer
  • Member
  • 1569 posts

Posted 28 September 2002 - 02:22 PM

Because you put them in the same COMPILE block. If there is a great hue and cry I could try to change it so that AUTO_TRA tra files are only associated with exactly the DLG file they match names with, but currently that is not the semantics. I fear that if I change it at this point, someone's mod will suddenly stop installing correctly when the upgrade to a new WeiDU.

#19 Dyara

Dyara
  • Member
  • 262 posts

Posted 29 September 2002 - 12:14 AM

Ah, I see. So the reason is that thereīs only one compile statement for all the dialogues?

Are there any disadvantages using a separate 'compile' for each *.d file?

#20 -jcompton-

-jcompton-
  • Guest

Posted 29 September 2002 - 10:05 AM

When you compile multiple .ds in a single COMPILE statement, you can reference labels between them. WeiDU Ascension makes a lot of use of this because it was the easiest and fastest way to break that mod out of the old hard-coded format. I don't know how Quitch has decided to write the .d's for RtW but it's somewhat less necessary to do so starting with a fresh WeiDU development, since a single .d file can define any number of new DLGs and execute APPEND/EXTEND/etc actions.