Development > Newbie Coding

UI Adjustments.

<< < (9/17) > >>

bayo:

--- Code: ---cmd "mn_modify *cvar:group +1 0 1;"
--- End code ---
I remove mn_modify from 2.4.
It is more understandable to use math. For example (only an example, cause i dont remember mn_modify param and results):

--- Code: ---*cvar:group = ((*cvar:group + 1) % 2)
--- End code ---


--- Code: ---call *node:root.hudenable
--- End code ---
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.


--- Code: ---onClick { cmd "actor_select (2 + (*cvar:group * 8)" }
--- End code ---
Everything inside quote is not evaluated, else very simple replacement using "<>".

--- Code: ---onClick {
    *cvar:tmp = (2 + (*cvar:group * 8))
    cmd "actor_select <cvar:tmp>"
    delete *cvar:tmp
}

--- End code ---


--- Quote ---then i should use the 'readonly' instead of the current used 'disable' property?

--- End quote ---
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).


--- Code: ---*cvar:temp<*cvar:i>
--- End code ---
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.


--- Quote ---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.
--- End quote ---
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".

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.


--- Quote ---for that called baseinventory which has no documentation
--- End quote ---
I will add now a cron to update wiki doc every day.

mor2:

--- Quote from: bayo on October 31, 2010, 05:38:28 pm ---Everything inside quote is not evaluated, else very simple replacement using "<>".
--- End quote ---
not evaluated? you mean in cmd, string or generally expression are not evaluated when injected?



--- Quote from: bayo ---It is more understandable to use math.
--- End quote ---
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.  :(



--- Quote from: bayo ---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.
--- End quote ---
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...

the reason i want this is that yesterday i was dumb founded by the amount of manual data entry i has to do and would have to do again, for every ;ittle fix.
for a team of 8, i got: 8 head nodes, 8 models nodes, 3*8 bar nodes, 8 name nodes etc all of them with at least 5 properties, its ammounts to a shit load of lines, and its only 8!   >:(    

i was thinking on something along those lines:

--- Code: --- 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
}
--- End code ---
is it possible? and is there some kind of documentation(or c declarations) on createChild and the like ?



--- Quote from: bayo ---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.
--- End quote ---
my best guess will be to add another container nodes for L/R ammo?
i mean there is already containers for: extension, right,left,backpack,belt,holster,headgear,armour   
why not for right_ammo, left_ammo, no?

bayo:

--- Quote ---not evaluated?
--- End quote ---
cmd is like executing a shell command. It can't evaluate math operations.


--- Quote ---interesting, any chance i can create nodes this way as well? maybe with abstractnode createChild method?
--- End quote ---
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


--- Quote ---my best guess will be to add another container nodes for L/R ammo?
--- End quote ---
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.

mor2:
1. ok, np.
2. where are all those "unittest/ufos/uisample/unittest_nodeallocation.ufo" examples you point me to? its not in the ufos.pk3 nor i seen it in the src folder  ???
3. i mean for our weapon/ammo concept,  for example like here.
all we need is something to show the ammo near the weapon, if you can make it in separate nodes then its will be more flexible but displayammoofweapon property will work too (i can always use them as ghost and place two buttons above it to capture onclick event over the weapon and over the ammo)

thanks.

bayo:
http://ufoai.git.sourceforge.net/git/gitweb.cgi?p=ufoai/ufoai;a=blob;f=unittest/ufos/uisample/unittest_nodeallocation.ufo

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version