Author Topic: ADD_SPELL  (Read 1820 times)

Offline Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1944
  • Gender: Male
    • The Fields of the Dead
ADD_SPELL
« on: January 08, 2014, 02:13:18 PM »
It finally dawned on me that using ADD_SPELL to install the new spells in FotD means that the corresponding spell scrolls, as well as any spellcasters using these spells, have incorrect resource references now. Is there an easy way to store the new filename in a variable and replace those old references with that variable?

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 298
  • Gender: Male
Re: ADD_SPELL
« Reply #1 on: January 08, 2014, 02:35:29 PM »
When you use ADD_SPELL, a variable whose name matches the IDS identifier you gave for the spell is set to the code assigned to the spell when it is added to spell.ids.

You can use this code to determine the file name.  (Maybe use the included RES_NAME_OF_SPELL_NUM function.)

Offline Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1944
  • Gender: Male
    • The Fields of the Dead
Re: ADD_SPELL
« Reply #2 on: January 08, 2014, 02:46:26 PM »
Thanks. It looks like those functions will do the job.

Offline Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1944
  • Gender: Male
    • The Fields of the Dead
Re: ADD_SPELL
« Reply #3 on: January 09, 2014, 07:23:58 AM »
Just out of curiosity, why does ADD_SPELL create the ADD_SPELL.IDS file? I noticed it in the DEBUG when checking to see if my code worked.

TP2 code:

Code: [Select]
ADD_SPELL ~fotd\spl\spin160.spl~ 3 1 INNATE_CONE_OF_COLD
  SAY NAME1 @823
  LAUNCH_ACTION_FUNCTION RES_NAME_OF_SPELL_NUM
    INT_VAR
    spell_num = "%INNATE_CONE_OF_COLD%"
    RET
    INNATE_CONE_OF_COLD = spell_res
  END
  PRINT ~The filename of INNATE_CONE_OF_COLD is %INNATE_CONE_OF_COLD%~

ADD_SPELL ~fotd\spl\spin161.spl~ 3 1 OGRE_MAGE_SLEEP
  SAY NAME1 @691

DEBUG code:

Code: [Select]
Copying and patching 1 file ...
[fotd\spl\spin160.spl] loaded, 298 bytes
Copied [fotd\spl\spin160.spl] to [override/spin128.spl]
[*.IDS] forgotten
Appending to files ...
Appended text to [spell.ids]
Copying 1 file ...
Copied [.../inlined/null.file] to [override/add_spell.ids] (NO BACKUP MADE!)
Copying and patching 1 file ...
[./override/add_spell.ids] loaded, 0 bytes
Copied [add_spell.ids] to [override/add_spell.ids] (NO BACKUP MADE!)
Clearing the IDS map.
[*.IDS] forgotten
Added spell INNATE_CONE_OF_COLD
[./override/SPELL.IDS] loaded, 24409 bytes

The filename of INNATE_CONE_OF_COLD is SPIN128
Adding spell OGRE_MAGE_SLEEP
[./override/add_spell.ids] loaded, 26 bytes
[./override/ADD_SPELL.IDS] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
[./override/add_spell.ids] loaded, 26 bytes
Copying and patching 1 file ...
[fotd\spl\spin161.spl] loaded, 394 bytes
Copied [fotd\spl\spin161.spl] to [override/spin129.spl]

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 298
  • Gender: Male
Re: ADD_SPELL
« Reply #4 on: January 09, 2014, 02:12:02 PM »
It's part of a weird complicated solution that tries to ensure spells keep the same assigned filenames even if some mods get uninstalled and reinstalled.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: