Jump to content

New Spell Modding Question


Ayce

Recommended Posts

Continued offtopicness...

 

the conglomeration of Nythrun's & Miloch's code (which couild probably bee cleaned up since it was me who conglomeratized it...) that shows both the list idea and the %tutu_var% idea:

 

  /* Apply Nythrun's Fixes to creatures we use */
 ACTION_FOR_EACH ~crefile~ IN ~%tutu_scripta%varicem.cre~
						   ~%tutu_scriptb%ullrush.cre~
						   ~%tutu_scriptbg%neb.cre~
						   ~%tutu_scriptd%ursword.cre~
						   ~%tutu_scriptf%twbax_a.cre~
						   ~%tutu_scripti%ronelit.cre~
						   ~%tutu_scriptm%oorlock.cre~
						   ~%tutu_scripto%grema03.cre~
						   ~%tutu_scripts%handal2.cre~
						   ~%tutu_var%alatos.cre~
						   ~%tutu_var%albert.cre~
						   ~%tutu_var%alvanh.cre~
						   ~%tutu_var%alyth.cre~
						   ~%tutu_var%amaran.cre~
						   ~%tutu_var%angelo.cre~
						   ~%tutu_var%ankheg.cre~
						   ~%tutu_var%arkush.cre~
						   ~%tutu_var%avarice.cre~
						   ~%tutu_var%bandit.cre~
						   ~%tutu_var%baresh.cre~
						   ~%tutu_var%bassil.cre~
						   ~%tutu_var%bayard.cre~
						   ~%tutu_var%bearbl.cre~
						   ~%tutu_var%bearbr.cre~
						   ~%tutu_var%bearca.cre~
						   ~%tutu_var%bearpo.cre~
						   ~%tutu_var%belt.cre~
						   ~%tutu_var%bently.cre~
						   ~%tutu_var%bjorni.cre~
						   ~%tutu_var%brage.cre~
						   ~%tutu_var%brielb.cre~
						   ~%tutu_var%brilla.cre~
						   ~%tutu_var%cadder.cre~
						   ~%tutu_var%calaha.cre~
						   ~%tutu_var%chase.cre~
						   ~%tutu_var%claird.cre~
						   ~%tutu_var%coksmth.cre~
						   ~%tutu_var%daitel.cre~
						   ~%tutu_var%dalton.cre~
						   ~%tutu_var%davaeo.cre~
						   ~%tutu_var%deathk.cre~
						   ~%tutu_var%delain.cre~
						   ~%tutu_var%delsvir.cre~
						   ~%tutu_var%deltan.cre~
						   ~%tutu_var%dopdur1.cre~
						   ~%tutu_var%drienn.cre~
						   ~%tutu_var%drizzt.cre~
						   ~%tutu_var%dryad.cre~
						   ~%tutu_var%durlagt.cre~
						   ~%tutu_var%durlyl.cre~
						   ~%tutu_var%dushai.cre~
						   ~%tutu_var%elmin2.cre~
						   ~%tutu_var%elmin5.cre~
						   ~%tutu_var%ender.cre~
						   ~%tutu_var%entill.cre~
						   ~%tutu_var%erdane.cre~
						   ~%tutu_var%faldor.cre~
						   ~%tutu_var%farmbr.cre~
						   ~%tutu_var%fear.cre~
						   ~%tutu_var%fearm.cre~
						   ~%tutu_var%fenrus.cre~
						   ~%tutu_var%fireb1.cre~
						   ~%tutu_var%flame.cre~
						   ~%tutu_var%galken.cre~
						   ~%tutu_var%galtok.cre~
						   ~%tutu_var%gatewa.cre~
						   ~%tutu_var%gellan.cre~
						   ~%tutu_var%gerde.cre~
						   ~%tutu_var%girba2.cre~
						   ~%tutu_var%gnoll.cre~
						   ~%tutu_var%gorion.cre~
						   ~%tutu_var%grael.cre~
						   ~%tutu_var%greywo.cre~
						   ~%tutu_var%hack.cre~
						   ~%tutu_var%hafiz.cre~
						   ~%tutu_var%halaca.cre~
						   ~%tutu_var%halbaz.cre~
						   ~%tutu_var%hurgan.cre~
						   ~%tutu_var%ike.cre~
						   ~%tutu_var%iron11.cre~
						   ~%tutu_var%isla.cre~
						   ~%tutu_var%jessup.cre~
						   ~%tutu_var%joia.cre~
						   ~%tutu_var%kaisha.cre~
						   ~%tutu_var%karoug.cre~
						   ~%tutu_var%keeper.cre~
						   ~%tutu_var%keldda.cre~
						   ~%tutu_var%kirinh.cre~
						   ~%tutu_var%korax.cre~
						   ~%tutu_var%krumm.cre~
						   ~%tutu_var%landri.cre~
						   ~%tutu_var%larze.cre~
						   ~%tutu_var%liia.cre~
						   ~%tutu_var%love.cre~
						   ~%tutu_var%lovem.cre~
						   ~%tutu_var%madarc.cre~
						   ~%tutu_var%marl.cre~
						   ~%tutu_var%meiala.cre~
						   ~%tutu_var%mendas.cre~
						   ~%tutu_var%mulahe.cre~
						   ~%tutu_var%mutami.cre~
						   ~%tutu_var%narlen.cre~
						   ~%tutu_var%niemai.cre~
						   ~%tutu_var%nobw2.cre~
						   ~%tutu_var%perdue.cre~
						   ~%tutu_var%petrin.cre~
						   ~%tutu_var%pheirk.cre~
						   ~%tutu_var%phlydi3.cre~
						   ~%tutu_var%poe.cre~
						   ~%tutu_var%pride.cre~
						   ~%tutu_var%pridem.cre~
						   ~%tutu_var%prost5.cre~
						   ~%tutu_var%pumberl.cre~
						   ~%tutu_var%rielta.cre~
						   ~%tutu_var%riggilo.cre~
						   ~%tutu_var%sarev1.cre~
						   ~%tutu_var%sarevo.cre~
						   ~%tutu_var%sarhed.cre~
						   ~%tutu_var%scar.cre~
						   ~%tutu_var%seniya.cre~
						   ~%tutu_var%serva2.cre~
						   ~%tutu_var%shoal.cre~
						   ~%tutu_var%silke.cre~
						   ~%tutu_var%skie.cre~
						   ~%tutu_var%slave.cre~
						   ~%tutu_var%taerom.cre~
						   ~%tutu_var%takiyah.cre~
						   ~%tutu_var%tamoko.cre~
						   ~%tutu_var%tarnes.cre~
						   ~%tutu_var%tarnor.cre~
						   ~%tutu_scriptbg%tazok.cre~
						   ~%tutu_var%tazok2.cre~
						   ~%tutu_var%tellan.cre~
						   ~%tutu_var%tenya.cre~
						   ~%tutu_var%thalan.cre~
						   ~%tutu_var%therel.cre~
						   ~%tutu_var%ulraun.cre~
						   ~%tutu_var%unshey.cre~
						   ~%tutu_var%vai.cre~
						   ~%tutu_var%vail.cre~
						   ~%tutu_var%volo.cre~
						   ~%tutu_var%winski.cre~
						   ~%tutu_var%winski2.cre~
						   ~%tutu_var%winthr2.cre~
						   ~%tutu_var%yago.cre~
						   ~%tutu_var%zombie.cre~
						   ~%tutu_var%zombiew.cre~
						   ~%tutu_var%ajanti.cre~
						   ~%tutu_var%ajanti4.cre~
						   ~%tutu_var%ajanti6.cre~
						   ~%tutu_var%alora.cre~
						   ~%tutu_var%alora6.cre~
						   ~%tutu_var%branwe.cre~
						   ~%tutu_var%branwe5.cre~
						   ~%tutu_var%coran.cre~
						   ~%tutu_var%coran5.cre~
						   ~%tutu_var%dynahe.cre~
						   ~%tutu_var%dynahe2.cre~
						   ~%tutu_var%dynahe4.cre~
						   ~%tutu_var%dynahe6.cre~
						   ~%tutu_var%edwin.cre~
						   ~%tutu_var%edwin2.cre~
						   ~%tutu_var%edwin4.cre~
						   ~%tutu_var%edwin6.cre~
						   ~%tutu_var%faldor.cre~
						   ~%tutu_var%faldor5.cre~
						   ~%tutu_var%garric.cre~
						   ~%tutu_var%garric2.cre~
						   ~%tutu_var%garric4.cre~
						   ~%tutu_var%garric6.cre~
						   ~%tutu_var%imoen1.cre~
						   ~%tutu_var%imoen2.cre~
						   ~%tutu_var%imoen4.cre~
						   ~%tutu_var%imoen6.cre~
						   ~%tutu_var%jaheir.cre~
						   ~%tutu_var%jaheir2.cre~
						   ~%tutu_var%jaheir4.cre~
						   ~%tutu_var%jaheir6.cre~
						   ~%tutu_var%kagain.cre~
						   ~%tutu_var%kagain2.cre~
						   ~%tutu_var%kagain4.cre~
						   ~%tutu_var%kagain6.cre~
						   ~%tutu_var%khalid.cre~
						   ~%tutu_var%khalid2.cre~
						   ~%tutu_var%khalid4.cre~
						   ~%tutu_var%khalid6.cre~
						   ~%tutu_var%kivan.cre~
						   ~%tutu_var%kivan4.cre~
						   ~%tutu_var%kivan6.cre~
						   ~%tutu_var%minsc.cre~
						   ~%tutu_var%minsc2.cre~
						   ~%tutu_var%minsc4.cre~
						   ~%tutu_var%minsc6.cre~
						   ~%tutu_var%montar.cre~
						   ~%tutu_var%montar2.cre~
						   ~%tutu_var%montar4.cre~
						   ~%tutu_var%montar6.cre~
						   ~%tutu_scriptbg%quayle.cre~
						   ~%tutu_var%quayle4.cre~
						   ~%tutu_var%quayle6.cre~
						   ~%tutu_var%safana.cre~
						   ~%tutu_var%safana4.cre~
						   ~%tutu_var%safana6.cre~
						   ~%tutu_var%sharte.cre~
						   ~%tutu_var%sharte4.cre~
						   ~%tutu_var%sharte6.cre~
						   ~%tutu_var%skie.cre~
						   ~%tutu_var%skie6.cre~
						   ~%tutu_var%tiax.cre~
						   ~%tutu_var%tiax4.cre~
						   ~%tutu_var%tiax6.cre~
						   ~%tutu_var%viconi.cre~
						   ~%tutu_var%viconi4.cre~
						   ~%tutu_var%viconi6.cre~
						   ~%tutu_scriptbg%xan.cre~
						   ~%tutu_var%xan4.cre~
						   ~%tutu_var%xan6.cre~
						   ~%tutu_var%xzar.cre~
						   ~%tutu_var%xzar2.cre~
						   ~%tutu_var%xzar4.cre~
						   ~%tutu_var%xzar6.cre~
						   ~%tutu_var%yeslic.cre~
						   ~%tutu_var%yeslic5.cre~
						   ~idemon02.cre~
						   ~imp01.cre~
						   ~mepsmo01.cre~ BEGIN
ACTION_IF FILE_EXISTS_IN_GAME ~%crefile%~ THEN BEGIN
  COPY_EXISTING ~%crefile%~ ~override~
	LAUNCH_PATCH_MACRO ~enforce_cre_order~
	LAUNCH_PATCH_MACRO ~use_v2_eff~
	PATCH_IF FILE_EXISTS_IN_GAME ~fw0125.are~ BEGIN // Miloch's Fix buggered Tutu soundslots
	  FOR (s1 = 0xa4; s1 < 0x234; s1 += 0x4) BEGIN
		READ_LONG s1 ss
		PATCH_IF (ss > 10000000) BEGIN WRITE_LONG s1 ~-1~ END
	  END
	END
  BUT_ONLY_IF_IT_CHANGES
END
 END

 

On this one, the regexp was blasted hard/impossible, so an action list worked great.

 

 

But to pick up all project-added .cres, instead of writing long lists, it was a straight regexp:

 

  /* Patching all creatures in component for Tutu -> BGT items */
 ACTION_IF FILE_EXISTS_IN_GAME ~AR7200.are~ THEN BEGIN
COPY_EXISTING_REGEXP GLOB ~^[XP]#.+\.cre$~ ~override~
  PATCH_IF (SOURCE_SIZE > 0x2d3) BEGIN
   LAUNCH_PATCH_MACRO ~tutu_items_to_bgt~
  END
BUT_ONLY_IF_IT_CHANGES
 END

 

ALLOW MISSING was a desperately useful and needed command Back in The Day, but hopefully no one uses it any more, as not everyone uses PATCH_IF (SOURCE_SIZE... especially older mods who had no reason to mess with it using the technology of the time (and the code literacy base available. Hard to be literate in something that is just being built!).

Link to comment

Except you don't want to use

ACTION_FOR_EACH ~crefile~ IN
~%tutu_var%alatos.cre~
...
~%tutu_var%yeslic5.cre~ BEGIN
 COPY_EXISTING ~%crefile%~ ~override~
PATCH_LIST
 BUT_ONLY
END

when it's finely compressable in half as much

ACTION_FOR_EACH ~crefile~ IN
~alatos~
...
~yeslic5~ BEGIN
 COPY_EXISTING ~%tutu_var%%crefile%.cre~ ~override~
PATCH_LIST
 BUT_ONLY
END

PS Point being, if one can manually gather a list of filenames then they as well can split that list in two, squeeze the bunch of %tutu_var% as shown in this post, leave the remainder be, allot PATCH_LIST into a separate macro and launch for both blocks. The less code there is, the better.

Link to comment
PS Point being, if one can manually gather a list of filenames then they as well can split that list in two, squeeze the bunch of %tutu_var% as shown in this post, leave the remainder be
There's no real reason to use %tutu_var% at all in an ACTION_FOR_EACH, unless it's a huge list like cmorgan's example. For Ayce's purpose (patching NPCs for spells), the example above...
ACTION_FOR_EACH viconia IN _viconi _viconi4 _viconi6 viconi viconi4 viconi6 viconi8 viconi9 viconi11 viconi13 viconi16 BEGIN

...should suffice for all platforms.

Link to comment
PS Point being, if one can manually gather a list of filenames then they as well can split that list in two, squeeze the bunch of %tutu_var% as shown in this post, leave the remainder be
There's no real reason to use %tutu_var% at all in an ACTION_FOR_EACH, unless it's a huge list like cmorgan's example. For Ayce's purpose (patching NPCs for spells), the example above...
ACTION_FOR_EACH viconia IN _viconi _viconi4 _viconi6 viconi viconi4 viconi6 viconi8 viconi9 viconi11 viconi13 viconi16 BEGIN

...should suffice for all platforms.

Unless he's already using or has reasons to use %tutu_var% in an earlier location within the same component. Then he can go ahead and use the shorter list and include the %tutu_var% within the copy line as Ardanis pointed out.

 

But to each their own...

Link to comment

Archived

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

×
×
  • Create New...