Jump to content

Recommended Posts

OK, thank you :(. I will try to get them up on the wikki, but it will take a few days - my cup runneth over.

Share this post


Link to post

could anyone make an update? or remove the old ones from wiki, at least? I'm feeling ashamed of them

Share this post


Link to post

So are you making a revision? I could use some of these macros, if they're not going to make it into WeiDU itself (which would be even better).

Share this post


Link to post

Well, cmorgan seems to be a bit MIA, unless someone else with write access to the wiki sees this. Can you update the link in your original post at least? I get a "Sorry, the Server failed to retrieve the requested data."

Share this post


Link to post

My ETA is a few weeks on this, I am afraid - but you could create a special Wikki account, and help yourself :p

Share this post


Link to post
If you're OK with this, I can include them in WeiDU by default (shipping files and/or INCLUDEing them isn't needed, just LAUNCH_PATCH_MACRO is required).
Was this ever done (or if not, any plans for it)?

Share this post


Link to post
Not yet, but it's a matter of really nagging me.
Consider yourself nagged, then :cool:. I use some of these features all the time, and it'd sure help to have them in WeiDU rather than dig for some pre-existing code in some other mod I don't even remember working with anymore, or some buried forum post. Plus, there are several different versions of these out there, so it'd help to have a standard (even if it's not actually incorporated with WeiDU, just delivered with it).

 

Oh and while you're at it, can you add some file DIFF and AUTO_PATCH features, such as here? ;) I know there are some within WeiDU already (--cmp-from/to etc.), but I've never had much luck with them, particularly when it comes to adding spell effects etc. - I think it only deals in WRITE_BYTEs.

Share this post


Link to post
Not yet, but it's a matter of really nagging me.
Consider yourself nagged, then :cool:. I use some of these features all the time, and it'd sure help to have them in WeiDU rather than dig for some pre-existing code in some other mod I don't even remember working with anymore, or some buried forum post. Plus, there are several different versions of these out there, so it'd help to have a standard (even if it's not actually incorporated with WeiDU, just delivered with it).

WTB WeiDU pre-equipped with optimally coded macros for doing anything and everything I'll ever need to do with files. PST.

Share this post


Link to post

There is at least one bug in one of these macros, probably two. I get the ever-so-helpful "Patching Failed (COPY) (Invalid_argument("String.sub"))" error when using the ADD_SPELL_EFFECT on spells with multiple effects and multiple headers, for example:

DEFINE_PATCH_MACRO ~ADD_SPELL_EFFECT~ BEGIN
 PATCH_IF (SOURCE_SIZE > 0x71) THEN BEGIN
READ_LONG  0x64 ___#abil_off
READ_SHORT 0x68 ___#abil_num
READ_LONG  0x6a ___#fx_off
FOR (___#index1 = 0; ___#index1 < ___#abil_num; ___#index1 = ___#index1 + 1) BEGIN
  PATCH_IF (___#index1 = (header - 1)) OR (header = 0) BEGIN //header=1 means ___#index1=0
	READ_SHORT  (___#abil_off + 0x1e + (0x28 * ___#index1)) ___#abil_fx_num
	READ_SHORT  (___#abil_off + 0x20 + (0x28 * ___#index1)) ___#abil_fx_idx
	INSERT_BYTES (___#fx_off +		(0x30 * (___#abil_fx_num + ___#abil_fx_idx))) 0x30
	WRITE_SHORT  (___#fx_off +		(0x30 * (___#abil_fx_num + ___#abil_fx_idx))) opcode
	WRITE_BYTE   (___#fx_off + 0x02 + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) target
	WRITE_BYTE   (___#fx_off + 0x03 + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) power
	WRITE_LONG   (___#fx_off + 0x04 + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) parameter1
	WRITE_LONG   (___#fx_off + 0x08 + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) parameter2
	WRITE_BYTE   (___#fx_off + 0x0c + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) timing
	WRITE_BYTE   (___#fx_off + 0x0d + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) resist_dispel
	WRITE_LONG   (___#fx_off + 0x0e + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) duration //was BYTE
	WRITE_BYTE   (___#fx_off + 0x12 + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) probability1
	WRITE_BYTE   (___#fx_off + 0x13 + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) probability2
	WRITE_EVALUATED_ASCII (___#fx_off + 0x14 + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) ~%resource%~ #8
	WRITE_LONG   (___#fx_off + 0x1c + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) dicenumber
	WRITE_LONG   (___#fx_off + 0x20 + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) dicesize
	WRITE_LONG   (___#fx_off + 0x24 + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) savingthrow
	WRITE_LONG   (___#fx_off + 0x28 + (0x30 * (___#abil_fx_num + ___#abil_fx_idx))) savebonus
	//correcting effects number
	SET ___#abil_fx_num = (___#abil_fx_num + 1)
	WRITE_SHORT (___#abil_off + 0x1e + (0x28 * ___#index1)) ___#abil_fx_num
	//correcting 1st effect indexes
	FOR (___#index2 = 0; ___#index2 < ___#abil_num; ___#index2 = ___#index2 + 1) BEGIN
	  READ_SHORT (___#abil_off + ___#index2 * 0x28 + 0x20) ___#1effect_index
	  PATCH_IF (___#1effect_index > ___#index1) BEGIN //if ability after current effect
		WRITE_SHORT (___#abil_off + ___#index2 * 0x28 + 0x20) (___#1effect_index + 1) //increase 1 effect ___#index1 by 1
	  END
	END
	//no offsets to correct
  END
END
//reset vars
SET opcode = 0
SET target = 0
SET timing = 0
SET resist_dispel = 0
SET power = 0
SET header = 0
SET parameter1 = 0
SET parameter2 = 0
SET duration = 0
SPRINT resource ~%___#nil%~
SET dicenumber = 0
SET dicesize = 0
SET savingthrow = 0
SET savebonus = 0
 END
END

BEGIN ~Add_Spell_Effect Test~

OUTER_PATCH ___#qwerty BEGIN
 WRITE_BYTE 0 0
 READ_ASCII 0 ___#nil (1)
END

//for effect macro:
OUTER_SET opcode = 0
OUTER_SET timing = 0
OUTER_SET power = 0
OUTER_SET parameter1 = 0
OUTER_SET parameter2 = 0
OUTER_SET target = 0
OUTER_SET resist_dispel = 0
OUTER_SET duration = 0
OUTER_SPRINT resource ~%___#nil%~
OUTER_SET dicenumber = 0
OUTER_SET dicesize = 0
OUTER_SET savingthrow = 0
OUTER_SET savebonus = 0
OUTER_SET probability1 = 100
OUTER_SET probability2 = 0
OUTER_SET header = 0

COPY_EXISTING ~spwi112.spl~ ~override~
 PATCH_FOR_EACH opcode IN 2 4 BEGIN
timing = 0
duration = 1
target = 2
resist_dispel = 3
LAUNCH_PATCH_MACRO ADD_SPELL_EFFECT
 END
BUT_ONLY_IF_IT_CHANGES

The first bug I fixed to write a LONG value (was BYTE). I can't figure this one out though. As far as I can tell, it bombs when trying to do the INSERT_BYTES but only on the second opcode on the last header. I've tried various versions of this code on various spells with multiple headers - same thing every time. I've put in debugging messages to see if it's writing the correct values and again, AFAICT it is.

Share this post


Link to post
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...