Setting variables from output.
I want to set a variable from the output of another gadget (in this case a counter).
So I created a variable D1 and want it to store whatever the counter is reading at any given time. I have the output for Current Count wired to a Variable Modifier set to "Set" with the D1 variable selected. I have a trigger to count up the counter when I hit triangle, and a display linked to the Current Value of the D1 variable, but nothing is going to that variable or displaying. What am I missing?
If I check the wires with L1 after testing, I can see that the counter variable is being passed, but not to the variable. How do I get the variable modifier to communicate properly with the actual variable?
-
Did you type in the correct name of the variable?
I'd also recommend using Get for getting variables instead of using the current value from the variable. -
Yes. I changed it just in case I was typing it wrong. The display works fine if I connect it to the Current Count of the counter directly, but since I'm trying to store the variable also, I want it to display when the variable is storing something. The numbers on the variable itself don't seem to change, so my assumption is that I've got something wrong between the counter and the variable itself. I feel like I have no idea how to be using the variable modifiers and so they're doing nothing.
-
What are you using the variable to control? If it's just using whatever the current value of a counter, why wouldn't you just wire the output to whatever you're modifying, or use a wireless transmitter?
-
The variable will be storing a number from the counter so I can reference it later with other functions. I want to be able to recall the variable later and use on multiple occasions, modify it, etc. There will eventually be other variables and gadgets involved, but I'm just working on getting the variable to be stored at all so I can move onto the next step. Basically, I just need to know how to store any variable *at all*. It's just not working.
The real problem seems to be that I just don't know what I'm doing—haha. I know what I want to do, but I can't figure out how to get the gadgets to link together the way I wanted the logic to work.
Basically, this is what I want:
- Counter counts up with the Triangle button (Currently: remote controlled Controller Sensor with Triangle button is wired to the Count Increase on the Counter)
- Counter output should be sent to a variable and stored there.
- When I recall that variable, I need it to represent whatever that Counter value was when it was stored (I plan on changing the counter value after this, so I need it to remember this number.)
- I'm only using a Display Number gadget right now for debugging, I won't be using it later. (With my current setup, if I wire the Display Number directly to the Counter Value, it works fine, but that's not the intention. I am only trying to display the variable to make sure it was stored.)
The parts in between are what are tripping me up, because the Variable Modifiers aren't doing what I expect them to do. I don't think I understand where to connect things and what I'm setting between the counter value and the variable itself. -
If you send me the Dream you're working on, I'll take a look when I get home tonight. When you're looking at the variable gadget, it should display the current value on it's icon in your scene or microchip. Does it appear to be counting up properly when you play the scene, press triangle, and go back into edit mode?
The way you described wiring the current count to a variable modifier sounds right, so maybe there's just an issue with how you set up the display of the variable. -
Yeah, the variable gadget doesn't show anything. I'm at work but I will send it in a few hours. I think I saw that you can send things directly, but just in case I'll name it "Variable saving test" if you search it later. Thanks!
-
'@TheOneironaut sent me their Dream, and we both learned that you need to send a pulse to the power of the variable modifier as well as the value you want to set for it to work properly.
請登入寫評論。