View Single Post
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,001

Old February 25th, 2021, 04:56 AM
Quote:
Originally Posted by Illyahr View Post
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"
Sendric is online now   #6 Reply With Quote