~~Title: Counting via Custom Locks~~
{{tag>guides}}
==== Implementing Simple Counting using Custom Locks ====
It is always recommended to use testnet/sandbox first!
#checkCounter
lockcheck=2,L4 err=count5
lockcheck=2,L3 err=count4
lockcheck=2,L2 err=count3
lockcheck=2,L1 err=count2
do=count1
exit
:clearCounter
lock=0,L1
lock=0,L2
lock=0,L3
lock=0,L4
back
:count1
echo=~~codedoc:clean:"First call!"~~
lock=1,L1
exit
:count2
echo=~~codedoc:clean:"Second call!"~~
lock=1,L2
exit
:count3
echo=~~codedoc:clean:"Third call!"~~
lock=1,L3
exit
:count4
echo=~~codedoc:clean:"Fourth call!"~~
lock=1,L4
exit
:count5
echo=~~codedoc:clean:"Fifth call - starting over!"~~
do=clearCounter
exit
(Note: L1-L4 above are custom made up names that can be changed freely!)
=== Attention ===
Always double check that you are using the right syntax/alert!