Jump to content

Photo

Weidu macro libraries

weidu tp2 coding tutorial

77 replies to this topic

#16 cmorgan

cmorgan

    journeyman investigator

  • Gibberlings
  • 7097 posts
  • Gender:Male
  • Location:Glencoe, IL, USA

Posted 30 October 2007 - 02:05 PM

OK, thank you :(. I will try to get them up on the wikki, but it will take a few days - my cup runneth over.
I love deadlines. I love the whooshing noise they make as they go by. - Douglas Adams

#17 Gort

Gort
  • Members
  • 190 posts

Posted 20 November 2007 - 02:12 AM

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

#18 Miloch

Miloch

    Barbarian

  • Modders
  • 4803 posts
  • Gender:Male
  • Location:At Large

Posted 20 November 2007 - 09:14 AM

Why, what's wrong with them?

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
================================================================
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it." -Terry Pratchett


#19 Gort

Gort
  • Members
  • 190 posts

Posted 20 November 2007 - 09:02 PM

well, they aren't foolproof)

#20 Miloch

Miloch

    Barbarian

  • Modders
  • 4803 posts
  • Gender:Male
  • Location:At Large

Posted 24 November 2007 - 02:46 AM

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).

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
================================================================
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it." -Terry Pratchett


#21 Gort

Gort
  • Members
  • 190 posts

Posted 24 November 2007 - 10:56 PM

I did a revision, but I can't update the wiki

#22 Miloch

Miloch

    Barbarian

  • Modders
  • 4803 posts
  • Gender:Male
  • Location:At Large

Posted 26 November 2007 - 12:32 AM

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."

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
================================================================
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it." -Terry Pratchett


#23 Gort

Gort
  • Members
  • 190 posts

Posted 26 November 2007 - 01:43 AM

i just deleted them, the new link was several posts lower. I updated the first post now

#24 cmorgan

cmorgan

    journeyman investigator

  • Gibberlings
  • 7097 posts
  • Gender:Male
  • Location:Glencoe, IL, USA

Posted 26 November 2007 - 04:40 PM

My ETA is a few weeks on this, I am afraid - but you could create a special Wikki account, and help yourself :p
I love deadlines. I love the whooshing noise they make as they go by. - Douglas Adams

#25 Gort

Gort
  • Members
  • 190 posts

Posted 26 November 2007 - 08:45 PM

I can't.

#26 Miloch

Miloch

    Barbarian

  • Modders
  • 4803 posts
  • Gender:Male
  • Location:At Large

Posted 03 June 2008 - 12:55 AM

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)?

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
================================================================
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it." -Terry Pratchett


#27 the bigg

the bigg

    The Avatar of F/Ts

  • Modders
  • 2337 posts
  • Gender:Male
  • Location:Modena (Italy)

Posted 03 June 2008 - 12:58 AM

Not yet, but it's a matter of really nagging me.
Italian users: help test the Stivan NPC!

Author or Co-Author: WeiDU - Widescreen - Generalized Biffing - Refinements - TB#Tweaks - IWD2Tweaks - TB#Characters - Traify Tool - Some mods that I won't mention in public
Maintainer: Semi-Multi Clerics - Nalia Mod - Nvidia Fix
Code dumps: Detect custom secondary types - Stutter Investigator

If possible, send diffs, translations and other contributions using Git.

#28 Miloch

Miloch

    Barbarian

  • Modders
  • 4803 posts
  • Gender:Male
  • Location:At Large

Posted 03 June 2008 - 03:47 PM

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.

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
================================================================
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it." -Terry Pratchett


#29 Mike1072

Mike1072
  • Gibberling Poobah
  • 2469 posts
  • Gender:Male
  • Location:Canada

Posted 03 June 2008 - 07:36 PM

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.

#30 Miloch

Miloch

    Barbarian

  • Modders
  • 4803 posts
  • Gender:Male
  • Location:At Large

Posted 16 July 2008 - 09:28 AM

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.

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
================================================================
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it." -Terry Pratchett




Reply to this topic



  



Also tagged with one or more of these keywords: weidu tp2 coding, tutorial

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users