via event_frame !
I've made a small example that shows how to use it ! you'll need the c# project to be a console project to view the output (when an event is triggered..) !
You won't need any models or stuff like that for the project to work, only the code !

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AcknexWrapper;

namespace eventExample
{
    class Program
    {
        private static IEnumerable<ScheduleMethod> testEntity2Method(IntPtr e)
        {
            ENTITY me =
                ENTITY.createFromPointer(e);
            Vector originalPos =
                new Vector(me.xyz);
            double originalYPos =
                me.y;

            // cube should be red
            me.LIGHT = true;
            me.red = 255;
            me.blue = 0;
            me.green = 0;
            me.lightrange = 0;

            // low push value
            me.push = 10;

            double timeValue = 0;
            double newYForce;
            
            while (true)
            {
                // increase by 1 every second and limit to 0...1.999
                timeValue += EngVar.time_step / 16;
                timeValue %= 2;

                if (timeValue > 1.5)
                {
                    // 1/4 of time, move away
                    newYForce = 2.5 * EngVar.time_step;
                }
                else
                {
                    // 3/4 of time move to cube -> to cause an impact !
                    newYForce = -2.5 * EngVar.time_step;
                }

                // c_move to new position to trigger impact event !
                me.c_move(
                    new Vector(0, newYForce, 0),
                    new Vector(0, 0, 0),
                    Flags.GLIDE);

                yield return 1;
            }
        }

        private static IEnumerable<ScheduleMethod> testEntityMethodEvent()
        {
            if (EngVar.event_type == Flags.EVENT_CLICK)
            {
                Console.WriteLine("Flags.EVENT_CLICK");
            }
            if (EngVar.event_type == Flags.EVENT_IMPACT)
            {
                Console.WriteLine("Flags.EVENT_IMPACT");
            }
            if (EngVar.event_type == Flags.EVENT_FRAME)
            {
                Console.WriteLine("Flags.EVENT_FRAME");
            }

            // there's nothing to wait for...
            yield break;
        }

        private static IEnumerable<ScheduleMethod> testEntityMethod(IntPtr e)
        {
            ENTITY me =
                ENTITY.createFromPointer(e);

            // cube should be blue
            me.LIGHT = true;
            me.red = 0;
            me.blue = 255;
            me.green = 0;
            me.lightrange = 0;

            // enable some events...
            me.ENABLE_FRAME = true;
            me.ENABLE_IMPACT = true;
            me.ENABLE_CLICK = true;

            // high push value
            me.push = 1000;

            me.event_ = testEntityMethodEvent;

            // nothing to wait for here...
            yield break;
        }
 
        //the main method, called by the scheduler
        private static IEnumerable<ScheduleMethod> myMainMethod()
        {
            // limit frame rate
            EngVar.fps_max = 60;

            // load an empty level
            EngFun.level_load(null);

            // use mouse
            EngVar.mouse_mode = 4;

            ENTITY testEntity =
                ENTITY.ent_create("_CUBE.MDL", new Vector(200, -25, 0), testEntityMethod);

            ENTITY testEntity2 =
                ENTITY.ent_create("_CUBE.MDL", new Vector(200, 25, 0), testEntity2Method);
 
            yield return ScheduleMethod.wait(1);
        }

        static void Main(string[] args)
        {
            //open the engine
            EngFun.engine_open(null, null);

            //start the scheduler
            Scheduler.StartScheduler(myMainMethod);
        }
    }
}



Last edited by Stromausfall; 02/16/12 16:48.

get the C# wrapper:
for A7.85.4 and A8.30.4, Version 2.3.9
at http://acknexwrapper2.matthias-auer.net/ or visit the thread