Uhm, tell more. Does it work like "if both are non-zero then result = sum"?
Hello all I would like to request a simple gate that would function similar to a transistor. It would be a variable logic and gate. Here is a kind of truth table.
A | B | OUT
_________
5 | 20 | 25
0 | 110 | 0
20 | 0 | 0
13 | 15 | 28
You get the idea it is useful for a machine to give variable speeds to a thruster. Also maybe an add OR? Because if an or gate gets an input it just outputs 1 and this would let moving wire contraptions have more flexible speeds.
Say you have a target 90 degrees off from an auto turret the turret would move faster to get to the target then if it was a couple of degrees out. This would be very useful to me and maybe to other people so can someone give it a go?![]()
Uhm, tell more. Does it work like "if both are non-zero then result = sum"?
Yeah, like if true then add, else false
Python
if A && B:<blockquote>return=A+B</blockquote>
Lua might look nearly the same.![]()
This might work (untested):
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>
GateActions["and/and"] = {
group = "Arithmetic",
name = "And/And",
inputs = { "A", "B"},
output = function(gate, A, B)
if ((A) and (A <= 0)) or ((B) and (B <= 0)) then return 0 end
return A+B
end,
label = function(Out, A, B)
return A.." and/and "..B.." = "..Out
end
}
</div>
"Our death ray doesn't seem to be working. I'm standing right in it, and I'm not dead yet." - Jamie Hyneman
"Yes, managing the anonymous activity of the entire Internet is a challenge. Shoving the entire universe into a mason jar for use as a personal flashlight would also be a pesky bother." - Karl, BBR
WIREMOD WILL NOT WORK ON YOUR FACE! BUT IT DOES ON YOUR MOM :shifty:
<div class='codemain' style='height:200px;white-spaceThis might work (untested):
<div class='codetop'>CODEre;overflow:auto'>
GateActions["and/and"] = {
group = "Arithmetic",
name = "And/And",
inputs = { "A", "B"},
output = function(gate, A,
if ((A) and (A <= 0)) or ((and (B <= 0)) then return 0 end
return A+B
end,
label = function(Out, A,
return A.." and/and "..B.." = "..Out
end
}
</div>[/b][/quote]
ok I will test this later.
Thank you
works
I called it an Arithmetic gate cause it seemed like a special case Add.
"Our death ray doesn't seem to be working. I'm standing right in it, and I'm not dead yet." - Jamie Hyneman
"Yes, managing the anonymous activity of the entire Internet is a challenge. Shoving the entire universe into a mason jar for use as a personal flashlight would also be a pesky bother." - Karl, BBR
WIREMOD WILL NOT WORK ON YOUR FACE! BUT IT DOES ON YOUR MOM :shifty:
Lol it is add/and not and/and I changed that on my version just to let you know.
Have you added to SVN?
Hey,
This sounds interesting, but I don't fully understand how you could control speeds with this thing...
Can you give an example of some applications you have in mind?
Lol it is add/and not and/and I changed that on my version just to let you know.
Have you added to SVN?[/b]
Bah, only one letter off. Shouldn't it be and/add? Cause if A and B then A+B. I can add it to the svn.
"Our death ray doesn't seem to be working. I'm standing right in it, and I'm not dead yet." - Jamie Hyneman
"Yes, managing the anonymous activity of the entire Internet is a challenge. Shoving the entire universe into a mason jar for use as a personal flashlight would also be a pesky bother." - Karl, BBR
WIREMOD WILL NOT WORK ON YOUR FACE! BUT IT DOES ON YOUR MOM :shifty:
Bookmarks