Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,499 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Event parameter #296905
11/03/09 19:59
11/03/09 19:59
Joined: Jul 2008
Posts: 170
Germany, near Mainz
Nicotin Offline OP
Member
Nicotin  Offline OP
Member

Joined: Jul 2008
Posts: 170
Germany, near Mainz
Hey,

I have a little (or maybe not so little) problem.
I've got a event that creates an entity, now I want this entity to be saved (best in the main-entity-function) and able to be reemoved by the event later on again.


Ok, also ich habe ein Event(von ent1) in dem ein Entity(ent2) erstellt wird. Nun will ich das eben dieses Entity(ent2) (am besten in der hauptfunktion der Entity[ent1]) gespeichert wird damit sie später wieder vom event(der ent1) gelöscht werden kann. Ich habe es ja mit einem parameter versucht aber wie ich mir dachte geht das nicht bei events.
Hier ein Beispiel wie ungefähr ich es anpacken wollte:

I already tryed this one without success:
Code:
function ent_event(ENTITY* objekt)
{
  if(event_type == EVENT_SHOOT)
  {
    objekt = ent_create(...);
  }
  if(event_type == EVENT_CLICK)
  {
    ent_remove(objekt);
  }
}
function ent_action()
{
 ENTITY* objekt
 my.event = ent_event(objekt);
 [...]
}



So, anyone got other solutions?

Also, hat jemand eine Idee oder einen Vorschlag?
ich weiß nicht ob die Lösung so einfach ist das ich sie einfach nicht sehe oder ob es echt schwerer ist als ich dachte



Re: Event parameter [Re: Nicotin] #296917
11/03/09 20:23
11/03/09 20:23
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Is this lite-c or c-script?

Anyway, as long as you are NOT using the 3DGS templates, this (untested) should work...
Code:
function ent_event()
{
   if(event_type == EVENT_SHOOT)
   {
      my.parent = ent_create(...);
   }
   if(event_type == EVENT_CLICK)
   {
      ent_remove(my.parent);
   }
}

function ent_action()
{
   my.event = ent_event;
   [...]
}



Because the entity structure has an entity pointer built-in that is only used by
the c-script templates, dunno about the lite-c templates though.
This pointer is called ENTITY.parent

Hope this helps.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Event parameter [Re: EvilSOB] #296920
11/03/09 20:32
11/03/09 20:32
Joined: Jul 2008
Posts: 170
Germany, near Mainz
Nicotin Offline OP
Member
Nicotin  Offline OP
Member

Joined: Jul 2008
Posts: 170
Germany, near Mainz
I'm using Lite-C without templates.

But thank you very much, it works. Once again you saved me laugh



Re: Event parameter [Re: Nicotin] #296925
11/03/09 20:36
11/03/09 20:36
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Thats what Im here for....


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

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