Search code examples
dm-script

What the function of TagGroupReleaseSeeds


In the manual of DM script, it said the function of TagGroupReleaseSeeds is "Releases the seeds returned by 'TagGroupGetSeeds'." But I can't catch the meaning. Could anyone give me more explanation. Thanks.


Solution

  • It is unlikely that these commands are of much use to you.

    Their purpose is to check the "dirty" state of a TagGroup (i.e. whether it changed since some other point in time.) Essentially, a TagGroup has an internal "counter" of changes which is increased whenever it is changed. You can use it like this:

    ClearResults()
    taggroup testTG = NewTagGroup()
    Result("Seeds of Taggroup:\n")
    Result( testTG.TagGroupGetSeeds() +"\n")
    Result( testTG.TagGroupGetSeeds() +"\n")
    testTG.TagGroupSetTagAsNumber("Dummy",-100)
    Result( testTG.TagGroupGetSeeds() +"\n")
    testTG.TagGroupSetTagAsNumber("Dummy",100)
    Result( testTG.TagGroupGetSeeds() +"\n")
    testTG.TagGroupSetTagAsNumber("Dummy2",-100)
    Result( testTG.TagGroupGetSeeds() +"\n")
    testTG.TagGroupMarkAsChanged()
    Result( testTG.TagGroupGetSeeds() +"\n")
    
    Result("\n Remember Tag state...") 
    number seeds = testTG.TagGroupGetSeeds()
    testTG.TagGroupSetTagAsString("str","dummy")
    
    if ( testTG.TagGroupHasChangedSince(seeds) )
        Result("\n Tag was changed since remembered state...")