if statements using outputs and inputs?
Quote from Skelpolu on July 24, 2011, 2:13 pmHey 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.So, is it possible to something like this perhaps?
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.
So, is it possible to something like this perhaps?
Quote from dhavalmistry on July 24, 2011, 6:34 pmI 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.
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.
Quote from iWork925 on July 24, 2011, 7:24 pm-
2 logic_branch's - 1 logic_branch_listenerAdd to button
- Code: Select all
onpressed > [name_of_first_branch] > setvalue > true
onupressed > [name_of_first_branch] > setvalue > falseAdd to panel out relay
- Code: Select all
ontrigger > [name_of_panel_arm] > setanimation > 90deg_out_cornerback
ontrigger > [name_of_second_branch] > setvalue > trueMake a logic_branch_listener - set its branches to above
- Code: Select all
OnAllTrue > [name_of_panel_arm] > setanimation > 90deg_in_cornerback
-
2 logic_branch's - 1 logic_branch_listener
Add to button
- Code: Select all
onpressed > [name_of_first_branch] > setvalue > true
onupressed > [name_of_first_branch] > setvalue > false
Add to panel out relay
- Code: Select all
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
- Code: Select all
OnAllTrue > [name_of_panel_arm] > setanimation > 90deg_in_cornerback

PortalStories.com
"Oh, in case you got covered in that repulsion gel, here's some advice the lab boys gave me: DO NOT get covered in the repulsion gel."
Quote from Skelpolu on July 25, 2011, 8:15 amHow 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 )
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 )
Quote from Skotty on July 25, 2011, 8:16 amA 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.
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.
Quote from Skelpolu on July 25, 2011, 8:56 amEmm, 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.
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.
Quote from GreyHound on July 25, 2011, 3:22 pmSkelpolu 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.
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.
Quote from Skelpolu on July 26, 2011, 1:40 pmI see what you did there ..
Well, I'm gonna take a look at this later on when I got some more freetime. Thanks
I see what you did there ..
Well, I'm gonna take a look at this later on when I got some more freetime. Thanks ![]()
Quote from HMW on July 26, 2011, 3:24 pmIf 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.
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.
Other Portal 2 maps: Medusa Glare
Portal 1 maps: Try Anything Twice | Manic Mechanic
Quote from Skelpolu on July 27, 2011, 3:47 amHa, that is not the problem at all, since it does NOTHING.
I press the button: nothing happens.
I used the way iWork925 wrote above.
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.
