Development > Newbie Coding
UI Adjustments.
dodon:
--- Quote from: H-Hour on November 03, 2010, 11:37:44 am ---Here is an image showing what I want to accomplish with the reaction fire reservation buttons.
--- End quote ---
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.)
bayo:
--- 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>) +";"
--- End quote ---
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
--- End quote ---
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.
--- End quote ---
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: ---*node.root.radiobutton@onClick = { cmd "actor_select <cvar>;" }
--- End code ---
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?
--- End 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.
mor2:
--- Quote from: bayo on November 03, 2010, 07:57:29 pm ---
--- Code: ---*node.root.radiobutton@onClick = { cmd "actor_select <cvar>;" }
--- End code ---
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).
--- End quote ---
not sure i understand this part.
and can i use your example from few post back?
--- Code: ---*cvar:temp = <1>
*node.root.radiobutton@onClick = { cmd "actor_select <cvar:temp>;" }
delete *cvar:temp
--- End code ---
--- 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.
--- End quote ---
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.
bayo:
--- Quote ---not sure i understand this part.
--- End quote ---
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: ---*node:root.radioTest@cvar = "*cvar:test6"
--- End code ---
after
--- Code: ---*node:root.radioTest@onClick = { ...
--- End code ---
But both must be set before the last call (cause <cvar> it is replaced at the runtime)
--- Code: ---*cvar:temp = <1>
*node.root.radiobutton@onClick = { cmd "actor_select <cvar:temp>;" }
delete *cvar:temp
--- End code ---
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...
--- End quote ---
Well, with a full example i can say something, but here, i really dont understand.
Mattn:
--- Quote from: dodon on November 03, 2010, 07:13:29 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.)
--- End quote ---
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.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version