Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
0 registered members (), 1,012 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Action crashes when event_type changes value #248181
01/25/09 02:46
01/25/09 02:46
Joined: Jan 2009
Posts: 4
A
Artisan_Horstman Offline OP
Guest
Artisan_Horstman  Offline OP
Guest
A

Joined: Jan 2009
Posts: 4
As soon as the c_move is executed, and event_type changes to one, I get error message E1514: crash in balla. Any help would be greatly appreciated.

related part of code:

action balla()
{
my.emask |= ENABLE_BLOCK;
my.event = bounce_event;
while (!key_space) {wait(1);}
while (event_type != EVENT_BLOCK)
{
c_move(my, vector(0, 4 * time_step, 0), nullvector, GLIDE);
wait(1);
}
}

Re: Action crashes when event_type changes value [Re: Artisan_Horstman] #248203
01/25/09 10:39
01/25/09 10:39
Joined: May 2008
Posts: 331
Lithuania, Vilnius
Jaxas Offline
Senior Member
Jaxas  Offline
Senior Member

Joined: May 2008
Posts: 331
Lithuania, Vilnius
I think you don't define your bounce_event, and more, you even try to look an example in manual (Lite-C). So take a look now:

Code:

// The following example shows how to use events for an object that flies ahead until it collides with a block or entity.
// The event function then plays a collision sound and lets the object ricochet from the surface. 

function bounce_event() 
{
  switch (event_type)
  {
    case EVENT_BLOCK:
      ent_playsound(my,whamm,50);   
      vec_to_angle(my.pan,bounce); // change direction
      return;
    case EVENT_ENTITY: 
      ent_playsound(my,boingg,50);  // play a different sound
      vec_to_angle(my.pan,bounce); // change direction
      return;
  }
}  

action bounceball() 
{
  my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); // make entity sensitive for block and entity collision
  my.event = bounce_event;
  while(1)
  {
    c_move(me,vector(5*time_step,0,0),nullvector,0); // move ahead until obstacle is hit
    wait(1);
  }
}


 


Analyse it, and you'll understand the structure of event. And remember, firstly search in manual, and then in forum wink

Jaxas


The smaller the bug, the harder it is to kill.
_________________________________________
Forklift DEMO (3dgs)
Re: Action crashes when event_type changes value [Re: Jaxas] #248288
01/25/09 20:04
01/25/09 20:04
Joined: Jan 2009
Posts: 4
A
Artisan_Horstman Offline OP
Guest
Artisan_Horstman  Offline OP
Guest
A

Joined: Jan 2009
Posts: 4
Already saw this, I always look through the manual. Bounce_event is in fact defined first. I even changed the condition of the while loop in my action to while(1), but the same problem persists. When event_type changes to one, balla crashes.

Re: Action crashes when event_type changes value [Re: Artisan_Horstman] #248322
01/26/09 02:05
01/26/09 02:05
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Try this..
Code:
action balla()
{
   my.emask |= ENABLE_BLOCK;
   my.event = bounce_event;
   while (!key_space) {wait(1);}
   while (event_type != EVENT_BLOCK)
   {
      c_move(my, vector(0, 4 * time_step, 0), nullvector, GLIDE);
      wait(1);
      if(my==NULL)   break;   //just in case entity is destroyed alsewhere
   } 
}



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1