Jump to content

Events without source


Spajk

Recommended Posts

Posted

Quite simple question, as source is an required argument, what should I do when a certain event is not tied/related to any element?

Posted

If the event isn't supposed to trigger for anyone in particular (such as an automated server maintenance event) you could just use a dummy element for it.

triggerEvent("eventHere", createElement("dummy")) 

Posted

I think he means the built in events

i give you an example

  
addEventHandler("onPlayerConnect",root,function() 
createExplosion (0, 0,4 ,10) 
end 
) 
  

now the source isnt used, i just create an explosion when a player connects

its maybe not the best example, but is this something you meant?

Posted

@BieHDC I didnt mean on the built in events :D

@J.S. Just what I was asking, thanks.

EDIT: Would it be ok to destroy the dummy element after the event has been triggered?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...