Author Topic: feature request: high-integer option for ADD_SPELL  (Read 2048 times)

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 131
feature request: high-integer option for ADD_SPELL
« on: September 19, 2018, 10:18:38 PM »
I am in the process of adding a couple sound-based spells to my bard class mod, and for various reasons I would like them to be in SPELL.IDS.  But I don't particularly want them to be generally available to wizards, so I am going to add them to HIDESPL.2DA. 

But then I thought, that's silly.  Those spells are taking up space in the precious precious spxx01-50 range, and they don't need to.  Rather than adding them to HIDESPL - or in addition to it - it would be nice if there was a flag in the ADD_SPELL function that would generate a RES in the SPxx51-99 range.

Offline DavidW

  • Planewalker
  • *****
  • Posts: 316
Re: feature request: high-integer option for ADD_SPELL
« Reply #1 on: September 19, 2018, 10:28:09 PM »
Can’t you just write a function to find the first free slot?

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 298
  • Gender: Male
Re: feature request: high-integer option for ADD_SPELL
« Reply #2 on: September 19, 2018, 10:44:35 PM »
ADD_SPELL uses a tp2 function to do just that.  I've been meaning to update it so it can put stuff in the 50-99 range for ages now.  I thought it involved more than just changing the numbers in the file.

Right... I think the only complication is that those spells wouldn't be accessible without tobex and an updated spells.2da.  I think I decided later that it would best to leave the expanding of the files to another mod, and just install them into that range even if the user doesn't have tobex, as that's preferable to failing the install.

Edit: also I'm really sleepy and maybe didn't read the entire post.  But technically that 50-99 range should be available for regular spells with a little tweaking a la tobex / EE engine.
« Last Edit: September 19, 2018, 10:47:32 PM by Mike1072 »

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 131
Re: feature request: high-integer option for ADD_SPELL
« Reply #3 on: September 20, 2018, 04:29:07 PM »
ADD_SPELL uses a tp2 function to do just that.  I've been meaning to update it so it can put stuff in the 50-99 range for ages now.  I thought it involved more than just changing the numbers in the file.... I think the only complication is that those spells wouldn't be accessible without tobex and an updated spells.2da.

No - that's the whole point.  This would be for spells that are meant to be inaccessible, but for which we still want an IDS name and reference.

Of course I could just copy a spell in, which would be inaccessible, and then homebrew up a function to assign it IDS values... if I wanted to divert precious time and resources away from other more interesting and important ventures.  But ADD_SPELL already does this; all that would need changing is something like, add an 'INT_VAR high_range = 0' variable to the TB#ADD_SPELL_FIND_SLOT subfunction, and shift to the 51-99 range when it is set to 1.  I.e. only the numbers would need to change.

Offline DavidW

  • Planewalker
  • *****
  • Posts: 316
Re: feature request: high-integer option for ADD_SPELL
« Reply #4 on: September 20, 2018, 05:35:27 PM »
Of course I could just copy a spell in, which would be inaccessible, and then homebrew up a function to assign it IDS values... if I wanted to divert precious time and resources away from other more interesting and important ventures.

Not that many resources. Try:

Code: [Select]
DEFINE_ACTION_FUNCTION find_next_ids_slot
     INT_VAR first_two_digits=10
             start_at=1
     RET ids
BEGIN
  ACTION_IF start_at>99 BEGIN
     OUTER_SET ids="-1"
  END ELSE BEGIN
     ACTION_IF start_at<10 BEGIN
         OUTER_SPRINT to_check "%first_two_digits%0%start_at%"
     END ELSE BEGIN
         OUTER_SPRINT to_check "%first_two_digits%%start_at%"
     END
     OUTER_INNER_PATCH "" BEGIN
        LOOKUP_IDS_SYMBOL_OF_INT discard spell "%to_check%"
     END
     ACTION_IF IS_AN_INT discard BEGIN
        OUTER_SET ids=to_check
     END ELSE BEGIN
        OUTER_SET start_at +=1
        LAF find_next_ids_slot INT_VAR first_two_digits start_at RET ids END
     END
  END
END
« Last Edit: September 20, 2018, 05:36:07 PM by DavidW »

Offline Mike1072

  • Planewalker
  • *****
  • Posts: 298
  • Gender: Male
Re: feature request: high-integer option for ADD_SPELL
« Reply #5 on: September 20, 2018, 05:38:14 PM »
Hmm, I don't really understand the scenarios where an IDS name is necessary.  However, I think you can use ADD_SPELL with SPIN and SPCL to do what you want.  I wouldn't be in favor of your proposal because it wastes those precious slots that can be activated via tobex.

Offline subtledoctor

  • Planewalker
  • *****
  • Posts: 131
Re: feature request: high-integer option for ADD_SPELL
« Reply #6 on: September 26, 2018, 06:33:04 AM »
Fair enough.

 

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)?: