Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - d20 System (http://forums.wolflair.com/forumdisplay.php?f=46)
-   -   Using defined spells for custom expression (http://forums.wolflair.com/showthread.php?t=65420)

Illyahr February 16th, 2021 05:09 PM

Using defined spells for custom expression
 
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?

Sendric February 17th, 2021 03:53 AM

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.

Illyahr February 17th, 2021 09:02 AM

Got that working but for some reason it isn't assigning the SpInfo tag to the ability.

Sendric February 18th, 2021 05:24 AM

Quote:

Originally Posted by Illyahr (Post 293630)
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.

Illyahr February 24th, 2021 06:26 PM

Quote:

Originally Posted by Sendric (Post 293639)
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.

Sendric February 25th, 2021 04:56 AM

Quote:

Originally Posted by Illyahr (Post 293794)
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:

Quote:

trunc = length(disc)-4

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

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"

Illyahr February 27th, 2021 05:08 AM

Got it to work properly. Thank you :)

Sendric March 4th, 2021 04:01 AM

Quote:

Originally Posted by Illyahr (Post 293854)
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.


All times are GMT -8. The time now is 06:35 AM.

Powered by vBulletin® - Copyright ©2000 - 2021, vBulletin Solutions, Inc.
wolflair.com copyright 1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.