Jump to content

Enhanced ALTER_EFFECT functions


Recommended Posts

On 6/15/2019 at 8:26 PM, DavidW said:

Define a function that reads savebonus, adds something, writes it back. Then run ALTER_EFFECT

I've long wished for a "READ_EFFECT" companion to the ALTER_, CLONE_, and DELETE_EFFECT. Always end up just doing it manually with GET_OFFSET_ARRAY instead of clamoring for this, but boy would it be handy for casual use.

Link to comment
2 hours ago, DavidW said:

The return interface is a bit tricky. Is one returning just the last result obtained, or an array of all of them?

I don't have anything specific in mind, I just thought it would be nice to do something like

COPY_EXISTING ~spell.spl~ ~override~
  LPF READ_EFFECT INT_VAR match_opcode = 0 RET duration END

Something like that. Looking at it, I see right off it could be problematic if there are two matching instances (such as multiple opcode 0 effects).

Anyway, I'm mostly just musing. I always thought something like that would be nice. But I'm not sure it's worth anyone putting real time into.

Link to comment

More relevant question: I have used this in one of my mods where I needed to ALTER_EFFECT something to a negative value. Works great - thank you!

But I am a bit worried about dropping this in /lib/ and INCLUDEing it; I have a zillion other instances where I use the traditional *_EFFECT functions, and if they suddenly switch to using this version, with arguments assuming the old version, I don't want something to go astray.

My current solution is to simply rename these enhanced functions to ALTER_EFFECT_DW, CLONE_EFFECT_DW, etc. Works like a charm* and has the side-effect of clearly showing where credit for the work goes. But maybe I am being too cautious? Should I just suck it up and completely overwrite the original Weidu functions with these? What worked on the old ones will work on the new ones?

...

* (Wait, do charms actually work??)

Edited by subtledoctor
Link to comment

They ought to be fine. I use Cam's code (the one included in WEIDU) as a base and then just add other functionality. If you don't use that other functionality, the results should be identical.

It's always possible I broke something, of course, but I don't think so (I've been using these modified functions for a while, including in SCS and (iirc) Ascension, and problems haven't arisen.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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