if by 'code lock' you mean a mutex/semaphore like approach, I'm just building a generic [mutex] external that will be included in the next release of The sadam Library. But you'll need to wait a little bit for that (I'm hoping to launch the next release in a month, but as I'm doing it in my spare time, I can't make a promise). The basic idea is that you'll have many instances of the same object sharing the same name (like with coll, buffer etc.), and you'll be able to lock/unlock them all at the same time.
its a school project where im supposed to do a code lock that have a 4 digit code, and i have to press the code in correct order to unlock, and if i press the wrong order or a wrong digit it will reset, and I'm supposed to use a counter to keep track of what order i pressed :)
1) Something to recognise what keys you have pressed and in which order
2) Something that compares what keys you pressed to what keys you are supposed to have pressed.
You can use a combination of [counter], [pack], [coll] and [if], which is what I assume you have been tasked to do - but there are much simpler (and more flexible) ways using objects which you might not have covered in your class yet, involving [textedit] or [zl stream] and [zl compare].
Put your mind down to use - it's only an exercise, if you couldn't do it on time, tell the teacher and he will help you, it's not a crime!
If you were up front about it being a school assignment, we could have helped point you in the right direction earlier and helped described the correct approach. I can't speak for everyone but if you think I would just hand over the code that finishes your homework for you, you are sadly mistaken. Better to ask the teacher BEFORE the deadline if he/she can be of more help.
The post above this one has a lot of helpful techniques. Basically in order to do this, you are asked to keep track of what's been pushed. Using an object like table or pack and route will let you take the number from the counter (the order or index) and pack it to a list with the number of the key you pushed. Route could then help you separate out the numbers (according to index) and then test them.
The trigger object is also your friend, it will help you with the "reset if incorrect" part of the problem.