Major discovery on a persistent invisible bug!!

This forum is dedicated to platform-specific issues, discussions and tools relating to D2 modding for the Mac.

Moderator: Contrail

Post Reply
User avatar
Sir Xavius
Junior Member
Paladin
Posts: 177
Joined: Mon Oct 04, 2004 6:27 pm
United States of America

Major discovery on a persistent invisible bug!!

Post by Sir Xavius » Fri Dec 01, 2006 8:47 pm

Over the course of trying to mod for the mac, i have kept running into persistent problems with various things whenever i would make changes. For example, when i approached the Hell portals in Act V's wildernesses, the game would just crash without an error report. Whenever i wanted to add sets or uniques or monsters, there were always bugs. Either the monster wouldn't show up when i put it into a level or a skill wouldn't register or my new lines in TCEx wouldn't work right.

Over my Thanksgiving vacation, i looked at the hex files that were extracted by Souricette's MPQTool and a copy of the file i was editing (then inserting) into the .mpq.

TURNS OUT THAT WHILE I WAS SAVING MY .TXT CHANGES IN TAB-DELIMITED FORMAT, EXCEL WAS NOT ADDING THE CRITICAL PC END-OF-LINE SEQUENCE!

It was the last line that i added that was always missing the $0D0A sequence, and therefore, the .txts AND their generated .bins were always incorrect. It explained EVERYTHING! Every bug, every crash, even though i knew i was doing everything right.

NOW that i have Virtual PC and able to use TBLEditor to edit .tbl's, and the problem solved with EOL issues, i'm moving at rapid pace. I can do anything now (except the usual .dll editing/insertion).

If any of you mac modders are having problems using EXCEL and a Classic OS, save your edited .txt files as "Text(Windows)", about halfway down the Save As type list in the save dialog.

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12100
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U
United States of America

Hand-picked

Re: Major discovery on a persistent invisible bug!!

Post by Myhrginoc » Sat Dec 02, 2006 7:18 am

Another Excel technique (Windows or Mac) is to add an "*eol" field at the far right and fill it with 0 for all rows. (A few files use all 256 columns in Excel already and cannot be added to.) The game will ignore the extra field as it isn't in the table build. But Excel won't munge the records either.
Last edited by Myhrginoc on Sat Dec 02, 2006 7:20 am, edited 2 times in total.
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
librarian
Junior Member
Champion of the Light
Posts: 356
Joined: Wed Dec 07, 2005 7:47 pm
Contact:

Re: Major discovery on a persistent invisible bug!!

Post by librarian » Sat Dec 02, 2006 7:25 pm

Heiho,

I just want to add if you like to work with either Open Office or NeoOffice under Mac OS X you can't save proper CSV tables, too. Despite many attempts of configuring the 'save' dialogue to export just a plain CSV file it always enclosed every entry with " " marks. Which, as you may expect, didn't work at all.

So a Classic OS Mac with Ati or Voodoo video card or an elderly x86 Windows PC with Voodoo3 video card are best platforms to play the game, but for txt modding you just grab any elderly x86 Windows machine or an emulator. Even when you're adressing Mac people.
so long ...
librarian

current status: (re-)tired
vanilla FAQtoids

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12100
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U
United States of America

Hand-picked

Re: Major discovery on a persistent invisible bug!!

Post by Myhrginoc » Sun Dec 03, 2006 6:00 pm

I have had a similar problem with MS Excel in the PC world too. If I save as txt something like Skills.txt, every record inside that has a field with quoted content such as "min(ln56,30)" will export with triple quotes. Maybe I am doing something wrong, or maybe Excel just doesn't believe me when I say "export without quotes" in such cases.
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
Sir Xavius
Junior Member
Paladin
Posts: 177
Joined: Mon Oct 04, 2004 6:27 pm
United States of America

Re: Major discovery on a persistent invisible bug!!

Post by Sir Xavius » Mon Dec 04, 2006 10:24 pm

I have spent hours possibly days (in total computer time) trying to figure out the triple quotes problem, but i thought it was only a Mac Excel problem.
I found out only a short time ago that every field saved that has a comma in it, Excel will enclose in quotes, which D2 (for the Mac at least) doesn't mind. But if the field with a comma already HAS quotes, EXCEL encloses each quote character with quotes -- thus, the triple-quotes. Then after crude trial-and-error, i found that the file needs to be OPENED with quotes as the text qualifier, so that EXCEL will strip the quotes already present in the file, and classify the field as Text. Then when the file is saved again, the comma rule is applied and the fields are saved with quotes. (I'm sure this information is present somewhere else on the PK forums.) Plus you can only open the file from within EXCEL, not from the Finder.
The other thing you hafta do is make sure that EXCEL doesn't try to resolve fields that to it looks like formulas (like negative variables such as -edmn). Under the Preferences tab, make sure that Manual Calculation is selected, but DESELECT Calculate before saving.

[quote=Myhrginoc";p="297585"]
Another Excel technique (Windows or Mac) is to add an "*eol" field at the far right and fill it with 0 for all rows. (A few files use all 256 columns in Excel already and cannot be added to.) The game will ignore the extra field as it isn't in the table build. But Excel won't munge the records either.
[/quote]

This is not true for Mac EXCEL. I checked exhaustively the different saved file versions. Diablo II (for Mac at least) must have the $0D0A end-of-line sequence to generate .bins, or, at the VERY least, the last line of the file is not read. Mac apps do not automatically use this sequence, as you may know, and you have to have a special instruction to use a Windows-based eol. So when a Mac modder finishes making his changes to a .txt file, he must "Save As.." a Text (Windows) file so that EXCEL will add the correct eol at the end of each line. Once i discovered this, ALL of my problems disappeared.

User avatar
Myhrginoc
Retired Admin
Cherub
Posts: 12100
Joined: Sat May 25, 2002 7:28 am
Location: Percussion U
United States of America

Hand-picked

Re: Major discovery on a persistent invisible bug!!

Post by Myhrginoc » Tue Dec 05, 2006 8:34 am

An *eol field is not the same thing as an end-of-line code. $0D0A is the carriage return and line feed pair from teletype days (hence CR and LF in ASCII tables), and has been the end of line sequence for txt files ever since. The *eol field is an actual column, which you will find in many v1.10+ txt files (earlier versions called it "Term"). If this field is the rightmost field and filled for every row except the Expansion separator, then Excel won't munge the trailing tabs used to demarcate the empty fields.
Do the right thing. It will gratify some people and astonish the rest.
~ Mark Twain
Run Diablo II in any version for mods: tutorial
The Terms of Service!! Know them, abide by them, and enjoy the forums at peace.
The Beginner's Guide v1.4: (MS Word | PDF) || Mod Running Scripts || TFW: Awakening

User avatar
Nefarius
Retired Admin
Cherub
Posts: 11607
Joined: Sat Jun 15, 2002 8:13 pm
Location: Where the blood forever rains
Contact:

Hand-picked

Re: Major discovery on a persistent invisible bug!!

Post by Nefarius » Tue Dec 05, 2006 10:17 am

On windows at least the *EOL is not needed at all. As long as the last column in the file contains a value.
''(...) The game can basically be considered unhackable. '' - Blizzard Entertainment (30th May 2000)
Black Omen Productions | MetalStorm: Progress Report | Screenshots

User avatar
Sir Xavius
Junior Member
Paladin
Posts: 177
Joined: Mon Oct 04, 2004 6:27 pm
United States of America

Re: Major discovery on a persistent invisible bug!!

Post by Sir Xavius » Tue Dec 05, 2006 5:54 pm

[quote=Myhrginoc";p="298020"]
If this field is the rightmost field and filled for every row except the Expansion separator, then Excel won't munge the trailing tabs used to demarcate the empty fields.
[/quote]

Again, this is not true for Excel 98 under Mac OS 9.2.2 and below. I have spent countless hours testing and looking at the different files with "0" in the last column and without, different Save versions from EXCEL. Whatever you're talking about does not apply to EXCEL 98 under Mac 9.2.2. I am VERY sure of this -- it's not arguable.
I found that for Diablo II (either because of the application or Souricette's MPQTool), the $0D0A sequence must end at the very least the LAST line of any .txt file in order for the .bin file to be created correctly. The only way to do this is to save it as Text (Windows) so EXCEL 98 will at the eol sequence after each line.
If you're a nice guy, i'll say this: "Somehow you have wrong info about how EXCEL 98 for Mac saves files." If you're obstinate and belligerent, then i'll say: "Dude, you haven't a clue what you're talking about! Leave it to someone who KNOWS!" :cool:

Post Reply

Return to “Mac Modding”