# Is it possible to create a Timer based Trial For Instrument?



## tshoats (Jul 15, 2017)

Hey guys, I'm currently developing a Kontakt Instrument and I'm wondering is it possible to have a Trial for my instrument. I kind of got it working but not really. I'm using a wait() function, within a while() loop, that increments a variable. And when the timer hits a certain number, to hide all of my GUI's, and show a different Wallpaper.

Is there a better way to achieve this? Has anyone else tried creating a trial based instrument?? 

Thanks


----------



## INCIRIOS (Jul 15, 2017)

There's a lot of ways to look at doing this like with $ENGINE_UPTIME or a second script slot that writes on loading, but creating a copy of the NKI would get around that pretty easily. That's not the real route of the problem though, unless you have a way to remove the samples after the timer expires, all it does it lockout the NKI which is pretty easily replaceable. The samples would still be with the person that downloaded the library and that, realistically, is the problem that prevents developers from being able to reliably create trials within kontakt instruments. Alternatives are always being looked in to though


----------



## d.healey (Jul 15, 2017)

Yes you can do it, you could also make it only play a certain amount of notes and then go silent, no-matter what you do though your users will always be able to access the script and remove such limitations - there is no way to lock a Kontakt script that can't be undone, not even NI can do that yet.

Another option if you want to provide a demo is make a more limited version of the instrument that has less samples and less features but gives the user a good idea of the full version.


----------



## tshoats (Jul 15, 2017)

@Light & Sound, thanks a bro! hmmm ok I guess I can deal with someone using my samples for now. But the logic and my code is my concern. I have my while() loop and wait call inside my on note callback, which is pretty useless. I would like for it to be on my init callback, so it fires as soon as my instrument is loaded rather than on note. But the wait() cant be used inside the on note, any loop holes to get around this?? Thanks


----------



## tshoats (Jul 15, 2017)

@ d.healey thanks as well, Yea I may just have to go with your second option, of making another version with less features and sounds. But the trial would be cooler


----------



## magneto538 (Jul 21, 2017)

This piece of code effectively turns the sample playback off after 60 seconds. 
Forget about while() loops, meet the listener callback 


```
{Deactivate instrument's playback after a while}
on init
    declare $start_time
    $start_time := $ENGINE_UPTIME
    declare const $INST_KILL_TIME := 60000    {Time after which the instrument will be deactivated (milliseconds)}
    declare $inst_kill_state := 0
    set_listener($NI_SIGNAL_TIMER_MS, 1000000)
end on 

on listener 
    if ($NI_SIGNAL_TYPE = $NI_SIGNAL_TIMER_MS)
        if ($ENGINE_UPTIME - $start_time >= $INST_KILL_TIME and $inst_kill_state = 0)
            $inst_kill_state := 1
        end if
    end if
end on

on note 
    if ($inst_kill_state = 1)
        ignore_event($EVENT_ID)
        disallow_group($ALL_GROUPS)
    end if
end on

on release 
    if ($inst_kill_state = 1)
        ignore_event($EVENT_ID)
        disallow_group($ALL_GROUPS)
    end if
end on
```


----------



## stigma (Jul 26, 2017)

The code provide by Davide Magni works perfect...
I created the same results with the purge group method and it works perfect also...but...
From my point of view they are not absolutely perfect because the user can load again the instrument and use it for the same time as before...So in this way(that seems to be the best till now) we simply just "bother" the user in order to get bored loading the instrument again and again and to buy that if he likes it.
Of course in this situation the time has to be small(Lets say no more than 10-15 min) in order to have a clear view of how it sounds but from the other hand to not have enough time to record something serious.
The best would be a senario where the time that the instrument was used before close (lets say X minutes) should be deducted from the $INST_KILL_TIME so the next time that he loads the nki the time should be($INST_KILL_TIME-X).
In this way it should be possible to create a better trial (lets say for 24 hours) and leave the user to try it freely without interruptions but when the time is over it will not play again.
I don't know if something like this is possible.


----------



## d.healey (Jul 26, 2017)

stigma said:


> The code provide by Davide Magni works perfect...
> I created the same results with the purge group method and it works perfect also...but...
> From my point of view they are not absolutely perfect because the user can load again the instrument and use it for the same time as before...So in this way(that seems to be the best till now) we simply just "bother" the user in order to get bored loading the instrument again and again and to buy that if he likes it.
> Of course in this situation the time has to be small(Lets say no more than 10-15 min) in order to have a clear view of how it sounds but from the other hand to not have enough time to record something serious.
> ...


It's kind of pointless because it is not difficult to just edit the script and remove the time limit completely.


----------



## Mike Greene (Jul 26, 2017)

d.healey said:


> It's kind of pointless because it is not difficult to just edit the script and remove the time limit completely.


True, but only a hacker would know how to do that.

tshoats' plan certainly won't stop piracy, but for honest users, which in my experience is _most_ users, it does give him an opportunity to offer a timed version.


----------



## geronimo (Jul 27, 2017)

I find it very interesting and allows us to think about putting into action this, more in depth. Thanks to tshoats for his collaborative generosity _


----------



## Dynamitec (Jul 29, 2017)

Mike Greene said:


> True, but only a hacker would know how to do that.
> 
> tshoats' plan certainly won't stop piracy, but for honest users, which in my experience is _most_ users, it does give him an opportunity to offer a timed version.



That's not true. It's really sooo simple. It has nothing to do with hacking. The thing is that the demo will be uploaded as a "unlocked" full version in no time if you would do it that way. 

The only thing to really prevent privacy and doing demos like you suggest, is watermarking the NKI and the samples in the download process. So you can always see who leaked the files.


----------



## Lindon (Aug 3, 2017)

Dynamitec said:


> That's not true. It's really sooo simple. It has nothing to do with hacking. The thing is that the demo will be uploaded as a "unlocked" full version in no time if you would do it that way.
> 
> The only thing to really prevent privacy and doing demos like you suggest, is watermarking the NKI and the samples in the download process. So you can always see who leaked the files.




--- I cant count the number of times we've had this discussion about protecting NKI's. Long ago I wrote and authentication system for a series of nki's (the ones for DrumDrops as it happens) and reported back here comparing authenticated(even badly) vs not authenticated at all

- you can see the results if you search the forum I'm sure. But briefly: ANY authentication/protection is better than none/giving up because its too hard/expensive.


----------



## d.healey (Aug 3, 2017)

Lindon said:


> --- I cant count the number of times we've had this discussion about protecting NKI's. Long ago I wrote and authentication system for a series of nki's (the ones for DrumDrops as it happens) and reported back here comparing authenticated(even badly) vs not authenticated at all
> 
> - you can see the results if you search the forum I'm sure. But briefly: ANY authentication/protection is better than none/giving up because its too hard/expensive.


Right, and this - http://vi-control.net/community/threads/homebrew-serial-numbers.26406/


----------



## Lindon (Aug 4, 2017)

Its not a timed version but you can get some protection if you use Continuata 

http://www.continuata.com/


----------

