I have used something like this and it works well:
Code:
quest::setglobal("variablename", $qglobals{variablename}+1, 5, "F");
Also, if you are wanting to setup something like a Task, you can use the actual task system. It is a bit complex to learn at first, but works very well once you know how to do it. It might just be the best way to do what you are wanting to do.