I thought to share an experience that may help in some situations. I've been working on a long background script that recently started causing a problem. The advisor started popping up in the beginning of battles (in campaign map) with vanilla advice even if unscripted advice is suspended with "suspend_unscripted_advice true". I knew something was wrong.
I tried and tried to find an error in the script, but couldn't. Squid's TW script editor did not find any problem. I removed big chunks of rows to go "back in time" when there was no problem. Testing was not easy, as the non-wanted advice did not appear every single time a battle was about to start, perhaps 50 % only.
I had tested the script extensively up to a certain point earlier and there had not been any problems. This time this problem with the advisor remained even when I removed all the parts I had written myself and only the parts copied directly from HouseOfHam's background script tutorial remained!
So I thought that the problem has to be elsewhere. I looked at the advice, ancillaries and traits I had added, and the descr_strat.txt, but could not find any problem in those parts I had added recently (before the problems started).
Finally I went through the files with hidden characters displayed and I found out that a few rows in export_advice.txt were separated only with "LF" instead of "CR LF". I repaired that and now the whole srcipt functioned without problems again!(well not quite, but that is not so important, see last parts *** of this message)
I don't have any idea what had caused the problem. I'm using Notepad ++ and had included this part by copying another existing part and modifying it. I am sure that I had copied it either from Notepad ++ or the plain Notepad, not from any other word processor. I could not repeat the problem with either of them, when tried to copy-paste afterwards.
I would have never found this problem if I had not checked the new parts with hidden chars visible. I thought to do that, since I had notice something similar at some point earlier. But had then thought that it was just something rare. Apparently this may happen quite easily and cause really a trouble with scripts.
Any thoughts on this?
*** And another observation: after discovering this problem, there was still one problem in the script. I had accidentally declared the same counter twice in separate locations (and set it to zero in both locations). When I removed the latter part (declaration + setting to zero), the full script functioned well. But Squid, this problem was not detected by your editor, is it a "bug"?




Reply With Quote







