if statements using outputs and inputs?
Posted Jul 24, 2011
Hey there,
I was wondering: Is there a way to make an if-statement ( like in programming ) using outputs and inputs? Because I need to create an if-statement for a button: If button pressed and If the animation of a specific prop_dynamic is equals to, lets say, 90down, then execute SetAnimation for prop_dynamic to 90up, else return nothing.
I was wondering: Is there a way to make an if-statement ( like in programming ) using outputs and inputs? Because I need to create an if-statement for a button: If button pressed and If the animation of a specific prop_dynamic is equals to, lets say, 90down, then execute SetAnimation for prop_dynamic to 90up, else return nothing.
So, is it possible to something like this perhaps?
Registered users don’t see ads!
Register now!
Posted Jul 24, 2011
Replied
4 hours
later
I was wondering the same thing before but then someone pointed me to math_counter and logic_relay....and the combination of multiple of those, I have been able to successfully mimic if statements.
In your case you might have to use 2 logic_relays (one to animate the panel up and the other to animate the panel down) and a math_counter.
Posted Jul 24, 2011
Replied
49 minutes
later
-
2 logic_branch's - 1 logic_branch_listener
Add to button
onpressed > [name_of_first_branch] > setvalue > true
onupressed > [name_of_first_branch] > setvalue > false
Add to panel out relay
ontrigger > [name_of_panel_arm] > setanimation > 90deg_out_cornerback
ontrigger > [name_of_second_branch] > setvalue > true
Make a logic_branch_listener - set its branches to above
OnAllTrue > [name_of_panel_arm] > setanimation > 90deg_in_cornerback
Posted Jul 25, 2011
Replied
12 hours
later
How should that work?
The branch-listener doesnt get's even gets triggers by the button, so how should the branch listener set the animation then? Also, even if this would work, the animation would stay for ever, but i want to close it after a while. I also use the telescope_arm_128, so the animation you gave me wouldnt work ( but I guess you just used it as an example, hehe )
The branch-listener doesnt get's even gets triggers by the button, so how should the branch listener set the animation then? Also, even if this would work, the animation would stay for ever, but i want to close it after a while. I also use the telescope_arm_128, so the animation you gave me wouldnt work ( but I guess you just used it as an example, hehe )
Posted Jul 25, 2011
Replied
1 minutes
later
A branch listener checks what states the specified logic_branches have. If all are true (Value 1) it will fire the output "OnAllTrue".
The following will happen: OnPressed - first branche is true. If the logic_relay triggers the second branch will be true and the animation 90down will play. Now both branches are true and the animation you wanted plays. Now the listener plays the other animation, because both branches are true (both conditions are fullfilled).
To close it after a while just work with a delay for the closing animation.
The following will happen: OnPressed - first branche is true. If the logic_relay triggers the second branch will be true and the animation 90down will play. Now both branches are true and the animation you wanted plays. Now the listener plays the other animation, because both branches are true (both conditions are fullfilled).
To close it after a while just work with a delay for the closing animation.
Posted Jul 25, 2011
Replied
39 minutes
later
Emm, and why doesnt it works for me when I'm ingame? I mean, I did like he said, but it doesnt works when I press the button.
Posted Jul 25, 2011
Replied
6 hours
later
Skelpolu wrote:
Emm, and why doesnt it works for me when I'm ingame? I mean, I did like he said, but it doesnt works when I press the button.
Not sure if this might help, but i'm pretty sure you just need the knowledge from this tutorial
and adapt / extend it a bit.
Posted Jul 26, 2011
Replied
22 hours
later
I see what you did there ..
Well, I'm gonna take a look at this later on when I got some more freetime. Thanks
Well, I'm gonna take a look at this later on when I got some more freetime. Thanks
Posted Jul 26, 2011
Replied
1 hour
later
If your problem is just that the prop_dynamic is replaying the 90up animation while it is already in that position, try replacing your "SetAnimation" outputs with "SetAnimationNoReset" outputs.
Registered users don’t see ads!
Register now!
Posted Jul 27, 2011
Replied
12 hours
later
Ha, that is not the problem at all, since it does NOTHING.
I press the button: nothing happens.
I used the way iWork925 wrote above.
I press the button: nothing happens.
I used the way iWork925 wrote above.