• Need help with e2 arrays
    8 replies, posted
Trying to find a way to make an e2 detect everything constrained to it and place it in an array so I can use the ranger filter on it. Current e2: [code] @name Oscilloscope Ranger Radar @inputs Oscilloscope:wirelink @outputs @persist @trigger runOnTick(1) if(first()){ Oscilloscope["Length",number]=5000 } MaxDist = 100000 Circle=vec(0,1,0):rotate(0,curtime()*10,0) Yaw=Circle:toAngle():yaw() rangerFilter(Props) Ranger = rangerOffset(MaxDist,entity():pos(),Circle) Dist=Ranger:distance() if (Dist < 500) {X = (Dist/MaxDist)*cos(Yaw) Y = (Dist/MaxDist)*sin(Yaw)} else {X = cos(Yaw) Y =sin(Yaw)} Oscilloscope["X",number]=X Oscilloscope["Y",number]=Y if(Dist<500){ Oscilloscope["R",number]=255 Oscilloscope["G",number]=0 Oscilloscope["B",number]=0 } if(Dist<1000&Dist>501){ Oscilloscope["R",number]=0 Oscilloscope["G",number]=255 Oscilloscope["B",number]=0 } if(Dist<100000&Dist>1001){ Oscilloscope["R",number]=0 Oscilloscope["G",number]=0 Oscilloscope["B",number]=255 } [/code]
Just update your E2 chip when you're done with constraints[code]randerFilter(entity():getConstraints())[/code]
I remember trying this earlier and it wouldn't work for some reason, but I might have put it in the wrong spot. I'll try again. Thank you!
Any way to make it everything constrained to the props the e2 is constrained to and anything constrained to those? (basically infinite) [editline]18th March 2017[/editline] Also the method you suggested kills the tick quota, and if I put it in the if(first()) it doesn't work at all.
It works in first(), but, as i said, you have to update your E2 chip when you're done with welding stuff. You can write a recursive function, but without proper optimization it will rip tick quota.
I did refresh the e2 when I put it in the if(first()), but the ranger didn't ignore any of the props constrained to it [code] if(first()){ Oscilloscope["Length",number]=5000 rangerFilter(entity():getConstraints()) } [/code]
Try this then[code]@persist Ignore:array if (first()) { Ignore = entity():getConstraints() } rangerFilter(Ignore)[/code]
Ok, thank you.
This works, but is there any way for it to also get the props contrained to those it is constrained to and so on?
Sorry, you need to Log In to post a reply to this thread.