From a6d58bb6052ac8cb01805a48c4ad2f129126116f Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 24 Feb 2010 02:13:59 +0000 Subject: Added KDE3 version of kvirc git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1095341 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- doc/scriptexamples/antiidle/antiidle.kvs | 159 +++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 doc/scriptexamples/antiidle/antiidle.kvs (limited to 'doc/scriptexamples/antiidle/antiidle.kvs') diff --git a/doc/scriptexamples/antiidle/antiidle.kvs b/doc/scriptexamples/antiidle/antiidle.kvs new file mode 100644 index 00000000..a4b59cca --- /dev/null +++ b/doc/scriptexamples/antiidle/antiidle.kvs @@ -0,0 +1,159 @@ +# +# anti idle script +# : some people like it, some people need it +# : by Balboy :)) +# + +# creating the main alias + +alias(aidle) +{ + # using a switch to see what option has been selected + switch($0) + { + # ok, so the script should start + case(start): + { + # checking if it wasn't running already + if(!%Aidlestatus{$ic}) + { + # the script wasn't running already, so it should be started by calling the + # script with the run parameter + aidle internal_run + # saving the status of the anti idle script + %Aidlestatus{$ic} = 1 + # an anti idle var is set, to define the speed of the anti itde script + # there are 2 possible ways + %Aidletype{$ic} = 1 + echo "Anti idle has been enabled" + } else { + # the script was already running + echo "Anti idle has already been enabled on this server" + } + } + break + # the script should be halted + case(stop): + { + # checking if it was already running + if(%Aidlestatus{$ic}) + { + # the script was running, so it should be stopped by killing the timer + killtimer antiidle{$ic} + # clearing variabled + %Aidlestatus{$ic} = "" + %Aidletype{$ic} = "" + echo "Anti idle has been disabled" + } else { + # the script wasn't running + echo "Anti idle has not been enabled on this server" + } + } + break + # the script status should be shown + case(status): + { + # checking the status variable + if(%Aidlestatus{$ic}) + { + echo "anti idle is enabled on this server" + } else { + echo "anti idle is disabled on this server" + } + } + break + # this is a parameter that should only be called by the script itself + # this is where the idle time gets actualy killed + + case(internal_run): + { + # this part will make a varianle to switch random anti idle modes (fast/slow) + # note: once a type has been decided, changing the type works by a small chance + %aidletypecheck{$ic} = $rand(100) + if(%aidletypecheck{$ic} < 10) + { + if(%Aidletype{$ic} == 1) + { + %Aidletype{$ic} = 2 + } else { + %Aidletype{$ic} = 1 + } + } + # use the var just created to start one of the anti idle modes + if(%Aidletype{$ic} == 1){ + # starting a timer who will keep sending messages to yourself, no output will be shown + timer -r=$console -s (antiidle{$ic},$(10000 + $rand(50000))) + { + aidle internal_run + # checking if we are online + if($server) + { + raw -q privmsg $me : + } + } + } else { + # this part is simular as above + timer -r=$console -s (antiidle{$ic},$(10000 + $rand(30000))) + { + aidle internal_run + if($server) + { + raw -q privmsg $me : + } + } + } + } + break + # the script should be uninstalled + case(uninstall): + { + echo "the anti idle script has been uninstalled succesfully" + # defining the alias by empty code will remove it + alias(aidle){} + event(412,aidle){} + + } + break + # if help was asked + case(help): + { + echo "usage: /aidle