UFO: Alien Invasion Issue Tracker
UFO: Alien Invasion
Go to the previous open issue
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
icon_project.png UFO: Alien Invasion / Closed Feature request #4049 onCvarChange ui listener
action_vote_minus_faded.png
0
Votes
action_vote_plus_faded.png
Go to the next issue (open or closed)
Go to the next open issue
This issue has been closed with status "Closed" and resolution "Not determined".
Issue basics
  • Type of issue
    Feature request
  • Category
    User interface
  • Targetted for
    Not determined
  • Status
    Closed
  • Priority
    3. Normal
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (0)
There are no items
People involved
Times and dates
  • Posted at
  • Last updated
Issue details
  • Complexity
    Not determined
Attachments (0)
There is nothing attached to this issue
Duplicate issues (0)
This issue does not have any duplicates
Description
[http://sourceforge.net/p/ufoai/feature-requests/565 Item 565] imported from sourceforge.net tracker on 2013-01-28 20:22:06

it would be cool to have a ui listener like this

onCvarChange cl_selected {
[...]
}

so that whenever a cvar changed this ui action is called. i don't wanna hardcode this in the c code - would be a lot cooler to have this in the ui scripts.

the push should register a cvar change listener (already supported in teh cvar subsystem) and a pop should unregister it

another option would be to do this in func init/close with a new console command
* cvaraddlistener cl_selected confuncname
* cvarremovelistener cl_selected confuncname

do you have any opinions here bayo?
===== Comments Ported from Sourceforge =====

====== bayo-fr (2011-10-06 16:52:40) ======

yes, it is a very interesting thing.
I think you do most of the thing with the cvar listener, but imo it also need to add a userdata to this listeners.

The only problem is when we create a cvar or when we delete a cvar.

Use case 1
* create a cvar foo
* bind ui to the cvar foo
* delete the cvar foo
(here, imo there is not so much problems, at least we should have a deleteListener to help debuging of script, else the node can't know there is no more listeners)

Use case 2
* bind ui to the cvar foo
* create the cvar foo
(here it is quite hard to do it working. At worst we can say it can't work, and we can display a warning, or thing about a globalListener to callback a ui function when a new cvar is created)

What you think about?
* add a delete listener (or extend the default cvar listener with this event)
* add a global cvar creation listener

BTW i will lost my internet connection in few hours, not sure when i can work on it.
====== tlh2000 (2011-10-06 17:11:08) ======

i'm not sure we need them (add-/delete listeners) but it would be cool to have them.

i'm more interested in the cvars that are not created in the ui scripts - because we can handle these cases already in the ui scripts. i'm more interested in the cvars that we are just using (but not changing) in the ui.

e.g.: in my particular case i would just like to be able to close a window if i select another actor.
====== bayo-fr (2011-10-06 17:20:37) ======

Yes, i understand you right. My use cases are global, the "create cvar" or "delete cvar" can occurs at anytime by any process, not especially from the ui script.
====== geever (2011-12-31 12:47:46) ======

It was implemented recently by you, mattn, the way UI listeners work.

-geever
Todos (0 / 0)
Issue created
footer_logo.png The Bug Genie 4.3.1 | Support | Feedback spinning_16.gif