# killtimer

Stops a timer

Syntax

    killtimer <name>

Description
Kills a timer named <name>
Examples

        # Just a plain timer
        timer(test,1000){ echo "Hello!"; }
        # Now watch the timer running
        killtimer test
        # Single shot timer
        timer -s (test,1000){ echo "This will fire only once!"; }
        # The call above is equivalent to
        timer(test,1000){ echo "This will file only once!"; killtimer test; }
        # Callback parameters: consider the following code
        %parameter = "some string value"
        echo "Before calling /timer \%parameter is \"%parameter\""
        timer -s (test,1000,%parameter){ echo "inside the callback \%parameter is \"%parameter\" but \$0 is \"$0\""; }
        # watch the timer running , and note the behaviour of the %parameter variable
        killtimer test
        # Use the extended scope timer variables
        timer(test,1000)
        {
            # Use the extended scope %:count variable to keep track
            # of the times that this timer has been called
            if("%:count" == "")%:count = 1
            else %:count++
            echo "This timer has fired %:count times"
            if(%:count == 10)killtimer test
        }
        # Use isTimer to check if the timer exists
        echo $isTimer(test)
        # Repeat the command above after the 10th timeout...

See also
timer, $isTimer

Main index, Command index

KVirc 3.0.0 documentation
Generated by root at Thu Apr 29 12:41:05 2004