project-navigation
Personal tools

Author Topic: UI Adjustments.  (Read 34794 times)

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: UI Adjustments.
« Reply #60 on: November 03, 2010, 10:59:18 am »
Yes, I know not everything is available. But the UI system is always changing and I find it's best not to make assumptions about what is and is not possible.

@bayo: I can use the existing checkbox for the crouching I think, but I'd like to handle the reservation of tu for firing (none/single/multi shot) differently. Would it be a lot of work to handle this as I suggested in this feature request, or would it be better if I worked up an example to show you what I want to do?

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #61 on: November 03, 2010, 11:19:06 am »
BTW if you use custombutton or radiobutton on your local scripts please check http://ufoai.ninex.info/wiki/index.php?title=UI_node_behaviours/2.4-dev&curid=6254&diff=35338&oldid=35334 and use "background" instead of "image" and "texl". I will soon remove this old way to define a background, cause it is to hard to manage, it create useless constaints, and it is not flexible.

Here an example for radiobutton http://ufoai.git.sourceforge.net/git/gitweb.cgi?p=ufoai/ufoai;a=commitdiff;h=a08255e047ef41f956ee7020b7c96206a2f1ca50
I extract all current button background to base/pics/buttons.

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: UI Adjustments.
« Reply #62 on: November 03, 2010, 11:37:44 am »
Here is an image showing what I want to accomplish with the reaction fire reservation buttons.

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #63 on: November 03, 2010, 12:40:55 pm »
then you are looking at the wrong functions, a.hud already does this, here what you need:
Code: [Select]
confunc startreactionmany { }
confunc startreactionmany_impos { }
confunc startreactiononce { }
confunc startreactiononce_impos { }
confunc deselect_reaction { }
confunc disable_reaction { }
just make it a radio button and flip states, its easy.

p.s. great looking graphics, "pixel hack" my ass,  compared to me you are a grand master ;D
« Last Edit: November 03, 2010, 12:45:09 pm by mor2 »

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #64 on: November 03, 2010, 06:03:30 pm »
i still dont understand the difference between the syntax *cvar:i and <cvar:i> the first is a reference the second is its value
or is < > used to inject data into a string for example  "actor_select <cvar:i>;" mayne something instead the old "actor_select" + string(<cvar:i>) +";"

and what does "*cvar:i"  or is it "<cvar:i>" means, that you ask to do, pass the info as a string  ???


also when i pass it as parameter, if use:
call *node.root.whatever (*cvar:i)

func whatever{
*node.root.radiobutton@cvar = <1>  its ok because i assign the reference as needed but then how do i pass it value in onClicK?
*node.root.radiobutton@onClick = { cmd "actor_select <1>;" } this doesnt work.

should i call it like this  ???
*node.root.radiobutton@onClick = { cmd "actor_select <<1>>;" }


also can i use  call *node.parent.parent.function  or *node.parent@parent.function  or something like it?

Offline dodon

  • Rookie
  • ***
  • Posts: 48
    • View Profile
Re: UI Adjustments.
« Reply #65 on: November 03, 2010, 07:13:29 pm »
Here is an image showing what I want to accomplish with the reaction fire reservation buttons.

At the moment the "Multiple shots" button does nothing extra. I think it is a relict from the time, when the TU for RF was taken from the next turn. (And it should be removed.)

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #66 on: November 03, 2010, 07:57:29 pm »
Quote
i still dont understand the difference between the syntax *cvar:i and <cvar:i> the first is a reference the second is its value
or is < > used to inject data into a string for example  "actor_select <cvar:i>;" mayne something instead the old "actor_select" + string(<cvar:i>) +";"
You must first understand the current script is the result of many small patches according to needs and the way it is easy to implement. Anyway <foo> mean you replace something in a string. It is an easy way to do it. There is no real way atm to concatenate string with operator.

Quote
and what does "*cvar:i"  or is it "<cvar:i>" means, that you ask to do, pass the info as a string 
Then "*cvar:i" isastring containing *cvar:i, and "<cvar:i>" is a string where the injection syntax is replaced by the value of the cvar. The injection value is substituted at runtime.

Quote
also when i pass it as parameter, if use:
call *node.root.whatever (*cvar:i)

func whatever{
*node.root.radiobutton@cvar = <1>  its ok because i assign the reference as needed but then how do i pass it value in onClicK?
*node.root.radiobutton@onClick = { cmd "actor_select <1>;" } this doesnt work.
There is no references, the reference is the name of the cvar. You should use *node.root.whatever ( "*cvar:i" ). If it dont work, i must fix the C code. I will add a test to check it. But well, the <1> on the onClick function will be wrong, cause <1> is substituted at runtime. But u may use:
Code: [Select]
*node.root.radiobutton@onClick = { cmd "actor_select <cvar>;" }Which should substitute the syntax with the value of the cvar property, which should be the value of the cvar. BTW, there is no "dynamic" nasted/inner function, the nasted function is compiled at parsing time (you can't use status of the parent function to the nasted function).

Quote
also can i use  call *node.parent.parent.function  or *node.parent@parent.function  or something like it?
"@" is to access to properties, "." is to access nodes, then *node.parent.parent@function, if the function is an event property, *node.parent.parent.function ifthefunction is a func/confunc node.

Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #67 on: November 03, 2010, 08:47:07 pm »
Code: [Select]
*node.root.radiobutton@onClick = { cmd "actor_select <cvar>;" }Which should substitute the syntax with the value of the cvar property, which should be the value of the cvar. BTW, there is no "dynamic" nasted/inner function, the nasted function is compiled at parsing time (you can't use status of the parent function to the nasted function).
not sure i understand this part.

and can i use your example from few post back?
Code: [Select]
*cvar:temp = <1>
*node.root.radiobutton@onClick = { cmd "actor_select <cvar:temp>;" }
delete *cvar:temp


Quote
"@" is to access to properties, "." is to access nodes, then *node.parent.parent@function, if the function is an event property, *node.parent.parent.function ifthefunction is a func/confunc node.
obviously, i just wasnt sure if i can use call *node.parent.parent.function (got an error that it couldnt be located), so i made a guess that a node has a parent property, which makes *node.parent@parent valid and so maybe i can use its value, maybe i should have written it like that (*node.parent@parent).function    anyway NM, i'll just double check it.

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: UI Adjustments.
« Reply #68 on: November 03, 2010, 09:11:05 pm »
Quote
not sure i understand this part.
I hope it help.
http://ufoai.git.sourceforge.net/git/gitweb.cgi?p=ufoai/ufoai;a=commitdiff;h=7984e7ee76b71d2e29bffe348608ea83bc367980
It is a unittest. <cvar> is the value of the property @cvar from the radiobutton. And you can see it is 306.

Note here we can call
Code: [Select]
*node:root.radioTest@cvar = "*cvar:test6"after
Code: [Select]
*node:root.radioTest@onClick = { ...But both must be set before the last call (cause <cvar> it is replaced at the runtime)

Code: [Select]
*cvar:temp = <1>
*node.root.radiobutton@onClick = { cmd "actor_select <cvar:temp>;" }
delete *cvar:temp
It mean nothing. You never execute onClick, and <cvar:temp> is only replaced at the runtime of the nested function. Then, when onClick is executed, the cvar temp do no exists.

Quote
obviously, i just wasnt sure if i can use call...
Well, with a full example i can say something, but here, i really dont understand.
« Last Edit: November 03, 2010, 09:35:27 pm by bayo »

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: UI Adjustments.
« Reply #69 on: November 04, 2010, 12:57:51 pm »
At the moment the "Multiple shots" button does nothing extra. I think it is a relict from the time, when the TU for RF was taken from the next turn. (And it should be removed.)

i don't the chance yet to verify this statement, are you really sure about this? there is rf-multiple and rf-single stuff in the game lib code the last time i looked at it.

Offline dodon

  • Rookie
  • ***
  • Posts: 48
    • View Profile
Re: UI Adjustments.
« Reply #70 on: November 04, 2010, 04:02:35 pm »
i don't the chance yet to verify this statement, are you really sure about this? there is rf-multiple and rf-single stuff in the game lib code the last time i looked at it.

Yes STATE_REACTION_ONCE and STATE_REACTION_MANY are still in use (just checked that with a month old copy of the master branch)

But most of the time the code handles the existing UI. (e_event_actorstatechange.c, cl_hud.c and cl_hud_callbacks.c).
In g_ai.c, g_ai_lua.c and g_morale.c the state is only set.
g_client.c handles the "Request to turn on multi- or single-reaction fire mode." and uses the same code for both states.

g_reaction.c only checks if one of the states is set and handles both the same way.

So I am quite shure: at the moment STATE_REACTION_ONCE and STATE_REACTION_MANY work the same way.



Offline mor2

  • Squad Leader
  • ****
  • Posts: 145
    • View Profile
Re: UI Adjustments.
« Reply #71 on: November 04, 2010, 10:18:23 pm »
pffft, how many big boys in this little newby thread  ;D

btw speaking of which any chance for that ammo container/node/whatever, so we can show which ammo the weapon is loaded with in the hud similar to the base container (i would have created an entry on source forge but it has declared a crusade against my laptop  :-\ )

so big please

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: UI Adjustments.
« Reply #72 on: November 05, 2010, 12:01:20 am »
Regarding the single/multi-shot reaction fire. What is the benefit of having both? As I understand it, in the past reaction fire would have taken some of the next turn's TU, so I can see the benefit of it. But I believe that doesn't happen now, so I guess choosing single would only preserve ammo.

Is that necessary or just an added complication? Would anyone really use single-shot?

Offline Kildor

  • Project Artist
  • Captain
  • ***
  • Posts: 757
  • Project mapper and some other stuff`er
    • View Profile
    • http://ufoai.nx0.ru
Re: UI Adjustments.
« Reply #73 on: November 05, 2010, 04:20:46 am »
When I`ve played last time, there was at least one difference. RF-single reserved TU for single shot, and RF-multi reserved as much TU as possible. That`s all.

Offline H-Hour

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 1923
    • View Profile
Re: UI Adjustments.
« Reply #74 on: November 05, 2010, 09:32:59 am »
When I`ve played last time, there was at least one difference. RF-single reserved TU for single shot, and RF-multi reserved as much TU as possible. That`s all.

That makes sense and sounds like a good enough reason to keep it.