Jump to content

Where to find specific kit abilities and how to copy an entire kit?


Recommended Posts

On 2/2/2021 at 11:17 PM, gamemaster76 said:

Edit: Nevermind, I misunderstood something. 16 stays there and only the middle number changes! I have ll the breath weapons to what they should be!

For the love of god

LPF ALTER_EFFECT 
  INT_VAR 
    match_opcode = OPCODE_hp_damage 
    parameter2 = DAMAGETYPE_electricity
END

https://ielib.bgforge.net

Link to post

There’s something to be said for learning what’s going on under the hood...

(I don't know what that link is, the result is a blank page in my (mobile) browser...)

EDIT - OK I see it now in my computer, and... meh. I don't know that it's that much easier to remember "DAMAGE_TYPE_lightning" versus "(4 << 16)." And what if you want a %-change in damage, instead of a set number? That variable does not address that.

Whoops, I mean "DAMAGETYPE_lightning."

Whoops, I mean "DAMAGETYPE_electric."

Whoops, I mean "DAMAGETYPE_static_cling."

Et cetera. If  I'm working with NI open anyway, I don't need an extra layer of jargon to memorize.

I won't even get into the fact that, as a VSCode extension, I assume this is OS-dependent and thus useless to people with a Mac or Linux.

Last EDIT - don't mean to come down too hard on the project. It is nicely done and if it helps people then that's great. But it does not help me, and so "for the love of god" seems a bit hyperbolic.

Edited by subtledoctor
Link to post

Well, here's the website's own description:

Quote

 

IElib is companion library for BGforge MLS, a VScode extension providing support for WeiDU syntaxes, as well as Infinity Engine script and dialog file formats.

Essentially, it defines various constants: opcode numbers, icon numbers, etc, so that they could be used instead of magic numbers, improving overall code readability and simplifying development. (Similarly to what WeiDU does.) Most of the these are pulled from IESDP.

 

Can't equate, Infinity Engine library to be IElib....net , näh.

Link to post
9 hours ago, subtledoctor said:

There’s something to be said for learning what’s going on under the hood...

Point taken. However, learning is one thing, and production usage is another.

The issue is that magic numbers are in some top 10 of bad programming practices, and generally should be avoided. The reasons why are explained numerous times by experienced programmers, easily googled with "why magic numbers are bad", or "code smell magic numbers".

And yes, you can add comments to clarify the mumbo-jumbo. But they do not work as well as defined constants.

For example, the code can be changed to

OPCODE_hp_damage = 12
DAMAGETYPE_electricity = 262144  // (0 + (1 << 4))  (0 + (1 << 16))
LPF ALTER_EFFECT
  INT_VAR
    match_opcode = OPCODE_hp_damage
    parameter2 = DAMAGETYPE_electricity

This is what "for the love of God" refers to. It is not hyperbolic at all.

 

Unrelated to the main issue:

  1. Of course, with time you tire of defining and looking at the constants over and over again. The exact numbers are not useful for the context. So you tuck them away into an include. And then you want to use the same include in another mod. So a library is born.
    I do not mean at all that you should use IElib specifically. By all means, build your own or use another one. Just remember, every time when a programmer uses a magic number, God kills a kitten. (Although I do think that combining efforts is more efficient.)
  2. 10 hours ago, subtledoctor said:

    I won't even get into the fact that, as a VSCode extension, I assume this is OS-dependent and thus useless to people with a Mac or Linux.

    - I'm not sure why do you assume that. As far as I can tell, on the contrary, VSCode is the cross-platform code editor.
    - The extension and the library are two separate things. They are integrated, but can be used independently.

  3. 10 hours ago, subtledoctor said:

    I don't know that it's that much easier to remember "DAMAGE_TYPE_lightning" versus "(4 << 16)." And what if you want a %-change in damage, instead of a set number? That variable does not address that.

    Whoops, I mean "DAMAGETYPE_lightning."

    Is it easier to remember 0x248 versus SCRIPT_OVERRIDE?
    Well, to each his own, of course. However, the goal is not having to remember, and focus on logic instead of offsets and bit fields:449426095_Capturadepantallade2021-02-0708-50-43.thumb.png.bfc5aaba79dca80bfa2313135d0ab880.png
     

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