Jump to content


Photo

Validate actions and triggers in *.d files


  • Please log in to reply
20 replies to this topic

#1 Dyara

Dyara
  • Member
  • 262 posts

Posted 13 November 2002 - 09:25 AM

I´ve written a small command-line tool that validates all the actions and triggers in WeiDU *.d files. It can also write the names of variables or timers into a text file to find misspelled names or the using of wrong namespaces (GLOBAL instead of LOCALS and vice versa).

It´s here available for download.

There´s a large readme included. I hope it´s comprehensible, if not feel free to ask.

#2 weimer

weimer
  • Member
  • 1569 posts

Posted 18 November 2002 - 05:01 PM

(bump)

To Dorotea, the Redemption author -- this is the tool you want to look into to chase down the script errors in your D files.

#3 dorotea

dorotea

    witch extraordinaire

  • Modder
  • 1927 posts

Posted 18 November 2002 - 05:11 PM

Actually, I already downloaded it and used it to validate Redemption.
I wanted to thank the author myself, but since I am a great procrastinator -I never did. It is a big help indeed. Right now I need help with scripting and precisely - how to use WEIDU to modify a block inside bcs's but I am working on it.

Again - I do recommend Validate. It is a great tool. My only comment will be it does not recognise some of the alignments from 'alignmen.ids'.

Freedom cannot be equated with goodness, virtue, or perfection. Freedom has its own unique self-contained nature; freedom is freedom ? not universal goodness. Any confusion or deliberate equalization of freedom with goodness and excellence is in itself negation of freedom, and acceptance of the path of restraint and enforcement.

Nikolai Berdyaev - Christian Existentialist, Philosopher of Freedom.


The Longer Road mod
Redemption mod
Bitter Grey Ashes


#4 Dyara

Dyara
  • Member
  • 262 posts

Posted 18 November 2002 - 11:37 PM

Hmmm, which alignments doesn´t it recognise? I´m a little bit surprised because the technique is the same for all IDS files and the entries in alignmen.ids don´t look different. Anyway I think that alignmen.ids is not used at all in any actions or triggers. It´s allways align.ids which is exactly the same file with a different name.

Another possibility might be that you´ve exported the ids file with NI without saving it to the override folder first. To export a file with NI means 'write the file as it is'. Because files not found in the override folder are compressed the exported ids file is compressed too and that´s why validateD doesn´t recognise any entries.

Btw, current version of ValidateD is 1.21. Some bugs are fixed and it finds some more bugs and errors.

#5 japheth

japheth

    Codewalker

  • Member
  • 317 posts

Posted 19 November 2002 - 01:10 PM

Yeah, some of the ids files are encoded with a simple 64 bit algorithim.

Jon is adding support to the next version of NI so that when you export them they will be decoded properly.
Check out BG1Tutu.

#6 Dyara

Dyara
  • Member
  • 262 posts

Posted 22 November 2002 - 06:06 AM

Some bugs fixed -> new version 1.212 available.

#7 Dyara

Dyara
  • Member
  • 262 posts

Posted 12 January 2003 - 02:13 AM

New version 2.0 available, ValidateD now supports script files (BAF and BCS/BS) too. To read BCS/BS files it needs help from a command-line script decompiler (like WeiDU for example).

Features:

a) Checks actions and triggers in d files (now obsolete since WeiDU does it too), checks actions and triggers in script files (slightly better than decompilers like NI, InfExpl or WeiDU because it finds bugs like 'Dead("astSeenBy())")' which I was told are common decompile bugs but once you compile such a script again these bugs are also in your BCS file.

b) Creates a list of names used in your dialogues (D files) and/or in your script files. With this list you can easily find error like:

- using a variable as GLOBAL and as LOCALS,
- misspelling of names (variables),
- using variables with and without your mod prefix,
- mixing up parameters ('HasItem("Keldorn","SW2H10")' or 'HasItem("SW2H10","Keldorn")',
- using not existing items, spells,...

and perhaps many more...

#8 Saru

Saru
  • Member
  • 6 posts

Posted 12 January 2003 - 08:07 AM

I just saw this thread today, and was completely surprised at the lack of responses commending you. :blink:

This program is an incredible idea, and works beautifully -- it's something that I've always wanted to be able to do with my .D files; get a text print out of all the Globals initiated and changed (and their line numbers!) and a listing of errors. I ran it on a dialogue I coded months ago, and it caught an error WeiDU was terribly vague on, and I had forgotten about. (And did I mention that global print out is ridiculously useful?)

Congratulations on writing this, and thank you for releasing it!

#9 Blucher

Blucher
  • Member
  • 97 posts

Posted 12 January 2003 - 10:12 AM

I don't want to thank Dyara too much, or she might get annoyed. :)

This program is very nice. I put ValidateD (and its .dat file) and WeiDU in a system path directory with a whack-load of .bat files. Modding has never been so nice.

#10 Quitch

Quitch

    Perfection

  • Modder
  • 1132 posts

Posted 13 January 2003 - 03:20 PM

Thanks for the extra work this has generated for me, Dyara. On the other hand it has generated more for Cuv, so it can only be a good thing.

#11 Dyara

Dyara
  • Member
  • 262 posts

Posted 25 January 2003 - 02:59 PM

New version 2.5 is available. ValidateD is renamed to DyValiTo (DYara´s VALIdate TOol :D).

DyValiTo now uses WeiDU (or any other command-line BIFF extracting tool) to extract IDS files from BIFF files.

#12 Blucher

Blucher
  • Member
  • 97 posts

Posted 25 January 2003 - 03:08 PM

Cool. :)

#13 -Devon-

-Devon-
  • Guest

Posted 25 January 2003 - 10:35 PM

Must have source code to port to Mac OS X.

Must curse DOS for using '\' as path seperators even when the '\' is the harder charater on the keyboard to reach. The '/' is a much better seperator and '-' is a much better switch and a switch you can confuse with the path seperator.

Must end rant.

Cheers,
Devon Smith

#14 Dyara

Dyara
  • Member
  • 262 posts

Posted 26 January 2003 - 01:58 AM

Must curse DOS for using '\' as path seperators even when the '\' is the harder charater on the keyboard to reach.


Hmmm, I can type a '\' using only one hand (two fingers). To type a '/' I need two hands :D. But I will change from '\' to '/'.

I will also allow '-' as switch in the next version. But most likely you don´t need much switches. The defaults are pretty good and for the rest I use an ini file.

Must have source code to port to Mac OS X.


If you really want to port it to Mac OS X send my a PM or an email. (But the source is soooo ugly.)

#15 -Devon-

-Devon-
  • Guest

Posted 26 January 2003 - 10:51 AM

The big problem I really had with DOS is that I will spend so much time with Unix that when I got back to dos I would type commands like this:

dir \w

And I would get File Not Found errors. Actually, I would type 'ls' before remembering to use 'dir'.

I will busy the next few days, so I'll probably try to retrieve the code on Tuesday if you don't mind. Don't worry about its messiness, as long as its either in Basic, C, C++ or Java, I should be fine(I'm strangely enough beginning to understand a little Ocaml - though just a little). Pascal might be a problem though, I haven't seen that language in such a long time.

Cheers,
Devon Smith

#16 Dyara

Dyara
  • Member
  • 262 posts

Posted 26 January 2003 - 11:39 AM

It´s C++ but uses some classes from MFC (CObject, CRuntimeClass, CString, CStringList, CStringArray, CMapStringToOb).

#17 Dyara

Dyara
  • Member
  • 262 posts

Posted 08 March 2003 - 03:13 PM

New version 2.6 available here.

New in this version:

DyValiTo can create a debug script that allows displaying the values of variables in the BG2 message window.

The debug script looks like:
IF
  HotKey(D)
THEN
  RESPONSE #100
    SetGlobal("DEBUGStartGlobalDebug","GLOBAL",1)
END

IF
  Global("DEBUGStartGlobalDebug","GLOBAL",1)
  AreaCheck("ARRTW5")
THEN
  RESPONSE #100
    DisplayStringNoName(Myself,~Starting ARRTW5 debug output:~)
    SetTokenGloba("RtWTombGuardDescription","ARRTW5","DEBUGOUTPUT")
    DisplayStringNoName(Myself,~ARRTW5 RtWTombGuardDescription: <DEBUGOUTPUT>~)
    Continue()
END

IF
  Global("DEBUGStartGlobalDebug","GLOBAL",1)
THEN
  RESPONSE #100
    DisplayStringNoName(Myself,~Starting GLOBAL debug output:~)
    SetTokenGlobal("AerieHardened","GLOBAL","DEBUGOUTPUT")
    DisplayStringNoName(Myself,~GLOBAL AerieHardened: <DEBUGOUTPUT>~)
    SetTokenGlobal("AerieRomanceActive","GLOBAL","DEBUGOUTPUT")
    DisplayStringNoName(Myself,~GLOBAL AerieRomanceActive: <DEBUGOUTPUT>~)
    SetTokenGlobal("AnomenIsKnight","GLOBAL","DEBUGOUTPUT")
    DisplayStringNoName(Myself,~GLOBAL AnomenIsKnight: <DEBUGOUTPUT>~)
    SetTokenGlobal("AnomenIsNotKnight","GLOBAL","DEBUGOUTPUT")
    DisplayStringNoName(Myself,~GLOBAL AnomenIsNotKnight: <DEBUGOUTPUT>~)
    SetTokenGlobal("AnomenRomanceActive","GLOBAL","DEBUGOUTPUT")
    DisplayStringNoName(Myself,~GLOBAL AnomenRomanceActive: <DEBUGOUTPUT>~)
    SetTokenGlobal("JaheiraRomanceActive","GLOBAL","DEBUGOUTPUT")
    DisplayStringNoName(Myself,~GLOBAL JaheiraRomanceActive: <DEBUGOUTPUT>~)
    SetTokenGlobal("Kidnap","GLOBAL","DEBUGOUTPUT")
    DisplayStringNoName(Myself,~GLOBAL Kidnap: <DEBUGOUTPUT>~)
    SetTokenGlobal("KorganMazzy25","GLOBAL","DEBUGOUTPUT")
    DisplayStringNoName(Myself,~GLOBAL KorganMazzy25: <DEBUGOUTPUT>~)
    ...
    Continue()
END

IF
  Global("DEBUGStartGlobalDebug","GLOBAL",1)
THEN
  RESPONSE #100
    SetGlobal("DEBUGStartGlobalDebug","GLOBAL",0)
END

After compiling this script with WeiDU (version 114 or higher)

WeiDU debug.baf --tlkout dialog.tlk (--ftlkout dialogf.tlk) -- out scripts

and renaming the file debug.bcs into debug.bs you can start BG2, assign the script to a char, turn AI on and press 'D'.

You will get an output like

Posted Image

In the current version you can only display GLOBALs and area variables but I´m still looking for a good way to display also the LOCALS of a selected creature.

#18 -Sim-

-Sim-
  • Guest

Posted 08 March 2003 - 03:19 PM

Did the specifics method not work for you, then?

#19 Dyara

Dyara
  • Member
  • 262 posts

Posted 08 March 2003 - 03:42 PM

I haven´t tried yet. I had no time the last days and when WeiDU 114 came out I just finished the existing version that could display only GLOBALs and area variables.

But I definitely will try all the things you and GB have suggested.

#20 weimer

weimer
  • Member
  • 1569 posts

Posted 09 March 2003 - 02:10 PM

What a great idea!

I may end up stealing something like that for IWD2 debugging. Very nice.