Thread: Plugin class
View Single Post
  #13  
Old 04-15-2007, 02:35 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Quote:
Originally Posted by Inverness View Post
Oh I think I did something like this before. I made an EventServer class and objects could use ObjectWithClass.register(Object); and when someone used triggerEvent() it would trigger the event on all objects registered.
Yea... But it's slightly different.

You see, the 'event' sends the current value. It then takes the value it returns.

So lets say you want to calculate the level's brightness...

brightness = plugin::getPlugin("brightness", 1 );

The plugin will go and check if any other NPCs plug in... Let's say it is in a house, and our house controller plugged in... The house controller could do return brightness - 0.6; ( thus 1 - 0.6)... Now -- If there are lamps and they plugged in too... return brightness + 0.1; ... If there are three lamps, the total brightness would be 1 - 0.6 + 0.1 + 0.1 + 0.1... Or 0.9.

Using this, you could calculate things, not merely send an event. But, obviously enough, if the value isn't important, it acts as an event.

Quote:
Originally Posted by Gambet
... you to grow so defensive ...
Gambet... You always go around doing unsupported arguments when you truly don't understand. You have been excessively offensive lately on the forums. It is of my nature to be defensive when someone offensive comes.
Reply With Quote