• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Getting an error trying to implement a custom metamagic feat.

Redcap's Corner

Well-known member
I'm working on a custom metamagic feat. I feel pretty confident about the coding because it's pretty closely based on Reach Spell, anyway. It appears to be working when I apply the feat to a spell, but it gives me an in-program error that reads "Live state of gizmo 'CustSpell' is being tested before live state of parent pick 'sCustomSpl' is resolved". Again, it lets me proceed, it adds the correct spell level adjustment, and otherwise seems to be doing its job. I just ALSO get the error. Any thoughts? I can post more information if necessary, but I'm not sure what to post because I don't have any idea what the error means.
 
That happens because the "Test Now!" button in the editor can't handle some complex situations, and you've hit one of them.

So, when testing your metamagic, instead of using "Test Now!", you'll have to go back to HL itself, and in the Develop menu, make sure Enable Data File Debugging is turned on, then use "Quick Reload Data Files" from that menu (the keyboard shortcut for that is ctrl-r).
 
Thanks!

Now I'm trying to get a little fancy with the feat and have it make its alterations to the spell in the text of the spell too. I'm understanding more and more with every new trick I try, but I'm still borrowing quite heavily from other people's code. I came up with the following:

Code:
perform state.parent.amendthing[duration, replace(state.parent.field[sDuration].text,"round","minute",0)]

And I'm getting an error that says "Thing - Invalid unique id". Anyone have any idea what I screwed up? I'm trying to get the feat to replace the word "round" in the duration field with the word "minute". It's already replacing the appropriate tag, but as I said, I'm trying to get fancy.
 
Scratch that. That error was just because I had a floating copied item that I'd forgotten to delete. The new error I'm getting is "Reference to undeclared variable: 'state'". If I try removing the "state." from the code, I get "Script reference is invalid under the circumstances."
 
Last edited:
amendthing is not the correct way to accomplish what you're trying to do. It can't make the change you appear to want it to make. If you can't find another example to draw from, I'll help you figure out how to make that change.
 
Thanks again. I'm searching through everything I can for another example to draw from, but so far coming up empty. I expected that Elemental Spell might do some text replacement, but it doesn't seem like it does. Most of the metamagic seems to be doing tag replacement only.
 
Start with what you want to change: the sDuration field on the spell itself

Then, figure out where you are now: a metamagic within the gizmo on the spell

So, take a look at this article:http://forums.wolflair.com/showthread.php?t=21663

Look at the section named "gizmo" since you're in a gizmo - what transition will get you to the pick that the gizmo is within (that's the spell).

For the next step, you've now moved to a pick context, so look in that article at the pick section - how do you get from there to the field?

And for the final step, this is a text field - what are you going to use to refer to that text?

When you've worked through those, you'll have the left-hand side of an expression that sets something = something else. Once you've gotten the left-hand side, I'll help you with the right-hand side.
 
That gets me:

Code:
parent.field[sDuration].text

Which I know I can use in the following way:

Code:
parent.field[sDuration].text = "1 minute/level"

But it's a lot less clear to me how to replace only the word "round" in that field with the word "minute", leaving all other text intact. Thanks again for your help on this, and for taking things slowly for me. (:
 
Last edited:
Would you mind posting the final version, please, so that if someone else searches this forum and finds this thread in the future, they can see the answer?

And add the phase & priority that worked for you, along with the script.
 
Absolutely! I ended up using:

Code:
parent.field[sDuration].text = replace(parent.field[sDuration].text,"round","minute",0)

The feat is a metamagic feat that is to Extend Spell as Reach Spell is to Enlarge Spell. The script runs at first/15000 and here it is in all its convoluted glory:

Code:
~ If the spell doesn't qualify for this feat, don't change anything.
doneif (parent.tagis[sDuration.Round] + parent.tagis[sDuration.Minute] + parent.tagis[sDuration.10Minute] = 0)

~ Take note of the original unit of measurement.
var oldunit as number
if (parent.tagis[sDuration.10Minute] <> 0) then
  oldunit = 3
elseif (parent.tagis[sDuration.Minute] <> 0) then
  oldunit = 2
elseif (parent.tagis[sDuration.Round] <> 0) then
  oldunit = 1
  endif

~ Add metamagic adjustment to help figure out which unit to convert to.
var newunit as number
newunit = oldunit
newunit += field[mmLevel].value

~ Change to the new unit of measurement.
perform parent.delete[sDuration.10Minute]
perform parent.delete[sDuration.Minute]
perform parent.delete[sDuration.Round]
if (newunit >= 4) then
  perform parent.assign[sDuration.Hour]
  if (oldunit = 1) then
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"Round","Hour",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"round","hour",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"Rds.","Hours",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"rds.","hours",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"Rd.","Hour",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"rd.","hour",0)
  elseif (oldunit = 2) then
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"Minute","Hour",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"minute","hour",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"Mins.","Hours",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"mins.","hours",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"Min.","Hour",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"min.","hour",0)
  elseif (oldunit = 3) then
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"0 Minute"," Hour",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"0 minute"," hour",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"0 Mins."," Hours",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"0 mins."," hours",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"0 Min."," Hour",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"0 min."," hour",0)
    endif
elseif (newunit >= 3) then
  perform parent.assign[sDuration.10Minute]
  if (oldunit = 1) then
    parent.field[sDuration].text = replace(parent.field[sDuration].text," Round","0 Minute",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," round","0 minute",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," Rds.","0 Mins.",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," rds.","0 mins.",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," Rd.","0 Min.",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," rd.","0 min.",0)
  elseif (oldunit = 2) then
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"Minutes","Minute",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text,"minutes","minute",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," Minute","0 Minutes",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," minute","0 minutes",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," Mins.","0 Mins.",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," mins.","0 mins.",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," Min.","0 Min.",0)
    parent.field[sDuration].text = replace(parent.field[sDuration].text," min.","0 min.",0)
    endif
elseif (newunit >= 2) then
  perform parent.assign[sDuration.Minute]
  parent.field[sDuration].text = replace(parent.field[sDuration].text,"Round","Minute",0)
  parent.field[sDuration].text = replace(parent.field[sDuration].text,"round","minute",0)
  parent.field[sDuration].text = replace(parent.field[sDuration].text,"Rds.","Mins.",0)
  parent.field[sDuration].text = replace(parent.field[sDuration].text,"rds.","mins.",0)
  parent.field[sDuration].text = replace(parent.field[sDuration].text,"Rd.","Min.",0)
  parent.field[sDuration].text = replace(parent.field[sDuration].text,"rd.","min.",0)
  endif
parent.field[sDuration].text = replace(parent.field[sDuration].text,"00 Minute"," Hour",0)
parent.field[sDuration].text = replace(parent.field[sDuration].text,"00 minute"," hour",0)
parent.field[sDuration].text = replace(parent.field[sDuration].text,"00 Mins."," Hours",0)
parent.field[sDuration].text = replace(parent.field[sDuration].text,"00 mins."," hours",0)
parent.field[sDuration].text = replace(parent.field[sDuration].text,"00 Min."," Hour",0)
parent.field[sDuration].text = replace(parent.field[sDuration].text,"00 min."," hour",0)
 
Last edited:
Back
Top