It seems that you have been making good progress. Let me give you some basics of the firmware that may help you. The main loop is constantly looping with a small wait time between, which is variable with the default at 10mS. Therefore, you can use simple if commands instead of the while loops.
Since you have a good grasp on programming and experience. Here is the documentation link for the GPC language reference. I suggest going through this and the various links to give you a better understand of what commands are allowed along with syntax.
http://www.consoletuner.com/kbase/gpc_language_reference.htm?mw=MjQw&st=MA==&sct=MA==&ms=AQAAEA== x = get_val(XB360_A);
while( x > 0 ) {
if(get_val(XB360_A)==0) {
break;
if (get_val(XB360_A) > 0) { what you want to do there}
With the scripts in Gtuner GPC Compiler, make sure that you use F7 (menu Complier - Compile) to check for errors. If it passes the compile, it will usually work in the Titan 1.
I think the issue in the first script may be the logic getting confused. I think that you need extra parentheses around the logic (get_ptime(BLINK) > filter). This will divide the IF into two distinctive logics. If this does not work, try taking out taking the filer "(get_ptime(BLINK) > filter)" and try it with the basic commands first.
For the inverted, you can try use a similar code to the first one except use event_release(BLINK) vs get_val(BLINK)
if (event_release(BLINK) && (get_ptime(BLINK) > filter) )