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)
-   -   Help with a code (http://forums.wolflair.com/showthread.php?t=66821)

Illyahr February 21st, 2022 10:44 AM

Help with a code
 
Ok, trying to create a thing that replaces an Initiator discipline with another. Got the thing that adds the new discipline but having trouble removing the selected discipline

Code:

var disc as string

disc = hero.child[trBlkThrn].field[fChosen].chosen.tagids[AllowCust.?,"|"]
disc = replace(disc, "AllowCust.", "thingid.x", 0)
disc = disc & "Ft"

field[ftCandExpr].text = "(" & disc & ")"

var repl as string
repl = field[fChosen].chosen.tagids[User.?]
repl = replace(repl, "User", "AllowCust", 0)
perform hero.child[trBlkThrn].field[fChosen].chosen.deletestr[disc]

Top half is working but I get a tag syntax error with the bottom half. Any ideas?

ploturo February 21st, 2022 08:23 PM

Can there be multiple User.? tags on the pick you are working with (or none at all)?

The delete[] and deletestr[] target references expect a tag template with just one group.tag in it, potentially with a wildcard to allow matching similarly named tags.

So if your tagids[User.?] ever returns a string with multiple tags or an empty string if there are no matching tags, using that string as the tag template for deletestr[] will result in the error you are seeing.

If the tag has no wildcards and doesn't match an existing tag, you will get a different "Tag [...] not defined" error message.

Sendric February 22nd, 2022 07:38 AM

put in the line "debug disc" in your code. You can then see what it is by opening up floating debug window "Show Debug Output".

Also, I wonder if you intended to delete "repl" instead of "disc". I'm not sure you really need a second variable here, but from this code snippet you seem to be setting the variable repl but not using it.

Illyahr February 22nd, 2022 09:15 AM

Quote:

Originally Posted by Sendric (Post 298377)
Also, I wonder if you intended to delete "repl" instead of "disc". I'by opening up floating debug window "Show Debug Output".m not sure you really need a second variable here, but from this code snippet you seem to be setting the variable repl but not using it.

Oops lol

Apparently, AllowCust also comes back with an invisible tag for its own thing. For example, a Warblade has AllowCust for each of its disciplines, but also for cWarblade naturally. It would pull that and get an invalid tag when processed.


All times are GMT -8. The time now is 08:00 PM.

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