Lol, seems I hit a wrong block to copy fromIf your example is in an actor section than your dead wrong as you're giving trigger offsets....

Posted 07 June 2009 - 06:41 PM
Lol, seems I hit a wrong block to copy fromIf your example is in an actor section than your dead wrong as you're giving trigger offsets....
Retired from modding.
Posted 08 June 2009 - 08:06 AM
@Qwinn -- have you got a set of ITM macros that we could adjust for BG1?
Posted 08 June 2009 - 11:40 AM
No, I was thinking about itm files themselves. I know weidu ships with some but they are actually designed for spells and as such get a little confusing when trying to adapt to an item. Especially when you want to add a global/equipping effect rather than an ability effect...@Qwinn -- have you got a set of ITM macros that we could adjust for BG1?
Not sure what you mean. You mean adding items to areas? My area macros can do that.
Qwinn
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm
Posted 08 June 2009 - 12:58 PM
There is very little difference between .spl and .itm files, apart from the header size (which I think is also different in PS:T) but that's pretty trifling. In any case, WeiDU has separate macros for both, and what you want is ADD_ITEM_EQEFFECT. The usage is simple - just COPY_EXISTING the item you want to change, set the variables that aren't the default values and LAUNCH_PATCH_MACRO ADD_ITEM_EQEFFECT. If you need to pick apart the source code, it's still out there somewhere. (And my library has similar code only gives you more options if you need them.)I know weidu ships with some but they are actually designed for spells and as such get a little confusing when trying to adapt to an item. Especially when you want to add a global/equipping effect rather than an ability effect...
Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle
Posted 08 June 2009 - 02:34 PM
I picked yours apart (not really) and turned it into a patch function... I've got generic default values assigned inside the definition in case the user doesn't need or want to set something. Things like 100 for probability1; 2 for timing mode; 1 for target; 0-1 for opcode; everything else is 0 or ~~ I'm gonna test it in the fixpack after I re-work the area patches to use Qwinn's macros... If needed, I'll move any further discussion to the fixpack work room at G3.There is very little difference between .spl and .itm files, apart from the header size (which I think is also different in PS:T) but that's pretty trifling. In any case, WeiDU has separate macros for both, and what you want is ADD_ITEM_EQEFFECT. The usage is simple - just COPY_EXISTING the item you want to change, set the variables that aren't the default values and LAUNCH_PATCH_MACRO ADD_ITEM_EQEFFECT. If you need to pick apart the source code, it's still out there somewhere. (And my library has similar code only gives you more options if you need them.)I know weidu ships with some but they are actually designed for spells and as such get a little confusing when trying to adapt to an item. Especially when you want to add a global/equipping effect rather than an ability effect...
My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altheri...s.com/index.htm
Posted 08 June 2009 - 04:38 PM
Eh, but this is what the WeiDU macros do, so why not save yourself (and your users/downloaders) code and use them instead? Unless you need to do other things a little more complex (which is what the Free Action macros were for, to change something surgically inside an existing item effect etc.).I've got generic default values assigned inside the definition in case the user doesn't need or want to set something. Things like 100 for probability1; 2 for timing mode; 1 for target; 0-1 for opcode; everything else is 0 or ~~
Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle
Posted 08 June 2009 - 06:10 PM
Posted 08 June 2009 - 07:54 PM
I see no instances of you writing Q_NewOffset_Conta anywhere in any of your 3 mods. Have you even tested it? Has anyone? Because either I'm doing something wrong or it doesn't work.Examples of how I wrote to actor, trigger and vertex records are in post #4 of this thread. Sorry I don't have examples for any other sections, I've never needed to add any other records. (Well, actually, I did containers and items at some point, lemme know if anyone wants examples of those.)
COPY_EXISTING ~ar2900.are~ ~override~ LAUNCH_PATCH_MACRO q_are_initvars LAUNCH_PATCH_MACRO q_areadd_initvars Q_New_Conta = 1 Q_New_Vertx = 6 LAUNCH_PATCH_MACRO q_areadd_process WRITE_ASCII Q_NewOffset_Conta ~Container 1~ WRITE_SHORT (Q_NewOffset_Conta + 0x20) 4590 // locX WRITE_SHORT (Q_NewOffset_Conta + 0x22) 1525 // locY WRITE_SHORT (Q_NewOffset_Conta + 0x24) 8 //Type (nonvisible) WRITE_SHORT (Q_NewOffset_Conta + 0x26) 100 //Lock difficulty WRITE_SHORT (Q_NewOffset_Conta + 0x2e) 100 //Trap removal difficulty WRITE_SHORT (Q_NewOffset_Conta + 0x34) 4600 // Trap locX WRITE_SHORT (Q_NewOffset_Conta + 0x36) 1535 // Trap locY WRITE_SHORT (Q_NewOffset_Conta + 0x38) 4564 // Bound left WRITE_SHORT (Q_NewOffset_Conta + 0x3a) 1511 // Bound top WRITE_SHORT (Q_NewOffset_Conta + 0x3c) 4580 // Bound right WRITE_SHORT (Q_NewOffset_Conta + 0x3e) 1521 // Bound bottom WRITE_SHORT Q_NewOffset_Vertx 4558 WRITE_SHORT (Q_NewOffset_Vertx + 2) 1519 WRITE_SHORT (Q_NewOffset_Vertx + 4) 4564 WRITE_SHORT (Q_NewOffset_Vertx + 6) 1511 WRITE_SHORT (Q_NewOffset_Vertx + 8) 4576 WRITE_SHORT (Q_NewOffset_Vertx + 0xa) 1509 WRITE_SHORT (Q_NewOffset_Vertx + 0xc) 4588 WRITE_SHORT (Q_NewOffset_Vertx + 0xe) 1511 WRITE_SHORT (Q_NewOffset_Vertx + 0x10) 4580 WRITE_SHORT (Q_NewOffset_Vertx + 0x12) 1521 WRITE_SHORT (Q_NewOffset_Vertx + 0x14) 4564 WRITE_SHORT (Q_NewOffset_Vertx + 0x16) 1525 BUT_ONLYIt runs successfully and even appears to add the new container if you look at it with an editor, but it is not selectable and will eventually crash the game or DLTCEP. Also, your method takes significantly longer - several seconds just for this one container whereas the method I originally used (post 11) did it almost instantaneously. Maybe your method isn't updating something correctly for non-PST (and yes, I set the game variable corrently) or maybe I left something out, but apart from the update macros, the write code is pretty much the same.
Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle
Posted 08 June 2009 - 08:16 PM
COPY_EXISTING ~area.are~ ~override~ SET par1 = 1 SET par2 = 2 SPRINT par3 ~idiot~ LAUNCH_PATCH_MACRO add_area_stuff
Edited by GeN1e, 08 June 2009 - 08:24 PM.
Retired from modding.
Posted 08 June 2009 - 08:31 PM
Edited by Qwinn, 08 June 2009 - 08:52 PM.
Posted 08 June 2009 - 08:48 PM
//Update vertex information for new container WRITE_LONG (ctnr_off + 0x50) insert_idx //First vertex index WRITE_LONG (ctnr_off + 0x54) vertex_new_num //Number of vertices
Edited by Qwinn, 08 June 2009 - 08:51 PM.
Posted 08 June 2009 - 09:01 PM
Edited by Qwinn, 08 June 2009 - 09:03 PM.
Posted 08 June 2009 - 09:07 PM
PS While I'm here. Qwinn, may I deliberately steal some of your code to make a few macros for an addition to Weidu? Yours are fine, but they still are the tool for advanced users, who usually got a general understanding of how it works. While a conventional macro suggests only having to enter the desired values and let Weidu to handle the rest.
CODE
COPY_EXISTING ~area.are~ ~override~
SET par1 = 1
SET par2 = 2
SPRINT par3 ~idiot~
LAUNCH_PATCH_MACRO add_area_stuff
Posted 08 June 2009 - 09:43 PM
If you mean the values at 0x38, the IESDP describes it as the "Minimum bounding box of container polygon" whatever that means. Standard areas I looked at do not match the actual container vertices, so I don't really know what the purpose is either, but I'm pretty sure that rectangle still needs to be written for something.Also values for bounding box don't correspond to real ones, though I can't say I know what the purpose of that box is.
I don't think so. It appears to add it correctly now with those two extra WRITEs but still takes the same amount of time. In theory, READs and SETs shouldn't really take any time at all, but you're doing an awful lot of them, and it appears you do them redundantly somewhat - you run q_are_initvars both at the beginning and end of this process (since the q_areadd_process macro also invokes it when it finishes). And if I copied another area, that would occur again, etc., when in theory I should only need to do it at the beginning of each COPY). Maybe it's your long variable names, though they're not as long as some people'sAs for why it should take "a few seconds", I'm not sure why it would. Maybe it's choking a bit due to the missing writes I just mentioned?
Edited by Miloch, 08 June 2009 - 09:44 PM.
Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle
Posted 08 June 2009 - 10:03 PM
I won't comment on the overall approach taken in designing your macros, but I do think something could be added with no drawbacks that would make your macros easier to use. The copy/paste blocks you advocate using to write new information to the different structures after adding them are basically scary-looking to users who want to keep things simple. If you set up functions for these, you can make it so the user won't have to write to each and every offset of the newly added structure(s) after using your macro, just the important ones. The benefits to this would be tidiness, less duplication of code*, and probably a lesser chance of screwups for users, advanced or otherwise.PS While I'm here. Qwinn, may I deliberately steal some of your code to make a few macros for an addition to Weidu? Yours are fine, but they still are the tool for advanced users, who usually got a general understanding of how it works. While a conventional macro suggests only having to enter the desired values and let Weidu to handle the rest.
CODE
COPY_EXISTING ~area.are~ ~override~
SET par1 = 1
SET par2 = 2
SPRINT par3 ~idiot~
LAUNCH_PATCH_MACRO add_area_stuff
How is this different from my macros as they exist[...?]
Qwinn
Posted 08 June 2009 - 10:16 PM
Edited by Qwinn, 08 June 2009 - 10:33 PM.
Posted 08 June 2009 - 11:17 PM
I won't comment on the overall approach taken in designing your macros, but I do think something could be added with no drawbacks that would make your macros easier to use.
The copy/paste blocks you advocate using to write new information to the different structures after adding them are basically scary-looking to users who want to keep things simple.
* You can see why this is important if you imagine finding a WRITE_LONG/WRITE_SHORT error within one of the blocks users are supposed to copy/paste and modify, instead of within your macro.
Edited by Qwinn, 08 June 2009 - 11:24 PM.
Posted 08 June 2009 - 11:51 PM
I'm pretty sure this won't be a problem.Now, that all said, well, to do the functions as you suggest rather than a Copy-Paste Library would require many hundreds of variables to be SET and recognized so they could be passed to the WRITE function as parameters. Probably 20-30x as many variables as I set within my macros. I think the effect on runtime would be negligible, as is the runtime of my own macros, but it seems to be a serious issue that needs to be addressed before we can say it would have no drawbacks.
Posted 09 June 2009 - 01:26 AM
You yourself said you don't add any containers... I don't know if that's what drives the eval_pe up (though as I said, it doesn't with A64's method).My UB mod runs the ARE Process macro no less than 12 distinct times (and the Vertex macro once), and the entire installation time for the entire mod is 10.094 (and the total eval_pe is 0.658).
I don't see how that lines up with your findings
It isI don't see any way to improve the runtime of the macros as they exist. Sorry if that's a dealbreaker for you.
Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle
Posted 09 June 2009 - 01:37 AM
You yourself said you don't add any containers... I don't know if that's what drives the eval_pe up (though as I said, it doesn't with A64's method).
You could start by dropping the redundant INCLUDE for starters, as I mentioned. If you always run it at the start of any macro action, there's no reason to always run it at the end as well, is there?
Edited by Qwinn, 09 June 2009 - 02:27 AM.