Jump to content

Help Request about JContainer, Scripting


Versh

Recommended Posts

Posted

Hi everyone,

 

I want to ask if someone, already experienced with Jcontainer, could give me an hand to understand the usage.

 

I'm actually trying to use it in order to extend my mod functionality to SlaveTats, maximizing the efficience of the code... Things impossible to me at the current state of knowledge.

 

I've already read the documentation, the Api, the Wiki and other script example (CreatureFrameworks, SlaveTats, others...) but my lack of knowlege of english give me serious issues about.

 

To be brief:

I should perform some calculation about  specific npc, in the same time (for now recover the number of the Tattoo in the Feet area)

 

I've tried with something like:

        Int CountTotal
        Int TemplateListTotal = JValue.addToPool(JMap.object(), "DDMDQ_TatsCount")
        Int MatchesListTotal = JValue.addToPool(JArray.object(), "DDMDQ_TatsCount")
        
        JMap.setStr(TemplateListTotal, "area", "Feet")
        
        If query_applied_tattoos(Subject, templateListTotal, matchesListTotal)
            CountTotal = 0
        Else
            CountTotal = JArray.count(matchesListTotal)
        EndIf
        JValue.cleanPool("DDMDQ_TatsCount")

But... If I've understand it right: this will make ALL the calculation on the same point (DDMDQ_TatsCount), Considering that this function runs on various npc at the same time the "DDMDQ_TatsCount" will recieve the count of ALL Npc.

 

So, could someone explain me how to perform the calcs separately?

I've thinked to set unique "poolName" for every npc, but it will be a dirty fix and, as said, I'm also trying to make an efficient function...

 

If I've understood right there's a JFormDB that could be use in such case... But as said I couldn't figure when/where/how to put...

 

 

Before anyone ask: I've already asked to the author of SlaveTats some hints, and I prefer to not stress further, also maybe having this info here could be useful also for someone else (or at least, more useful than in my PM folder) :P

 

So, tnx for any help you could give

 

 

Posted
        Int CountTotal
        Int TemplateListTotal = JValue.retain(JMap.object())
        Int MatchesListTotal = JValue.retain(JArray.object())
        
        JMap.setStr(TemplateListTotal, "area", "Feet")
        
        If query_applied_tattoos(Subject, templateListTotal, matchesListTotal)
            CountTotal = 0
        Else
            CountTotal = JArray.count(matchesListTotal)
        EndIf
        JValue.release(TemplateListTotal)
        JValue.release(MatchesListTotal)

This should go. Your code is also ok and it will not return the count of all Npcs. The reason I modified the code is that the pool is global

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...