• 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

Detecting Languages in "Magic Ring" Bootstrap Condition

karpana

Active member
Hi There,

I'm working on a some custom "Rings of Eloquence", and have copied out all the pertinent bits to provide the skill bonuses (using the uncopy-able one from a supplement).

What I'm trying to do is add the 4 custom languages, so that they show up in the character's languages known, and have successfully determined that each of the languages needs to be "bootstrapped" in. So this is working.

I've also determined, thanks to the wonderful "401" conditions page figured out that I can use "fieldval:gIsEquip <> 0" to only action the bootstrap if the magic ring is listed as equipped. So this is working.

What isn't working is detecting whether the bootstrapped language is already present on the character or not... I've been trying to use "SpeakLang.lFirstSpch" and "hero#SpeakLang.lFirstSpch" do not provide any results.

The compiler won't let me put the timing any later than Pre-Levels 10000, so I'm at a loss...

How do I get the condition to detect that 1) the language in question doesn't already exist on the character, so that when the ring is equipped, it adds the language in the bootstrap.

This is what I currently have for my lFirstSpch bootstrap
Code:
fieldval:gIsEquip <> 0 & hero#SpeakLang.lFirstSpch = 0

THanks in advance.
 
Code:
fieldval:gIsEquip <> 0 & hero#SpeakLang.lFirstSpch = 0
This bootstrap condition is a little off. You got it really close!

SpeakLang.lFirstSpch is a tag and you can simply check for the presence or absence of the tag without adding any = 0 stuff. To check for 'no tag' you use ! in front of the tag name:
Code:
fieldval:gIsEquip <> 0 & !SpeakLang.lFirstSpch

If you really wanted to use the = 0 logic you would need to "count" the tags to see if you have none. This is also great for if you need to count class levels:
Code:
fieldval:gIsEquip <> 0 & count:SpeakLang.lFirstSpch = 0

Now then the next issue is timing. I just ran some tests to see when the tag becomes live on the hero. I used the following script to test up to Pre-Levels/9999:
Code:
debug hero.tagis[SpeakLang.lFirstSpch]
Unfortunately it appears that the tag does not get on to the hero until Pre-Levels/10001. This means you can't use this tag in the bootstrap logic. :(

Going to have to do a little bit of a work around to get this to work as you will have to "manually" check for the existence of the language yourself.
First/400:
Code:
~ If language found set abValue5 to 1 so we can check in the bootstrap
If (hero.childlives[lFirstSpch] = 1) Then
  field[abValue5].value = 1
Endif

Then change the Bootstrap logic to be this at First/500:
Code:
fieldval:gIsEquip <> 0 & fieldval:abValue5 <> 0

Now you get to know if the language is live or not by First/500. I used abValue5 as its not often used and makes things easy for checking a simple value on our self.

Hope that helps.
 
Thank you ShadowChemosh.

I rather suspected it was a timing problem, as the syntax that you provided for the condition, was a solution I had tried at one point, which failed, evidently because of the timing problem.

As for the First/400 code, I'm assuming this is an eval script?

I do have one more question, and it stems from the use of the abValue5.
The Ring of Eloquence grants 4 separate languages, and my current solution is to use 4 separate bootstraps for each granted language, with the objective being to only add the given language if it doesn't exist.

I have a wacky idea using "pipe-delimited strings" being loaded into abValue5 for each found language, and then using the "pos" command to locate the first occurence of the given language.

Can I load strings into abValue5?
 
I took a quick stab a trying to push a string into the abValue5 variable. Suffice to say it doesn't work. (not unexpected mind you).

In looking at the fields (using the debug info screen), at least for this specific magical item (ring), it would seem that the abValue2 through abValue5 don't change, or seem to not be used. Leading me to think that I should be pretty safe to to use them as 'flag fields' for each of the four languages I'm putting into this "Ring of Eloquence".

Are there any pitfalls I should be aware of, considering it was indicated that abValue5 is the least used, in using abValue2, abValue3 and abValue4?

Alternatively, would it better/safer to create some unique fields or tags, to store these unique flags for myself?
 
Last edited:
Are there any pitfalls I should be aware of, considering it was indicated that abValue5 is the least used, in using abValue2, abValue3 and abValue4?
The abValue to abValue5 field are generic value fields for you to use when building Things. What makes them so nice is that scripts outside of your Thing can access them and change them. Without knowing the rest of your script logic I didn't know if you where already using them.

In this case it sounds like you can easily use 2-5 as flag values to control the other bootstraps.

Alternatively, would it better/safer to create some unique fields or tags, to store these unique flags for myself?
You can't add new "fields" to Picks. This can only be done by LW for Pathfinder as it requires access to the skeletal files that we don't have access too.

But you can make up new tags. The easy way in the editor is near the bottom look for "User Tags" which always start with group "Custom.?". You could create your own tags and instead of setting a value into abValue fields you could assign the tag to the hero and then check for that in the bootstrap condition.

Code:
~ If language found set Custom.lFirstSpch tag on Hero container
If (hero.childlives[lFirstSpch] = 1) Then
  perform hero.assign[Custom.lFirstSpch]
Endif

Bootstrap:
Code:
fieldval:gIsEquip <> 0 & !Custom.lFirstSpch

Another way to go that would use tags but would prevent the need of using Custom.? tags is to manually push the SpeakLang.? tags to the hero yourself at first 400. This is a bit more advanced and most likely overkill as it uses a Foreach loop:

First/400
Code:
~ Pull the LangSpeak tag from each Base Language Pick to our self
foreach pick in hero from BaseLang
  perform eachpick.pulltags[LangSpeak.?]
nexteach

~ Push all collected LangSpeak tags from our self to the hero
perform hero.pushtags[LangSpeak.?]
The foreach loop finds all Picks on the hero of the Base Language type. We then pull the tag LangSpeak using a wild card ? to pull any specific tags. So in example when we find common we will pull the SpeakLang.lCommon specific tag. Then at the end pushtags sends all the SpeakLang tags we have collected to the hero allowing the bootstrap to test for them.

First/600
Code:
~ Remove all LangSpeak tags from hero so we don't get double
perform hero.delete[LangSpeak.?]
To prevent issues with any later scripts that may do tagcount[LangSpeak.?] we then delete the tags.

Bootstrap:
Code:
fieldval:gIsEquip <> 0 & !LangSpeak.lFirstSpch

I am just showing some different examples here to show how you can use the HL scripting language to solve an issue different ways.
 
Solid Examples ShadowChemosh. Thank you!

I'll pore of these a bit more tonight when I get in front of an HL Editor.
abValueX seems the simplest way, but I think going with Custom.X might equally set my needs.
 
ShadowChemosh

I'm thinking this might be something I've done wrong, at least with using the custom tags, but I'm finding that the following four statements always return "1" unless the eval script (which is on the magic ring), is set to "pre-level/10000".

The result of which, is that because the Bootstrap Condition, which can't run any later than "pre-level/10000", I end up with the problem that the bootstrap conditions always return true, (I'm assuming because they essentially run before for the eval, even when also set to "pre-level/10000"), and thus all four languages are always added, even though lFirstSpch already exists on the character.

Thoughts or ideas?

Edit: I've attached a copy of four of the languages on my character
Common ... Added as part of race
Druidic ... Added as part of class
FirstSpeech ... Added as part of high Int (via the Background Tab)
Ignan ... added as a result of having ranks in linguisitics (via the Personal Tab)
Looks like, apart from Common, they're all running in "Pre-Level/10000" :/

Code:
debug "eval2"
debug hero.childlives[lFirstSpch]
debug hero.childlives[lDraconic]
debug hero.childlives[luIobarian]
debug hero.childlives[lGiant]


If (hero.childlives[lFirstSpch] = 1) Then
  perform hero.assign[Custom.lFirstSpch]
Endif

If (hero.childlives[lDraconic] = 1) Then
  perform hero.assign[Custom.lDraconic]
Endif

If (hero.childlives[luIobarian] = 1) Then
  perform hero.assign[Custom.luIobarian]
Endif

If (hero.childlives[lGiant] = 1) Then
  perform hero.assign[Custom.lGiant]
Endif
 

Attachments

  • Timing.jpg
    Timing.jpg
    295 KB · Views: 3
Last edited:
Can you attach your .user file to this thread. It will just make it way easier to make sure we are both on the same page. Plus I can play around with the file real quick to see what is going on.... :)
 
Your eval script and your bootstrap conditions are both at Pre-Level/10000 - the eval script needs to come first, so maybe Pre-Level/9990. If two things are at the same time, it's random which one HL will execute first.
 
Ok my bad! I forgot in this specific case you can't use childlives[]. :o

The reason is that if we test at First/400 HL sees the bootstrapped lFirstSpch and says its live because the "condition" logic does not run until First/500. Basically childlives[] is seeing the bootstrapped languages. :(

I fixed it but it takes a little more logic as we have to check to see if any "user added" languages where added. We want to ignore the languages you have bootstrapped so we don't test for their existence on the hero.

Here is that script running at First/400:
Code:
foreach pick in hero from BaseLang where "thing.user_added & (Language.lFirstSpch|Language.lDraconic|Language.luIobarian|Language.luIobarian)"
  If (eachpick.tagis[Language.lFirstSpch] = 1) Then
    perform hero.assign[Custom.lFirstSpch]
  ElseIf (eachpick.tagis[Language.lDraconic] = 1) Then
    perform hero.assign[Custom.lDraconic]
  ElseIf (eachpick.tagis[Language.luIobarian] = 1) Then
    perform hero.assign[Custom.luIobarian]
  ElseIf (eachpick.tagis[Language.lGiant] = 1) Then
    perform hero.assign[Custom.lGiant]
  Endif
nexteach

I also changed your file and have attached the updated version to this post.

P.S. - This is often why you wont see LW do this type of logic of auto-adding stuff. Instead they would give "bonus" languages and an error message to inform the user to manually add the missing language(s).
 

Attachments

Thanks for the updated file ShadowChemosh.
I'm about to watch a grudge-match hockey game on the TV. ;-) [Go Jets Go!]

I'll checkout the changes you made a bit later (probably between periods)
 
Back
Top