Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - d20 System

Notices

Reply
 
Thread Tools Display Modes
Illyahr
Senior Member
 
Join Date: Feb 2013
Posts: 322

Old February 16th, 2021, 05:09 PM
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?

I have a Patreon and donations are appreciated. It is only to show support while I program stuff.

Last edited by Illyahr; February 16th, 2021 at 05:46 PM.
Illyahr is offline   #1 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 2,985

Old 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.
Sendric is online now   #2 Reply With Quote
Illyahr
Senior Member
 
Join Date: Feb 2013
Posts: 322

Old February 17th, 2021, 09:02 AM
Got that working but for some reason it isn't assigning the SpInfo tag to the ability.

I have a Patreon and donations are appreciated. It is only to show support while I program stuff.
Illyahr is offline   #3 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 2,985

Old February 18th, 2021, 05:24 AM
Quote:
Originally Posted by Illyahr View Post
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.
Sendric is online now   #4 Reply With Quote
Illyahr
Senior Member
 
Join Date: Feb 2013
Posts: 322

Old February 24th, 2021, 06:26 PM
Quote:
Originally Posted by Sendric View Post
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.

I have a Patreon and donations are appreciated. It is only to show support while I program stuff.
Illyahr is offline   #5 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 2,985

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
Illyahr
Senior Member
 
Join Date: Feb 2013
Posts: 322

Old February 27th, 2021, 05:08 AM
Got it to work properly. Thank you

I have a Patreon and donations are appreciated. It is only to show support while I program stuff.
Illyahr is offline   #7 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 2,985

Old March 4th, 2021, 04:01 AM
Quote:
Originally Posted by Illyahr View Post
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.
Sendric is online now   #8 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:09 AM.


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