Trying to retrieve current frame number for use in Cycles particle age material I'm trying to create a cycles material to make a particle flare out when it dies in a collision with another particle using Blender 2.72a.
I've managed to get particles to attack and kill other particles using Boid physics, but getting the dead particles to do anything besides disappear or sit there is proving to be a prickly problem.
I'm spit-balling several approaches.  My current attempt is to drive emission strength and transparency based on how untimely a particles death is.  A particle that dies in a collision will have a velocity of zero and an age less than it's lifetime.  However, since dead particles report 0 for their age, you can't use that to determine if a particle just died unnaturally, or if it expired a hundred frames ago.
I can get around this if I can retrieve the current frame number for the scene and I've even got the code snippet:
bpy.data.scenes['CYCLES'].frame_current
I saved it as a script and referenced it in a Script Node that I was able to add to my particle seed, but I can't access the retrieved value. 
I was thinking of modifying the scriptlet to populate a global variable or attribute with the frame number and then access it with the Attribute node.  
So how can I store the current frame number in a way accessible to the material editor?
I've included a link to my blend file.  The correct answer doesn't have to implement my code.  If you've got an idea that has nothing to do with python, I still want to hear it.
One way is to animate it:


Add a value node (&#8679; ShiftA)
On the first frame set the value to the frame number (in this case 1) and press I while hovering over the input field.
Do the same for the last frame.
Change the keyframe interpolation to Linear (T) in the graph editor.






Ideally you could just type #frame into the value node, however it seems the value only updates when you toggle in and out of edit mode (or in some way cause the object to re-evaluate). It doesn't update automatically when rendering :/

Hopefully this will be fixed with the new depsgraph :)