General > User modifications

Lazy battlescape HUD

<< < (2/7) > >>

H-Hour:
If you haven't, you should also read about the UI scripts in our wiki. Especially the 2.4 dev node behaviours.

A confunc is just like a function you can create and then call as you like. For instance, you can have the following node, which, when clicked on, calls the confunc. When the confunc is called, it hides the node:


--- Code: ---nodetype mynodename
{
invis false
onClick { cmd "my_confunc_name;" }
}

confunc my_confunc_name
{
*node:parent.mynodename@invis = true
}
--- End code ---

The commands you are asking about are special confunc's that are called from within the game. Disable_crouch is called when the selected soldier does not have enough TUs to crouch or for whatever reason is unable to crouch. You should write a confunc into your HUD with the name "disable_crouch" and it should effect your crouch button in a way that makes it clear to the player he can not crouch.

If you search for "disable_crouch" in the existing UI files, you will find several similar confuncs that are called from within the game. (disable_stand, disable_reaction, disable_headgear, deselect_*, startreactiononce, startreactionmany).

homunculus:
Yeah, I'll try to take 'add_hud_name' out of 'onScriptLoaded' and see what happens, to find out if add_hud_name is really a callback or not : )

I guess I should warn people not to take me very personally, some people think I am weird for nitpicking on things like that, and some people even seem to hate me a bit.
Hopefully the result is a HUD, and hopefully the script is as much according to spec as possible, nothing personal about it : )
And hopefully this "horror" will be over soon enough : )

For example, in abstractnode there is such thing as
textalign    V_UI_ALIGN    Alignement of the text into the node, or elements into blocks.
but when I used it, it crashed the game (maybe I would need a layout manager for that, but there is nothing mentioned about it).
So I guess scripting according to spec is not possible to full extent anyway (btw should I report such thing somewhere?).

And the minds of the scripters seem to have worked in the most crazy ways in the past (nothing special about me here), like in hud.ufo
window hud extends levelbuttons {
which should read as 'hud is a levelbuttons', quite an amusing exercise in imagination, I would say.

The question about cmd parameters remains atm, but it looks like it might not be a great obstacle, as I might be able to find examples with the parameters of all the commands that I need in the .ufo files.

MCR:
The wiki maybe outdated sometimes...

The best way to learn is to analyze the ufo scripts and the C UI code.

I have integrated some of your ideas into the MiniHUD, so you can look at that file also...

I told you it is more work than one would initially think it is ;)

Do not give up  8)

homunculus:
There might be some ugly things that I am thinking of doing.

1) There is the container that shows the weapon, I can't seem to be able to find out how to detect that the contents of the container has changed.
But there are confuncs like reserve_shot_clear, deselect_reaction, deselect_primaryright, probably more, that get called at every click the user makes, and the 'ugly thing' would be to use those to check if contents of the container has changed.
Well, unless someone has some other idea.

2) I don't know how ugly this one is, but thinking of using 'onSelect' to make the container behave as button for shooting.
Because the container seems to consume the LMB otherwise.
Could try to use RMB for shooting, though, and maybe then reloading would be dragging ammo to weapon.
But LMB for shooting would be nice, even if it duplicates the RMB shooting.

3) There is such thing as scrollbar, and it would be nice to use scrollbar for scrollables, like level and firemode.
Scrollbar on a panel that can show one item at a time should do the trick.
But there is limited space and I would sort of like to indicate the scrollbar position as a combination of two bars in the whole background area of the selection box, which is nonstandard (and therefore, ugly solution imho, matter of taste).
It would be one bar with dark foreground and light background in forward direction, and another bar with dark foreground and transparent background in the opposite direction on top of it, so that the "scrollbar" would appear as a light bar in the center.
Like this:
|-------bar-1------->|---bar-1-background---|<-------bar-2-------|

MCR:
1) The content of the container is the weapon, so it should be quite easy to check if the weapon changes...  ::)

2) The problem here is that you are able to drag the weapon from the container, so that is why the left mousebutton is already checked and ignored. You could create an invisible empty panel on top of the weapon, which would allow you to assign the LMB again, but you would lose the drag functionality then, which you wanna use also...

3) I'm sorry, I do not get what exactly you wanna do here  :-\

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version