project-navigation
Personal tools

Author Topic: UI Adjustments.  (Read 34814 times)

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #45 on: October 31, 2010, 10:37:52 pm »
that perfect! and the example on line 66 is exactly what i needed, i assume its ( "name", "node type")
btw i think you already linked me to this git site, but i just didnt noticed this example and had to suffer foolishly reinventing the wheel  :-\


anyway thnaks, i'll try implementing some of the stuff on my next shift.

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #46 on: November 01, 2010, 09:21:20 pm »
ok worked like a charm, i got 60 lines instead of 350 lines  ;D  if only i could do the same with reset ...

few questions:
1. according to this the val indicates which button is selected.
but the example suggest that it also allow to set it (onInit)

if so, what happens when its selected? the icons updated on all the radio buttons?
and if i dont use those icons and want to set my own sequence, can i use onchange function?

for example if @cvar:radio1 ==2 and i set it to @cvar:radio1=1
will it trigger onchange on both 1,2 buttons so i can draw change their state?

2. huddisable called when soldier die?

thanks.

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #47 on: November 01, 2010, 11:10:45 pm »
1) onChange is only call when the user do an action on the radiobutton. If you change the cvar with"hands" it will not call any callback events, but radiobuttons will look like right.

Quote
if i dont use those icons and want to set my own sequence
I dont really understand what you mean.

2) yes, i think

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #48 on: November 01, 2010, 11:51:45 pm »
i want to change the bar_teambox's, to show which one selected, so i need to change the previous selected and the currently selected one.

manually, i can:
call *node:wahtever:select <cvar:radio1>  false
*cvar:radio1  = 2
call *node:wahtever:select <cvar:radio1>  true

question is what does the user action prompts, onChange only on the newly selected button or on the old one as well?
if only on the new one, i have a problem because i need to unselecte the old one and i dont know which one it is...

i can use something like the bar_selbox or another cvar but i dont want to before i checked this out.



2. how can i check if <1> argument was received?
« Last Edit: November 02, 2010, 12:53:29 am by mor2 »

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #49 on: November 02, 2010, 09:29:39 am »
onChange is only send to the clicked node.

You should check althud code, maybe it use something like that.

2) you only can check internal function with a debuger, there is no trace. If you talk about a script function you can use thing like cmd "echo --> <1>". If you want to support random param number, you can use paramcount (there is no documentation, but u can check unittest/ufos/uitest/test_action2.ufo)

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #50 on: November 02, 2010, 12:14:09 pm »
it has, it uses the bar_selbox i am trying something different.
and if (paramcount == 0)  sound wonderful  ;)

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #51 on: November 02, 2010, 07:09:12 pm »
i seem to bump into somethin i cannot solve, the game keep quite on me with the error
Code: [Select]
Com_AlignPtr: can't align V_NULL
i found that excluding the two lines 94,95 allows me to load the game but then my radiobuttons dont work.
Code: [Select]
*node:parent.tab<cvar:i>.bt_soldier@value = (*cvar:i)
*node:parent.tab<cvar:i>.bt_soldier@cvar = *cvar:selected_soldier

i dont know if its a syntax problem (tried quite few combination on the value) or something else, i attached the script (just extract it into %appdata%/base/) if someone can look into it i'll appreciate it, thanks.

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #52 on: November 02, 2010, 07:44:49 pm »
I fix it in the master, but please, quote the cvar value you want to set:
Code: [Select]
*node:parent.tab<cvar:i>.bt_soldier@cvar = "*cvar:selected_soldier"

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #53 on: November 02, 2010, 07:53:50 pm »
BTW you should use a component. At least you can fix const values without any setters, and this cvar name too.

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #54 on: November 02, 2010, 08:09:37 pm »
I fix it in the master, but please, quote the cvar value you want to set:
Code: [Select]
*node:parent.tab<cvar:i>.bt_soldier@cvar = "*cvar:selected_soldier"

are you sure that is it, i just replaced my:
*node:parent.tab<cvar:i>.bt_soldier@cvar = *cvar:selected_soldier
with
*node:parent.tab<cvar:i>.bt_soldier@cvar = "*cvar:selected_soldier"
 and got the same error  ???

besides if you look at hud, this exactly how they use it without the " "   :(


and what is a component?

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #55 on: November 02, 2010, 10:24:23 pm »
You also need to update the code, and compile it, cause i fix the source code... or wait the nightly build, if it work.

unittest_nodeallocation.ufo use a component and create it dynamicaly.

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #56 on: November 02, 2010, 11:58:55 pm »
nice, i can sure save a lot of space on redundant config and make it more easily adjustable and readable.

as for the updated code, will this do or should i still wait for another day for more updated binaries?

btw, about onInit, i assume that it supposed to be called automatically upon creation but in that script unless i called it directly it never did  :-\
« Last Edit: November 03, 2010, 12:03:22 am by mor2 »

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: UI Adjustments.
« Reply #57 on: November 03, 2010, 09:45:25 am »
I can't seem to figure something out by looking at the code and I'm hoping you can help me.

With the default hud, if I select the checkbox for crouch reservation and then change to another soldier, the checkbox updates to the new soldier's status (checked or not).

I can't seem to figure out how that's done. There are no cvars that I can find to check the status and update it. I've found the three confunc's that seem to do this in _hud.ufo:

Code: [Select]
confunc crouch_checkbox_disable { }
confunc crouch_checkbox_clear { }
confunc crouch_checkbox_check { }

These are overridden in hud.ufo with the following:

Code: [Select]
confunc crouch_checkbox_disable {
*node:root.left.bt_crouch_reservation@disabled = true
}
confunc crouch_checkbox_clear {
*node:root.left.bt_crouch_reservation@disabled = false
*node:root.left.bt_crouch_reservation@current = 0
}
confunc crouch_checkbox_check {
*node:root.left.bt_crouch_reservation@disabled = false
*node:root.left.bt_crouch_reservation@current = 1
}

But none of those seem to "know" the current status, and I can't find any nodes that actually call the confuncs. What am I missing?

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #58 on: November 03, 2010, 10:38:16 am »
that because of what i told you before, its only a script they didnt exported all the function to us, only those that were needed, for example didnt you wonder how actor_select X works?

in this case its simple they have listeners, so in the event of change to specific params they are monitor an update functions are called. in this case the function called  HUD_RefreshButtons, which receives the current actor "information" (its located in cl_hud) and its calls the appropriate functions you know.

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #59 on: November 03, 2010, 10:53:48 am »
it is one of ways to create abstraction between the ui scripts and the client code. If the protocole is well done, we can display information as we want and the client code dont care about the look and feel.