Jump to content

[BG1] NI: Search doesn't give search results because trigger syntax is faulty


Recommended Posts

EDIT: The title of this thread is edited. Originally, I didn't know what the problem was. Here is the original post:




It's v1.35 dev preview 131005, I admit, but since now, the search function worked fine.


I am trying to locate instances where the "erik.cre" is used in vanilla BG:TotSC. Erik is the one shooting arrows during Jondalar's fighting training in the prologue. If i open the erik.cre and do "search for references", check the box "dlg" and run the search, it gives me "no hits found", although it should give me two instances in the jondal.dlg?


If I do "Search - Text search - DLG" and use the search term "erik", it gives me only one instance in the Jondal.dlg (where Erik is disappearing), not the first one (where Erik is created).


Can anyone confirm?

Link to comment

I can confirm this behavior. A search via "Text Search -> DLG" results in a single state instance and a single action instance (even though there should be at least two). The "Find references to this file" on erik.cre for DLG resources gives me no results at all.


I've tested different NI versions dating back until v1.32 (from around 2003), so I would conclude this bug has always been there. I'll investigate it further.

Link to comment



The problem appears to be on BG1's side. A lot of scripts include incomplete script actions (i.e. they don't conform to their signatures as specified in ACTION.IDS). In the specific case of JONDAL.DLG, Action 0 contains a CreateCreature() statement without the direction argument. That's why this instance had been skipped when you were searching for the keyword "erik". NearInfinity's script parser is a lot less flexible than WeiDU's in that regard, so you'll probably see no error when decompiling the dialog with WeiDU.


To get an idea about the number of script errors, you can execute Tools->Check->Triggers & Actions For->All Dialogues. The check resulted in 611 errors on my BG1:TotSC installation, with the majority of entries having too few arguments.

Link to comment

That is a good find. Indeed, if I do the same search in BG:EE (for "Erik" in bcs and dlg, and for references of the erik.cre) I seem to find all instances.


As I said - I didn't encounter this behaviour before but always thought the search function to work reliably. I got confused when I didn't seem to be able to find several things. It's good to know it's not on NI's side. Best to stop working with BG1:TotSC, I guess.


Thank you very much for putting time into this!


EDIT: Changed the topic title.

Link to comment

Best to stop working with BG1:TotSC, I guess.


As a work-around you could replace the lines

7 CreateCreature(S:NewObject*,P:Location*,I:Face*)
7 CreateCreature(S:NewObject*,P:Location*)

140 GiveItemCreate(S:ResRef*,O:Object*,I:Usage1*,I:Usage2*,I:Usage3*)
140 GiveItemCreate(S:ResRef*,O:Object*)

in ACTION.IDS. Those changes alone will fix about 95% of incomplete script actions (for whatever reasons, BG1 almost exclusively uses the shortened syntax as defined above).


The remaining issues are mostly simple script errors, like missing closing parenthesis or actions in trigger sections and vice versa. Those changes don't seem to have any adverse effects on the game as well (judging from a quick test).

Link to comment
As a work-around you could replace the lines --cut to shorten--
As I understand the double entries in the action.ids are there to provide the same action with different variables, so the NI should understand this variable change via this way... as what you are saying is just removing those lines and the NI would understand the rest of the content. I'll note the 97 index being one in BG1 to have double entry. The others, well they are actually errors in the original scripting ... and fixpacks can and should fix those. Or just provide a fix via APPENDing the action.ids . And as the mods can do that too with no risks, it's not a NI's business.
Link to comment

You are right that it isn't NI's responsibility to fix errors that exist in the game itself. This work-around is primarily intended to fix NI's issues with misspelled script actions, so that modders can work more reliably with BG1. Adding new entries to ACTION.IDS with the same ID and name but different parameter lists doesn't work well in NearInfinity, as NI will fetch the first one available and ignores everything else. As I said before, NI's script parser isn't very flexible in that regard.


It shouldn't have any effect on the game itself, so there is no need to add it to fixpacks or other mods.


Edit: Adding new entries with different names to ACTION.IDS doesn't work either, since scripts are stored as human-readable text in DLG resources (unlike BCS resources that use a byte-code format which has to be decompiled first). You would have to run a find-and-replace on all DLGs as well.

Link to comment


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

  • Create New...