custom ON event

Brainstorm ideas of possible additions to the game. Read this before posting!

Moderator: Forum Moderators

Forum rules
Before posting a new idea, you must read the following:
Post Reply
enclave
Posts: 936
Joined: December 15th, 2007, 8:52 am

custom ON event

Post by enclave »

Hi,

Could there be a custom on event creator for something?

For example, I have array or variable with some name "player[1].gold" and ON modification of that array or variable the custom event would fire...
for example:

Code: Select all

[custom_on_event]
variable=player[1..9].gold
event=custom_event1
[/custom_on_event]

[event]
name=custom_event1
[modify_side]
		side=$side_number
		gold=$player[$side_number].gold
[/modify_side]
[/event]
This could save some coding necessity in some cases... I'm sure there could be more uses for that than my example.. not sure what though :)
I guess it would be slow as well...

PS. the potential application I could see would be to make multiple addons compatible with each other..
where eg. one of addons uses some macro or event to modify some array or side gold.. and the other addon would be able to react on that, providing it's own code as addition to that..

PPS. I guess what I offered is already doable.. if I put a code into wesnoth.theme_items that would check some array for changes... and on seing a change, fire some event... never thought of it before... but such hack is not very coder friendly (not for a basic WML content maker for sure)
User avatar
Ravana
Forum Moderator
Posts: 2949
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: custom ON event

Post by Ravana »

You can implement this as metatable.
Post Reply