Problem with events

Posted By: Roel

Problem with events - 04/07/10 20:03

Hey guys,

I have a little problem with events.
I assigned an action to an entity, with an EVENT_IMPACT emask,
but it seems that the event is not triggered at all, nothing happens
after searching the manual, I got the Idea that my code should work... Maybe some one else can spot the mistake
here is the code:

Click to reveal..

function event_collect()
{
my.z+=100;
}
action target_collect()
{
my.emask |= (EVENT_IMPACT);
my.event = event_collect;
}



the idea is to check if the event is triggered, which can be seen because the entity... jumps


it might be that I forgot something else, maybe some things work different in A7?
It looks like a beginners question to me, but I would really appreciate your help

Thanks in advance
Posted By: Widi

Re: Problem with events - 04/07/10 20:36

The code should work, have you add this action to the entity?
Try to make a sys_exit() in the action and if the Engine shut down you know the action works. Then make the same in the event_collect...
Posted By: Roel

Re: Problem with events - 04/07/10 20:43

I have already tried the sys_exit, but nothing
the action is added, I checked it with shift-f11

but thank you for your answer
Posted By: Widi

Re: Problem with events - 04/07/10 20:46

what nothing? The Engine don`t shut down or what?
Posted By: Aku_Aku

Re: Problem with events - 04/07/10 21:28

Perhaps the reorganizing of your code would help, like this:
Code:
function event_collect()
{
my.z+=100;
}
action target_collect()
{
if(event_type == EVENT_IMPACT) event_collect();
}

myent=ent_create(file_of_ent,vector_of_ent,target_collect);
myent.emask |= (EVENT_IMPACT);
myent.event = event_collect;


Posted By: Roel

Re: Problem with events - 04/08/10 10:48

I got it:

In my code emask was set to EVENT_IMPACT, but it must have been ENABLE_IMPACT laugh

Quote:
what nothing? The Engine don`t shut down or what?

sorry, I meant that the engine did not shut down.
what ever I tried to put in the event, nothing happens


Posted By: Nidhogg

Re: Problem with events - 04/08/10 15:40

Originally Posted By: Roel
I got it:

In my code emask was set to EVENT_IMPACT, but it must have been ENABLE_IMPACT laugh


WOW, How could of we missed that mistake. Sorry Roel.
© 2024 lite-C Forums