Yeah, there is actually a little known function called init that you can use that is called once when the level loads and the entity is created. So, in addition to the main function, you can have the init function and use that to store your entity id in some global place.
function scriptname_init(e)
-- put initialization code here
-- since we have the entity id passed in, we can store it somewhere globally
-- so that it can be accessed elsewhere as needed with g_Entity[e]
end
I was planning to use this myself for creating special features for a group of entities of a certain type. I won't say how exactly since that would be spoilers for my contest entry.
System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.007