Jump to content


Photo

Editing an EFF file in Weidu


  • Please log in to reply
16 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 18 November 2017 - 12:47 PM

I have an EFF file, Protection from Spell, and I need to use Weidu to fill in the "Display string" field - what will be given as the explanation for the immunity. The field is 0x1c, a 4-byte long string reference field. How do I write into it?

 

While I'm at it, what is the Signature field?



#2 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 18 November 2017 - 02:04 PM

You don't need to use an existing .eff file, you could just as well copy the .spl file and without the .eff and then just

    LPF ~ADD_SPELL_EFFECT~ INT_VAR opcode = x target = x timing = x resist_dispel = x probability1 = 100 STR_VAR resource = EVAL ~Things you want to write about~ END

the x'es need to be filled in. Should do what's wanted.

The resource is 0x14, not 0x1c ... the EVAL is there to add the string if it doesn't exist and have the number marked as the resource.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#3 temnix

temnix
  • Member
  • 983 posts

Posted 19 November 2017 - 09:17 AM

I doubt this would work. The resource field for Use EFF should refer to an EFF file, not to the string it gives.



#4 Gwendolyne

Gwendolyne
  • Administrator
  • 1016 posts

Posted 19 November 2017 - 09:42 AM

Try this:

COPY myeffect.eff override
     WRITE_LONG 0x1c n            // n = refstr from dialog.tlk

or

COPY myeffect.eff override
     WRITE_LONG 0x1c RESOLVE_STR_REF (@n)   // n = refstr from tra file

CARPE DIEM ....
 

In progress : Menace sur le Royaume de Diamant Éternel there.


#5 Creepin

Creepin
  • Administrator
  • 1676 posts

Posted 19 November 2017 - 10:38 AM

And if I want to put text right into tp2, would that work?

COPY myeffect.eff override
WRITE_LONG 0x1c ~mytexthere~

The Old Gold - v0.2 WIP (mod for BGT/BWP/BWS)


#6 temnix

temnix
  • Member
  • 983 posts

Posted 19 November 2017 - 11:20 AM

No, it wouldn't. That's what I did at first. You need to put a reference number there for your string, not the string itself. And it should probably be WRITE_SHORT, for 4-byte fields?



#7 Creepin

Creepin
  • Administrator
  • 1676 posts

Posted 19 November 2017 - 11:46 AM

But I can't have a reference to the line not yet in dialog.tlk, right?


The Old Gold - v0.2 WIP (mod for BGT/BWP/BWS)


#8 -kjeron-

-kjeron-
  • Guest

Posted 19 November 2017 - 12:28 PM

And if I want to put text right into tp2:

COPY myeffect.eff override
SAY 0x1c ~mytexthere~


#9 Creepin

Creepin
  • Administrator
  • 1676 posts

Posted 19 November 2017 - 12:32 PM

Doh, I knew there were some simple way! Thank you :)


The Old Gold - v0.2 WIP (mod for BGT/BWP/BWS)


#10 subtledoctor

subtledoctor
  • Modder
  • 656 posts

Posted 20 November 2017 - 06:55 AM

And it should probably be WRITE_SHORT, for 4-byte fields?
1-byte fields get WRITE_BYTE
2-byte fields get WRITE_SHORT
4-byte fields get WRITE_LONG
8-byte fields get WRITE_ASCII (I think? Rarely encounter these.)

Edited by subtledoctor, 20 November 2017 - 06:56 AM.


#11 CamDawg

CamDawg

    ALL GLORY TO THE HYPNOTOAD

  • Modder
  • 1505 posts

Posted 20 November 2017 - 12:13 PM

And it should probably be WRITE_SHORT, for 4-byte fields?
1-byte fields get WRITE_BYTE
2-byte fields get WRITE_SHORT
4-byte fields get WRITE_LONG
8-byte fields get WRITE_ASCII (I think? Rarely encounter these.)

Eight-byte fields are typically ASCII fields, so while this is generally correct, it's not technically correct (the best kind of correct). WRITE_ASCII should be used for any ASCII field, be it the two-byte item animation field, the eight-byte resource field in an effect, or a 32-byte creature DV field. If you have a non-ASCII field of any length, use whatever combo of WRITE_BYTE/SHORT/LONG is appropriate. This is also why you see macros use INT_VAR (integers, non-ASCII) and STR_VAR (strings, ASCII) parameters.

 

SAY is just a fancy WRITE_LONG that accepts string parameters and spits out the correct strref for a field. SAY #123, SAY @123, and SAY ~foo~ will all work; WeiDU will either use an existing tlk reference that matches your string, or add the string to the tlk and use the new reference.

 

You can abuse READ/WRITE_ASCII for non-ASCII stuff since its ability to read/write arbitrary lengths is very useful--Tweaks and others use it to clone effects in single read/writes, for example, the majority of which is not data. In general, though, you're better served keeping them separate.

 

edit: A simple example may be better. Using WRITE_BYTE 0x00 4 will write 0x04 at the offset. Using WRITE_ASCII 0x00 4 #1 will write 0x34, the ASCII value for 4, at the offset.


Edited by CamDawg, 20 November 2017 - 12:18 PM.

Why is this Hypnotoad video so popu... ALL GLORY TO THE HYPNOTOAD.
____
The Gibberlings Three - Home of IE Mods

The BG2 Fixpack - All the fixes of Baldurdash, plus a few hundred more. Now available, with more fixes being added in every release.


#12 temnix

temnix
  • Member
  • 983 posts

Posted 20 November 2017 - 01:41 PM

How exhaustive. Forgot to mention it's not necessary to read fields before writing into them.



#13 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 21 November 2017 - 02:18 AM

How exhaustive. Forgot to mention it's not necessary to read fields before writing into them.

Well, not if you already know what's in it and have no use for the value.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#14 temnix

temnix
  • Member
  • 983 posts

Posted 21 November 2017 - 04:56 AM

Imp, the writing is the rewriting.



#15 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 21 November 2017 - 05:28 AM

Imp, the writing is the rewriting.

Yeah... but you don't need to know what the volatile is in:

COPY myeffect.eff override
     READ_LONG 0x1c ~volatile~
     WRITE_LONG 0x1c RESOLVE_STR_REF (@n)   // n = refstr from tra file

If you don't use it... as in:

COPY myeffect.eff override
     READ_LONG 0x1c ~volatile~
     PATCH_IF ~volatile = 1~ BEGIN
     WRITE_LONG 0x1c RESOLVE_STR_REF (@n)   // n = refstr from tra file

As you don't have the PATCH_IF ~if true condition~ BEGIN -condition in there... or whatever you put in that's place. You never asked on how you would do that. So it's assumed by everyone else that you don't need it.


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.


#16 temnix

temnix
  • Member
  • 983 posts

Posted 22 November 2017 - 03:59 AM

The PATCH_IF is only for making selections. Once you've homed in on the right selection, and if you know the popular offsets (name and so on), then you can just WRITE into them straight without that ritualistic conversion into strings.



#17 The Imp

The Imp

    Not good, see EVIL is better. You'll LIVE.

  • Member
  • 5150 posts

Posted 22 November 2017 - 05:08 AM

The PATCH_IF is only for making selections. Once you've homed in on the right selection, and if you know the popular offsets (name and so on), then you can just WRITE into them straight without that ritualistic conversion into strings.

Is that a question or ?

And PATCH_IF has other uses too...


Yep, Jarno Mikkola. my Mega Mod FAQ. Use of the BWS, and how to use it(scroll down that post a bit). 
OK, desert dweller, welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand. Ouh, actually it was still snow then.. but anyways.