Pocket Plane Group
Miscellany, Inc. => Infinity Engine Modding Q&A => Topic started by: jastey on October 04, 2010, 04:33:19 PM
-
Huzzah for who wrote the macros. Yet, I need an example. I have no clue what I have to write, and how.
From the WeiDU readme:
ADD_AREA_ITEM: adds an item to a container of an area. This is a PATCH macro and function.
* SET item_to_add to the item you want to add
* SET container_to_add_to to number of container the item should be added to.
* SPRINT flags to flags the item should have (usual weidu syntax: STOLEN, IDENTIFIEDSTOLEN, etc). Default - no flags.
* SET charges1 to amount in stock/number of charges of first magical ability (default 0)
* SET charges2 to number of charges of second magical ability (default 0)
* SET charges3 to number of charges of third magical ability (default 0)
-
There is a typo. It should say: SPRINT item_to_add ...
An example with default flags:
SPRINT item_to_add ~rndtre02~
SET container_to_add_to = "2"
SET charges1 = "0"
SET charges2 = "0"
SET charges3 = "0"
LAUNCH_PATCH_MACRO ADD_AREA_ITEM
-
Great, thank you!
EDIT: Wait - how do I tell which are this goes to? Should there be an "COPY_EXISTING ~%ESewers%.ARE~ ~override~" above?
-
If you use them as functions, you don't need to initialise zero values. You don't need to set charges except for stackable items or items with actual charges (wands etc.).
//Add item
COPY_EXISTING ar0413.are override //Engine Room
PATCH_IF SOURCE_SIZE > 0x28f BEGIN
LAUNCH_PATCH_FUNCTION ADD_AREA_ITEM
INT_VAR container_to_add_to = 1
STR_VAR item_to_add = aggem08 //Fire Opal
END
END
BUT_ONLY
//Replace item
COPY_EXISTING ar0413.are override //Engine Room
PATCH_IF SOURCE_SIZE > 0x28f BEGIN
LAUNCH_PATCH_FUNCTION REPLACE_AREA_ITEM
STR_VAR old_item = misc38 //Black Opal
new_item = aggem08 //Fire Opal
END
END
BUT_ONLY
-
Okay... (trying to understand)
What does "PATCH_IF SOURCE_SIZE > 0x28f BEGIN" do?
What is BUT_ONLY in comparison to BUT_ONLY_IF_IT_CHANGES?
-
What does "PATCH_IF SOURCE_SIZE > 0x28f BEGIN" do?
It checks whether the file is larger than 655 bytes. I think it has something to do with some corrupted files in BG2.
What is BUT_ONLY in comparison to BUT_ONLY_IF_IT_CHANGES?
Miloch not wanting to type it all, I imagine.
-
What does "PATCH_IF SOURCE_SIZE > 0x28f BEGIN" do?
It checks whether the file is larger than 655 bytes. I think it has something to do with some corrupted files in BG2.
Specifically, it makes sure the code doesn't fail to install if the area files in question are drastically corrupted.
(I actually think it's a mistake to use it in this context: if those core-game areas don't exist, you want to know about it. (Though perhaps I'm missing something.) It's more commonly used when you're doing COPY_EXISTING_REGEXP)
-
Thank you for the explanations.
-
I actually think it's a mistake to use it in this context: if those core-game areas don't exist, you want to know about it.
I tend to agree... blame the fixpackers for that bad habit.
-
What is BUT_ONLY in comparison to BUT_ONLY_IF_IT_CHANGES?
They're synonims.
Re: SOURCE_SIZE checks, ALLOW_MISSING works by copying an empty file in stead of the missing file. If you copy a single file it doesn't matter, but in more complex cases it might. Consider a mod that makes Celestial Fury weight 100 and wants to patch Item Upgrade's copy (without using ACTION_IF). The following would fail (unless you use the SOURCE_SIZE check) because iusw1hxx.itm is missing and thus initialized to an empty string instead:
ALLOW_MISSING ~iusw1hxx.itm~ // Celestial Fury +5 from IU
<...>
COPY_EXISTING ~sw1hxx.itm~ ~override~
~iusw1hxx~ ~override~
WRITE_LONG 0x4c 100
-
So, does that mean I take the line "PATCH_IF SOURCE_SIZE > 0x28f BEGIN" out?
the bigg: If I do
COPY_EXISTING ~iusw1hxx~ ~override~
WRITE_LONG 0x4c 100
and the file is not there, why is it initialized to an empty string? I thought COPY_EXISTING fails if the file is not there?
-
So, does that mean I take the line "PATCH_IF SOURCE_SIZE > 0x28f BEGIN" out?
It doesn't really matter in the end - with the notable exception of iplot01k.itm, no file will ever be that badly broken. If a file was indeed so badly broken, you can be assured that the user is computer illiterate, writes in moron speak, and you'll need 30 posts of extremely detailed instructions before you can get him to upload the debug file.
COPY_EXISTING ~iusw1hxx~ ~override~
WRITE_LONG 0x4c 100
and the file is not there, why is it initialized to an empty string? I thought COPY_EXISTING fails if the file is not there?
That's what happens if you used ALLOW_MISSING on iusw1hxx. Without ALLOW_MISSING, WeiDU will fail the installation as usual.
-
30 posts of extremely detailed instructions
Thank you, that example was very vivid. ;D
That's what happens if you used ALLOW_MISSING on iusw1hxx. Without ALLOW_MISSING, WeiDU will fail the installation as usual.
So I am the idiot if i program this? Ah, and with the file size check it works because 0 byte / missing files are left out. Comprende. (At last). :)
Thank you all again!