How do I make the Active Port on a Randomiser output 1-9 rather than 0-9?
I have a Randomiser hooked up to a Timer in such a way that the target time randomises between 0 and 9 seconds. It mostly works how I want, but if the Randomiser selects the A output, the target time is 0 and the whole thing stops.
I want to eliminate this by ensuring A is never selected, or if it is, it doesn't prevent the process from coming to a standstill. Any advice appreciated :)
-
Use a calculator gadget and set it to +, then change the value at the bottom to 1.0
Next, take a wire the numerical output from the Randomiser and connect it to the calculator. Reduce the number of output ports on the Randomiser to 8.
Finally, connect the calculator output to your timer. -
Thank you for your quick reply! I've tried what you suggested but could you be more specific about how I'm meant to connect these wires up? I've tried a few times and the timer's target time gets set to 255?
-
I've just tested it out in-game and my setup works for me as intended. I recommend using a Number Displayer temporarily to find out what value the Randomiser is outputting.
To break it down (as I see on my screen) connect your first wire into the Randomiser in 'Randomise' (the second port from the top). I've just wired a button from a controller sensor (set to Remote Controllable) into the Randomiser for this test. In the Randomiser, the 'No. Ports' should be 9.
Next, take an output wire from the bottom port of the Randomiser, called 'Active Port'. Connect this to 'Operand 1' in the Calculator. The Calculator should be set to Add. Take the slider on 'Operand 2' and change it to 1.00.
Now take a wire from the output of 'Result' and connect it to 'Target Time' in the Timer. I would also take another wire from the Calculator and connect it to a Number Displayer, so you know what it's outputting.
In edit mode with time paused, it will say 256 initially on the Timer. As soon as you start time, or go into play mode, the logic will become active and output the numbers 1-9.
Also from testing, you'll need to reset time whenever the Target Time on the Timer is changed. In my test setup, I'm using the X output from the Controller Sensor. This is connected to the 'Randomise' port on the Randomiser, as well as 'Reset Timer' on the Timer. -
Sorry for the late reply, but this seems to have done the trick, so thank you! :)
Iniciar sesión para dejar un comentario.