Create the images for this menu (in base/pics)
Create the script files for this menu (in base/ufos/ui)
I have a couple questions for Bayo to start:
1) We can do horizontal bars for health/etc, but is it possible to do vertical bars as well?
2) Is it possible to insert a button onto the edge of a container, as the attached image shows, and would this break with the existing UI style too much?
3) Is it possible to have a box that collapses when not in use? I'm thinking of the left-hand weapon. If there is no weapon, can you change the size of the box or is this not changable based on such parameters?
pos "130 21"
size "298 6"
onMouseClick( *floor.bt1@disabled = false
*floor.bt2@disabled = true
1. i dont think so unless there is some hidden property for vertical or there is bar2 class? ( but i assume its really easy to add)Bar has a direction property:Code: [Select]pos "130 21"
size "298 6"
direction V_UI_ALIGN Orientation of the bar. Default value "cr". Other available values are "uc", "lc", "cr", "cl"
a. is there a more technical documentation of the properties, for exmaple excluderect? ghost? mousefx? etcUI node behaviours (http://ufoai.ninex.info/wiki/index.php/UI_node_behaviours)
EDIT: and last, i tired and going to sleep but a quick thought, all of the controls defined by position size, which makes a squre but we have none square controls, so the capture are determined by the image? so no invisible buttons?Node has an invis property. Maybe this could help?
invis V_BOOL If true, the node is not displayed nor or activatable.
...and so can you access a node from another node callback event, i didnt see any variable declaration but i assume that any node can call any other node? or its something todo with confunc?
so can i do this:
onMouseClick( *nodename.invis = true
* We can access any nodeswhat i meant is that it looked like if i go high enough, i'll find that every node constructor creates a global variable with the same name holding a pointer to it, which is why i can basically access everything...
*node:pathofthenode@invis = true
what i meant is that it looked like if i go high enough, i'll find that every node constructor creates a global variable with the same name holding a pointer to it, which is why i can basically access everything...I am not sure i understand the image. Each nodes have an unique identifier called "path" (constructed with names of all parents), and we can use this path to access to the node.
onClick {
if (*path??:hudinv@visiblewhen) {
call *node:root.showinventory
} else {
call *path??:hudinv.hideinventory
}
}
what is the path?
onClick {
if (*node:hudinv@invis) { call *node:root.showinventory }
else { call *node:hudinv.hideinventory }
}
open the game console (shift+esc) and type ui_push editor
the question is where does the changes being saved?On your home.
For dir, run the game and check the logs below "---- filesystem initialization -----".
but replacing scripts, has a glitch and the game doesnt past the init stage.
i extracted althud.ufo from UFOAI-2.3\0ufos.pk3
to UFOAI-2.3\base\ufos\ui\althud.ufo
stuck.
----------- parse scripts ----------
52 script files
48 ui script files
UI_ParseNodeProperties: unknown property "orientation", node ignored (node althud.floor.health0)
UI_ParseNodeBody: node with bad body ignored (node "althud.floor.health0")
UI_ParseWindow: window "althud" has a bad body
FS_RemoveFile: remove /home/eliab/.ufoai/2.4-dev/base/keys.cfg
There are still 1 opened files
]./ufo[0x8189b80]
./ufo[0x818915d]
./ufo[0x8129fab]
./ufo[0x80f65c7]
./ufo[0x805dd44]
./ufo[0x8140743]
./ufo[0x812b4e7]
./ufo[0x8188397]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x670bd6]
./ufo[0x804e191]
Error: Shutdown
(that last part does *look* like a backtrace btw)----------- parse scripts ----------
52 script files
48 ui script files
UI_ParseProperty: "cl" is not a well formed node name (it must be quoted, uppercase const, a number, or prefixed with '*')
UI_ParseNodeProperties: Problem with parsing of node property 'althud.floor.health0@direction'. See upper
UI_ParseNodeBody: node with bad body ignored (node "althud.floor.health0")
UI_ParseWindow: window "althud" has a bad body
FS_RemoveFile: remove /home/eliab/.ufoai/2.4-dev/base/keys.cfg
There are still 1 opened files
]./ufo[0x8189b80]
./ufo[0x818915d]
./ufo[0x8129fab]
./ufo[0x80f65c7]
./ufo[0x805dd44]
./ufo[0x8140743]
./ufo[0x812b4e7]
./ufo[0x8188397]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x2f3bd6]
./ufo[0x804e191]
Error: Shutdown
----------- parse scripts ----------
52 script files
48 ui script files
UI_ParseProperty: Invalid value for property 'direction': Size mismatch: given size: 1, should be: 4. (type: 3)
UI_ParseNodeProperties: Problem with parsing of node property 'althud.floor.health0@direction'. See upper
UI_ParseNodeBody: node with bad body ignored (node "althud.floor.health0")
UI_ParseWindow: window "althud" has a bad body
FS_RemoveFile: remove /home/eliab/.ufoai/2.4-dev/base/keys.cfg
There are still 1 opened files
]./ufo[0x8189b80]
./ufo[0x818915d]
./ufo[0x8129fab]
./ufo[0x80f65c7]
./ufo[0x805dd44]
./ufo[0x8140743]
./ufo[0x812b4e7]
./ufo[0x8188397]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0x2f7bd6]
./ufo[0x804e191]
Error: Shutdown
Com_EParseValue: Illegal float statement '*cvar:mn_tu0' (file: 'C:\Program Files (x86)\UFOAI\ufoai\src\client\ui\ui_parse.c', line: 272)
bar team_sld0_status
{
pos "65 10"
size "4 46"
color ".2187 .73 .23 1"
current *cvar:mn_hp0
max *cvar:mn_hpmax0
disabled true
direction "uc"
excluderect { pos "0 0" size "4 46" }
}
...
// Select tu button
image showtu_btn {
align LAYOUTALIGN_MIDDLE
src "hhud/tm_sldbg_sel"
pos "27 10"
size "64 64"
onClick { cmd "showtu;" }
}
confunc showtu {
*node:root.team.team_sld0_status@color = ".65 .23 .23 1"
*node:root.team.team_sld0_status@current = *cvar:mn_tu0
*node:root.team.team_sld0_status@max = *cvar:mn_tumax0
}
@H-Hour, i understand you want to force an update but i dont think its how it works, the way i understand it...
*node:root.team.team_sld0_status@current = (*cvar:mn_tu0)
It should work without parenthesis too, but i dont check it.*node:root.team.team_sld0_status@current = "*cvar:mn_tu0"
1. if the above is correct what is the syntax difference between getting V_CVAR and its value?You can't get the cvarname from a property. Anyway, I dont think it mean something, cause it is an abstraction.
2. how 'excluderect' work, if i place buttons on panel without a a background and exclude all of it, the buttons will keep receive mouse event, right? (e.g. use ghost?)excluderect and ghost is the samething. The node will not receive events from the mouse. It is like there is not this node, then the parent node, or the node under it will receive the event.
also excluding a node, means that the node under it will receive the mouse event in order of creation with zone render being the last?
3. how does the nodes capture zone is defined? a square by the pos/size or by the image (if present) because i seen few none square buttons?Only with the box of pos and size, and all parents pos and size. It mean a node must be inside his parent box, else we can't click on it (and we can't see it too).
*node:root.team.team_sld0_status@current = *cvar:mn_tu0
now work like a link (same as syntax with quotes). cmd "mn_modify *cvar:group +1 0 1;"
call *node:root.hudenable
and if so, will this? onClick { cmd "actor_select (2 + (*cvar:group * 8)" }
intended to work as either actor_select 2 or 10.In the case of bar:then i should use the 'readonly' instead of the current used 'disable' property?
* "readonly" property is more interesting
while (*cvar:i ...) {
*cvar:temp<*cvar:i> = 0
}
displayammoofweapon true
but it doesnt, why? i also checked the equipment script and it used a different node for that called baseinventory which has no documentation of but in the container comments its mentioned, so should i work with baseinventory then?cmd "mn_modify *cvar:group +1 0 1;"
I remove mn_modify from 2.4.*cvar:group = ((*cvar:group + 1) % 2)
call *node:root.hudenable
Function also support params. I dont know what u want to do, but it is often more easy to use params. Check unittest/uisample/* or unittest/uitest for examples.onClick { cmd "actor_select (2 + (*cvar:group * 8)" }
Everything inside quote is not evaluated, else very simple replacement using "<>".onClick {
*cvar:tmp = (2 + (*cvar:group * 8))
cmd "actor_select <cvar:tmp>"
delete *cvar:tmp
}
then i should use the 'readonly' instead of the current used 'disable' property?Yes, 'disable=true' also should to the same result, but it is also not the same sementic. For example, disable should display bar with a grey color (but we dont do it at the moment).
*cvar:temp<*cvar:i>
Thing like that should work. It can exists some case work it dont work, but in this case, we must fix it. Only rememeber to delete cvar when you no more need it, cause it is global values.and last, according to this the button node has very limited use for 64x64 buttons, any chance there is some kind of hidden property that allows me to set the size for example 120x60 or should i stick with image and keep playing with the texl texh.This is a constraint only for the skin of the random size button, not on the button size itself. You also can use "custombutton" which have is own contraint too. I should rework every about tiles. But i dont know when i will do it, if i do it one day. I think i easily can remove contraintes on the "custombutton".
for that called baseinventory which has no documentationI will add now a cron to update wiki doc every day.
Everything inside quote is not evaluated, else very simple replacement using "<>".not evaluated? you mean in cmd, string or generally expression are not evaluated when injected?
It is more understandable to use math.it is more readable but unlike mn_modify you cannot use it with cmd, so like in the example before you get additional 2 lines to clutter the screen. :(
Thing like that should work. It can exists some case work it dont work, but in this case, we must fix it. Only rememeber to delete cvar when you no more need it, cause it is global values.interesting, any chance i can create nodes this way as well? maybe with abstractnode createChild method? i tried looking into it but coldnt find any documentation on how to use it...
confunc hudenable
{
*cvar:team_size = <1>
*cvar:position = 0
*cvar:i = 1
while ( *cvar:i < *cvar:team_size ){
call *node:root.team@createChild( ??? model head<*cvar:i> )
*node:root.team.head<*cvar:i>@src = *cvar:mn_head<*cvar:i>
*node:root.team.head<*cvar:i>@angles = "15 60 100"
*node:root.team.head<*cvar:i>@autoscale = true
*cvar:position = * 200 + (*cvar:i * 60 )
*node:root.team.head<*cvar:i>@pos = "<*cvar:position> 20"
*node:root.team.head<*cvar:i>@size = "50 78"
*node:root.team.head<*cvar:i>@ghost = true
same with the rest bars, strings etc nodes...
call *node:root.team@createChild ??? image bar_teambox<*cvar:i>
*node:root.team.bar_teambox<*cvar:i>@src
*cvar:i++
}
clean
}
is it possible? and is there some kind of documentation(or c declarations) on createChild and the like ?About "displayammoofweapon", yes, it only work with "baseinventory". The "baseinventory" node display all items from a base in a scrollable container. It is not created for soldiers. To display ammo, we must use a "model" or an "item" node, but it also need to update the .c code somewhere, like we do it with soldier weapon. If it is need, i can do it.my best guess will be to add another container nodes for L/R ammo?
not evaluated?cmd is like executing a shell command. It can't evaluate math operations.
interesting, any chance i can create nodes this way as well? maybe with abstractnode createChild method?You can check unittest/ufos/uisample/unittest_nodeallocation.ufo. I think it is not very easy to use atm. I can create a little documentation. But you also should check "component" code too, it is also not fully usable, but it is useful. Anyway there is also an example in unittest_nodeallocation.ufo
my best guess will be to add another container nodes for L/R ammo?I dont think. But it depend where you talking about. For the weapon container from the solider inventory, we can edit the containe code to display the ammo. But for the HUD, i dont know.
if i dont use those icons and want to set my own sequenceI dont really understand what you mean.
Com_AlignPtr: can't align V_NULL
*node:parent.tab<cvar:i>.bt_soldier@value = (*cvar:i)
*node:parent.tab<cvar:i>.bt_soldier@cvar = *cvar:selected_soldier
*node:parent.tab<cvar:i>.bt_soldier@cvar = "*cvar:selected_soldier"
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"
confunc crouch_checkbox_disable { }
confunc crouch_checkbox_clear { }
confunc crouch_checkbox_check { }
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
}
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.Here is an image showing what I want to accomplish with the reaction fire reservation buttons.
i still dont understand the difference between the syntax *cvar:i and <cvar:i> the first is a reference the second is its valueYou 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.
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 stringThen "*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.
also when i pass it as parameter, if use: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:
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.
*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).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.
not sure i understand this part.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).
*cvar:temp = <1>
*node.root.radiobutton@onClick = { cmd "actor_select <cvar:temp>;" }
delete *cvar:temp
"@" 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.
not sure i understand this part.I hope it help.
*node:root.radioTest@cvar = "*cvar:test6"
after *node:root.radioTest@onClick = { ...
But both must be set before the last call (cause <cvar> it is replaced at the runtime)*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.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.
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.
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.
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.
UI_ParseNode: node behaviour/component 'background' doesn't exists
radiobutton res_none
{
background "hhud/res_none"
pos "306 63"
size "31 23"
value 0
cvar *cvar:rf_reserve
onClick { cmd "deselect_reaction;" }
}
radiobutton res_none
{
pos "306 63"
background "hhud/res_none"
From the changehistory it looks like it was (accidentally?) removed 8 month ago, but it should not be to difficult to to make it work again. On the other hand I am not aware that anybody complained about that, so it maybe was not used at all.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.
for example you can use image and add buttons above only to capture events (onClick etc) ...Which is IMO the worst solution.
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 :-\ )