Recalling votes
#6
Delayed vote script: gives you a 5 second grace period to cancel your vote. To cancel, press the opposite vote button. To vote before then, just vote again.
// Reset the aliases just in case
cancelallvotes = [ votingno = 0; votingyes = 0; votetimestamp = 0]
cancelallvotes

vote_exec1 = [ vote 1; echo " 0You voted yes"; cancelallvotes ]
vote_exec2 = [ vote 2; echo " 3You voted no"; cancelallvotes ]

// $arg1 = millis
delayed_vote = [
    // only bother if we're actually due
    if (= ($votetimestamp) ($arg1) ) [
        if (= ($votingyes) 1) [ vote_exec1 ]
        if (= ($votingno) 1) [ vote_exec2 ]
    ] [
        echo "All this wait for nothing..."
    ]
]

delayed_vote_start = [ votetimestamp = (millis); sleep 5000 [ delayed_vote votetimestamp ] ]

delayvote1 = [
    if (= ($votingyes) 1) [
        // voting yes when already have voted yes, do it immediately
        vote_exec1
    ] [
        if (= ($votingno) 1) [
            // changed mind, cancel
            echo " 6You cancelled your F2"; cancelallvotes
        ] [
            // normal/first vote
            echo "Voting YES in five seconds!"; votingyes = 1; delayed_vote_start
        ]
    ]
]

delayvote2 = [
    if (= ($votingno) 1) [
        // voting no when already have voted no, do it immediately
        vote_exec2
    ] [
        if (= ($votingyes) 1) [
            // changed mind, cancel
            echo " 6You cancelled your F1"; cancelallvotes
        ] [
            // normal/first vote
            echo "Voting NO in five seconds!"; votingno = 1; delayed_vote_start
        ]
    ]
]
bind "F1" [delayvote1]
bind "F2" [delayvote2]
Thanks given by:


Messages In This Thread
Recalling votes - by Duckett - 21 Feb 11, 04:14AM
RE: Recalling votes - by ImaCripple - 21 Feb 11, 04:40AM
RE: Recalling votes - by Mael - 21 Feb 11, 04:58AM
RE: Recalling votes - by MorganKell - 21 Feb 11, 05:15AM
RE: Recalling votes - by Lantry - 21 Feb 11, 05:16AM
RE: Recalling votes - by Gibstick - 21 Feb 11, 06:06PM
RE: Recalling votes - by MykeGregory - 21 Feb 11, 06:50PM
RE: Recalling votes - by Gibstick - 21 Feb 11, 06:59PM
RE: Recalling votes - by Xeoncross - 21 Feb 11, 07:46PM
RE: Recalling votes - by al3rt - 21 Feb 11, 09:05PM
RE: Recalling votes - by SnowOak - 27 Feb 11, 07:47AM
RE: Recalling votes - by Gibstick - 27 Feb 11, 05:37PM
RE: Recalling votes - by Polusive - 22 Mar 11, 10:22AM
RE: Recalling votes - by Gibstick - 22 Mar 11, 11:50AM
RE: Recalling votes - by eftertanke - 22 Mar 11, 12:04PM
RE: Recalling votes - by Gibstick - 22 Mar 11, 12:10PM
RE: Recalling votes - by eftertanke - 22 Mar 11, 12:17PM