• 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

Using defined spells for custom expression

Illyahr

Well-known member
I am working on a thing and I can't figure out the coding. What it is supposed to do is allow you to select from level 0 wizard spells and allow you to cast it 3/day as a spell-like ability. It would then attach that id into the SpInfo tag for the spell to show up in the description.

This is what I have so far:
Code:
var spell as string
var cast as string
var info as string
spell = tagis[sClass.Wizard] & tagis[sLevel.0]

field[usrCandid1].text = "thingid." & spell

cast = field[usrChosen1].chosen.tagis[thingid.?]
info = "SpInfo." & cast

perform assignstr[info]

My problem is in trying to define "spell." Any advice?
 
Last edited:
I would think you'd want your usrCandid1 field to look like this:

Code:
component.BaseSpell & sClass.Wizard & sLevel.0 & !Helper.Obsolete

You may or may not need to include "& !Spellbook.?". I'm not sure.
 
Got that working but for some reason it isn't assigning the SpInfo tag to the ability.

Have you tried debugging info to see what it comes out as?

Example:
Code:
var spell as string
var cast as string
var info as string
spell = tagis[sClass.Wizard] & tagis[sLevel.0]

field[usrCandid1].text = "thingid." & spell

cast = field[usrChosen1].chosen.tagis[thingid.?]
info = "SpInfo." & cast

perform assignstr[info]

debug info

You can then open up your debugging window and see what's happening there.
 
Have you tried debugging info to see what it comes out as?

You can then open up your debugging window and see what's happening there.

it tries to assign the string as "SpInfo.thingid.spell" for some reason. I looked at Martial Study, which has a similar coding.

Code:
var disc as string
var trunc as number
disc = field[fChosen].chosen.tagids[User.?]
trunc = length(disc)-4
disc = right(disc, trunc)
disc = "SpecSource" & disc
perform hero.child[fMartStudE].assignstr[disc]

Unfortunately, I don't know what some of those functions, such as length and right, mean so I can't replicate it.
 
it tries to assign the string as "SpInfo.thingid.spell" for some reason. I looked at Martial Study, which has a similar coding.

Code:
var disc as string
var trunc as number
disc = field[fChosen].chosen.tagids[User.?]
trunc = length(disc)-4
disc = right(disc, trunc)
disc = "SpecSource" & disc
perform hero.child[fMartStudE].assignstr[disc]

Unfortunately, I don't know what some of those functions, such as length and right, mean so I can't replicate it.

I recommend checking out the Pathfinder coding resources here:

http://forums.wolflair.com/showthread.php?t=21688

Not everything applies to d20, but it should help you better understand some of the mechanics.

Basically, though, this is what those two lines do:

trunc = length(disc)-4

This line sets the variable trunc equal to the number of characters in the string variable disc minus 4

disc = right(disc, trunc)

This line resets the string variable disc equal to the number of characters starting from the right in the original value.

Example:

disc = User.TagID
trunc = length(disc)-4 [10 characters -4 = 6]
disc = right(disc, trunc) [6 characters starting from right = ".TagID"
 
Got it to work properly. Thank you :)

No problem. I discovered a sleeker way to change parts of a string:

Code:
var disc as string
disc = field[fChosen].chosen.tagids[User.?]
disc = replace(disc, "User", "SpecSource", 0)

Thought it might be helpful for you.
 
Back
Top