custom ON event
Moderator: Forum Moderators
Forum rules
Before posting a new idea, you must read the following:
Before posting a new idea, you must read the following:
custom ON event
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:
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)
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]
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)
Re: custom ON event
You can implement this as metatable.