Jump to content

WeiDU doesn't like me


Icendoan

Recommended Posts

Ok, I am trying to write a small bugfix for EasyTuTu. it fixes the erroneous use of Bandit Scalps in quickslots although a useless ability. When I run the installer, it says I have made a Syntax error near lines 10 Column 10-78.

 

Here is my TP2

 

BACKUP ~Scalp Fix/Backup~

AUTHOR ~Mystykyl@hotmail.co.uk~

 

BEGIN ~Bandit Scalp Fix <Icendoan>~

ACTION_IF FILE_EXISTS_IN_GAME ~_alora.cre~ THEN BEGIN

 

COPY_EXISTING ~Scalp Fix/_misc86.ITM~ ~override~

SAY NAME1 ~Bandit Scalp~

SAY NAME2 ~Bandit Scalp~

SAY UNIDENTIFIED_DESC ~The scalp of a bandit. This may be worth money to the right person.~

SAY DESC ~The scalp of a bandit. This may be worth money to the right person~

 

Please help by correcting me, for I know I have gone wrong.

Link to comment

Everiything in an A_I F_E_I_G or any kind of ACTION_IF thing needs an "end" to it...

 

so

BACKUP ~mymod\backup~
AUTHOR ~me~

BEGIN ~Bandit Scalp Fix <Icendoan>~

COPY_EXISTING ~Scalp Fix/_misc86.ITM~ ~override~
 SAY NAME1 ~Bandit Scalp~
 SAY NAME2 ~Bandit Scalp~
 SAY UNIDENTIFIED_DESC ~The scalp of a bandit. This may be worth money to the right person.~
 SAY DESC ~The scalp of a bandit. This may be worth money to the right person~

should work, or

 

 

BACKUP ~mymod\backup~
AUTHOR ~me~

BEGIN ~Bandit Scalp Fix <Icendoan>~

 ACTION_IF FILE_EXISTS_IN_GAME ~_alora.cre~ THEN BEGIN
  COPY_EXISTING ~Scalp Fix/_misc86.ITM~ ~override~
	SAY NAME1 ~Bandit Scalp~
	SAY NAME2 ~Bandit Scalp~
	SAY UNIDENTIFIED_DESC ~The scalp of a bandit. This may be worth money to the right person.~
	SAY DESC ~The scalp of a bandit. This may be worth money to the right person~
 END //of action_if clause

 

(and PM Macready, because he like to fix stuff like that :band: )

Link to comment
COPY_EXISTING ~Scalp Fix/_misc86.ITM~ ~override~

I assume you meant for this to be a regular COPY... you could always rewrite your changes as a patch, though. :band:

 

Also, those links currently don't work - after registering on the site, it said your files were private content.

Link to comment

COPY_EXISTING ~Scalp Fix/_misc86.ITM~ ~override~

I assume you meant for this to be a regular COPY... you could always rewrite your changes as a patch, though. :band:

 

Also, those links currently don't work - after registering on the site, it said your files were private content.

 

Fixing links

 

My COPY_EXISTING was stolen of the BG2Fixpack, as I cbf to go through the documentaion. It also works fine.

 

If you wish to download and rewrite as a patch it would also be fine. Bandits still auto-drop them and after uninstallation it is if the mod is installed, any ideas on how to properly patch it?

Link to comment
Thanks, and, if it hasn't already been done, could I submit ti to the (apparently) ongoing BG Fixpack? I will write it over again for it.
Sure. Though we would want to patch the existing item rather than overwrite it, so without that code I can't see what you're changing exactly.

 

If you're interested in this sort of thing, PM CamDawg a request for access to the BG1 Fixpack forum (unless he sees the request here). We could certainly use extra hands as the project is kind of stagnant with just 2 or 3 people working half-time at best :band:.

Link to comment

I am, however, still trying (desperatley) to learn WeiDU, so, if you could actually give me the code to patch and not overwrite it would be most appreciated.

 

I am currently looking at the documentation, and I cannot see where I am going wrong.... :)

 

I will hapilly e-mail anyone the .Tp2 for editing, and, here it is!

 

BACKUP ~Scalp Fix/Backup~
AUTHOR ~Mystykyl@hotmail.co.uk~

BEGIN ~Bandit Scalp Fix <Icendoan>~
ACTION_IF FILE_EXISTS_IN_GAME ~_alora.cre~ THEN BEGIN

COPY ~Scalp Fix/_misc86.ITM~ ~override~
SAY NAME1 ~Bandit Scalp~ // This is the unidentified name of the item.
SAY NAME2 ~Bandit Scalp~ // This is the identified name of the item.
SAY UNIDENTIFIED_DESC ~The scalp of a bandit. This may be worth money to the right person.~
SAY DESC ~The scalp of a bandit. This may be worth money to the right person~

END

 

EDIT: Reread the documentation, and found that I should just use COPY correct?

 

EDIT2: Now, I just get a nice error message. ;)

 

EDIT3: OMFG! Am I an idiot or what? I forgot to put an actual item in my fix folders, now, I shall test

 

EDIT4: Dang! It still doesn't patch, can anyone help me! ;) Please.....

 

Icen

Link to comment
I am, however, still trying (desperatley) to learn WeiDU, so, if you could actually give me the code to patch and not overwrite it would be most appreciated.
It should be fairly easy, but I still need to know exactly what you're changing! That is, without downloading your item and trying to eyeball it against the existing item, which I can also do but would prefer not to if at all possible :).

 

Re: your code, I don't see anything wrong with it offhand, except maybe your item isn't where you say it is (maybe it's in an item subfolder), or maybe you don't actually have a space in your path or something.

 

With the patching code though, we will be using COPY_EXISTING, so that part at least will become moot. COPY we would only use for introducing new objects into the game, rather than changing existing ones.

Link to comment

OK, thank you for your patience, and I will say exactly what I did in my last post.

 

NOTE: I am using TuTu for testing, and so will add _ to everything. I have tested, and vanilla BGI also has this bug.

 

I changed COPY_EXISTING to COPY

 

I added in _MISC86 to my folder, which, does have a space in it. I have uninstallation issues now.

 

Other than that my code has remained unchanged.

Link to comment

When you COPY_EXISTING, you specify the filename of something that already exists in the game - it will look through the game .bifs and override folder to find the most recent version of the file to get modified. This is used whenever you're trying to change existing content as opposed to bringing in a whole new file from your mod directory.

 

So, your patch will look something like:

 

COPY_EXISTING ~_misc86.itm~ ~override~
 // PATCHING GOES HERE

 

If you tell us in what way you originally changed the file with your editing program, we could provide more help in regards to the appropriate patching commands to do the same thing. (We're lazy and hope to avoid ever having to look at real files. :))

Link to comment

I fixed up the Extended Header with DLTCEP, I am also looking into if there are any other bugs, such as creatures that shouldn't have them that do.

 

Ok, I have deduced that no creatures hold them that shouldn't, and will now check if they might be in Random Item selection, but I am doubtful.

Link to comment

Ok, well it looks like you just deleted the extended header. In that case, the patch would be something like:

BACKUP ~ScalpFix/backup~
AUTHOR ~forums.gibberlings3.net/index.php?showtopic=13030~

BEGIN ~Bandit Scalp Fix~
ACTION_IF FILE_EXISTS_IN_GAME ~fw0125.are~ THEN BEGIN //If Tutu
 OUTER_SPRINT ~tsu~ ~_~ //Assigns underscore
END ELSE BEGIN
 OUTER_SPRINT ~tsu~ ~~ //No underscore otherwise
END

COPY_EXISTING ~%tsu%misc86.itm~ ~override~ //Bandit Scalp
 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN //Checks file validity
READ_LONG 0x64 xf //Ext. header offset
READ_SHORT 0x68 xc //Ext. header count
PATCH_IF xc = 1 BEGIN //If header exists
  DELETE_BYTES xf 0x38 //Delete it
  WRITE_SHORT 0x68 0 //Update header count
  WRITE_LONG 0x6a xf //Update feature offset
END
 END
BUT_ONLY_IF_IT_CHANGES

You could get fancier here and scan through all potential headers and all abilities within them and delete them all from the bottom up, but that's kind of overkill for the scalp, which is unlikely to have extra mod-added abilities or headers. But if you want to make your eyes go all funny, that sort of code would resemble something like this. I don't usually have the skill or patience for that type of code, so I leave it to the likes of Ascension64, Nythrun and plainab.

 

I also deleted the space in your path, to make it ScalpFix, because the WeiDU setup doesn't really like spaces. Maybe that was your problem.

 

The OUTER_SPRINT assigns an underscore variable (or not) that allows it to work on Tutu, BG1 or BGT.

 

There is also some code in the BG1 Fixroom related to the bandit scalp pickpocket exploit (should be fixed already in Tutu and Baldurdash as well).

Link to comment

Right, COPY and PASTE time!

 

I will try and understand it when not braindead (had Mock tests today ;) )

 

It doesn't work for me :)

Here is my new tp2

BACKUP ~ScalpFix/Backup~
AUTHOR ~Mystykyl@hotmail.co.uk~

BEGIN ~Bandit Scalp Fix <Icendoan>~
ACTION_IF FILE_EXISTS_IN_GAME ~_fw0125~ /*TuTu area only*/ THEN BEGIN
OUTER_SPRINT ~tsu~ ~_~ 
END ELSE BEGIN
OUTER_SPRINT ~tsu~ ~~
END


COPY_EXISTING ~%tsu%misc86.itm~ ~override~ //Bandit Scalp
PATCH_IF (SOURCE_SIZE > Ox71) THEN BEGIN
 READ_LONG 0x64 xf //Ext. Header offset
 READ_SHORT 0x68 xc //ext. header count
 PATCH_IF xc = 1 BEGIN //xc = 1 must mean the header is actually there... So, if it is, it will start
  DELETE_BYTES xf 0x38 //deletes it. What xf and 0x38 means is beyond me atm
  WRITE_SHORT 0x68 0 //this updates the header count, which must be a 2da
  WRITE_LONG 0x6a xf //updates the feature offset, must be aother 2da
 END
END
BUT_ONLY_IF_IT_CHANGES

 

And here is my DEBUG

 

 WeiDU v 20100 Log

C:\Program Files\BaldursGateTutu\Setup-scalpfix.exe
[./CHITIN.KEY] loaded, 689569 bytes
[./CHITIN.KEY] 329 BIFFs, 48521 resources
[dialog.tlk] loaded, 15487373 bytes
[dialog.tlk] 117741 string entries
[./Autorun.ini] loaded, 1452 bytes
[./baldur.ini] loaded, 4264 bytes
Possible HD/CD Path: [C:\Program Files\BaldursGateTutu\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\English\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD1\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD2\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\English\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD2\]
Possible HD/CD Path: [C:\Program Files\BaldursGateTutu\CD2\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\English\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD3\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\English\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD4\]
Possible HD/CD Path: [C:\Program Files\Black Isle\BGII - SoA\CD5\]
[./Keymap.ini] loaded, 5615 bytes
[C:\Program Files\BaldursGateTutu\Setup-scalpfix.exe] Using scripting style "BG"
[dialog.tlk] claims to be writeable.
[dialog.tlk] claims to be a regular file.
[WeiDU.log] parsed
[SETUP-SCALPFIX.TP2] parsed

Install Component [Bandit Scalp Fix <Icendoan>]?
[I]nstall, or [N]ot Install or [Q]uit? 
Installing [Bandit Scalp Fix <Icendoan>]
Copying and patching 1 file ...
BIFF may be in hard-drive CD-path [C:\Program Files\Black Isle\BGII - SoA\CD5\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\Black Isle\BGII - SoA\CD4\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\Black Isle\BGII - SoA\English\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\Black Isle\BGII - SoA\CD3\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\Black Isle\BGII - SoA\English\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\BaldursGateTutu\CD2\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\Black Isle\BGII - SoA\CD2\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\Black Isle\BGII - SoA\English\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\Black Isle\BGII - SoA\CD2\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\Black Isle\BGII - SoA\CD1\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\Black Isle\BGII - SoA\English\/DATA/ITEMS.BIF]
BIFF may be in hard-drive CD-path [C:\Program Files\BaldursGateTutu\/DATA/ITEMS.BIF]
[C:\Program Files\BaldursGateTutu\/DATA/ITEMS.BIF] 659688 bytes, 1990 files, 0 tilesets
ERROR: cannot convert Ox71 or %Ox71% to an integer
ERROR: [misc86.itm] -> [override] Patching Failed (COPY) (Not_found)
Stopping installation because of error.

ERROR Installing [Bandit Scalp Fix <Icendoan>], rolling back to previous state
[ScalpFix/Backup/0/UNSETSTR.0] SET_STRING uninstall info not found
Will uninstall   0 files for [SETUP-SCALPFIX.TP2] component 0.
Unable to Unlink [ScalpFix/Backup/0/MAPPINGS.0]: Unix.Unix_error(1, "unlink", "ScalpFix/Backup/0/MAPPINGS.0")
Uninstalled	  0 files for [SETUP-SCALPFIX.TP2] component 0.
ERROR: Not_found
PLEASE email the file SETUP-SCALPFIX.DEBUG to Mystykyl@hotmail.co.uk

Install Component [Bandit Scalp Fix <Icendoan>]?
[I]nstall, or [N]ot Install or [Q]uit? Saving This Log:

NOT INSTALLED DUE TO ERRORS Bandit Scalp Fix <Icendoan>

	WeiDU Timings
READ_*						   0.000
load TLK						 0.000
OUTER_SPRINT					 0.000
parsing .log files			   0.000
PATCH_IF						 0.000
process_patch2				   0.000
parsing .tp2 files			   0.001
unmarshal BIFF				   0.001
eval_pe						  0.003
COPY							 0.004
tp2 uninstall					0.005
loading files					0.087
unmarshal KEY					0.169
unmarshal TLK					0.282
stuff not covered elsewhere	 14.321
TOTAL						   14.873

 

You are right, that does make your eyes go very funny....

 

Still waiting for Cam to get back to me...

 

Thank you for your time.

 

Icen

Link to comment
ACTION_IF FILE_EXISTS_IN_GAME ~_fw0125~ /*TuTu area only*/ THEN BEGIN

Might want to change this to be more like Miloch's - remove the _ and add the file extension.

 

PATCH_IF (SOURCE_SIZE > Ox71) THEN BEGIN

And this should be 0x instead of Ox.

 

If you want to learn more about what the code is doing, check out the WeiDU readme and IESDP

Link to comment
And this should be 0x instead of Ox.
Right, COPY and PASTE time!
Heh. Might want to've followed your own advice there :).

 

And yeah, those two resources Mike linked are the place to start. The pertinent part of this code is:

  READ_LONG 0x64 xf
 DELETE_BYTES xf 0x38

The first line tells it to read the value at 0x64 hexidecimal address, which is where the extended header is stored for items. The IESDP gives a pretty good account of that, and it's also reflected if you look at stuff with NearInfinity. It happens to be stored in a 4-byte block, which is a LONG value, a SHORT value being 2-bytes. It stores that value in a variable called xf. It could be called extended_header_offset, if you like long variable names. I'd rather stick that info in comments so the interpreter can skip it and save memory.

 

The second line just tells it to delete 38 hexidecimal bytes (the header length) at the extended header offset. In other words, it deletes the header. Again, this is in the IESDP or the WeiDU doc.

 

And Cam is a busy guy... remind me in a few days if he still hasn't given you access. Though he doesn't always respond to me either, but usually he gets around to it. Eventually.

Link to comment

Archived

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

×
×
  • Create New...