PDA

View Full Version : endon, notify



maxdamage99
3rd September 2015, 14:00
What do the function?
self/level endon("");
self/level notify("");
self/level waittill("");
ps:ty

Ni3ls
3rd September 2015, 15:02
Notify means it gives a warning that something happened.
Endon means that it will stop the function if that thing happened
Waittill means that the function wait till that thing happened.

Correct me if im wrong

Tally
3rd September 2015, 15:58
Notify means it gives a warning that something happened.
Endon means that it will stop the function if that thing happened
Waittill means that the function wait till that thing happened.

Correct me if im wrong

You are only wrong in that there isn't a warning, as such. That is the wrong word to use. But other than that, you are correct: notify(), waittill(), and endon() are all linked together: a waittill() is a wait function. But instead of a stated time, it waits indefinitely for a notification. Hence:


self waittill( "time_to_end" );


self notify( "time_to_end" );

Go together - a thread will not proceed past the waittill( "time_to_end" ). It sits there waiting for the notification - notify( "time_to_end" ). If it doesn't get the notification, it will wait indefinitely.

As to endon(), you will see things like endon( "disconnect" ) at the top of a loop function, which only ends when the player leaves. And if you look at the callback_playerDisconnect() function, you will see:


self notify( "disconnect" );

This signals all the threads which are waiting for the player to disconnect to end. So, the purpose of endon() is to Kill the thread or function.