E2 help

i own my own small server for me and freinds and lately ive driven my them insane try to to learn e2 from then, so to save there sanity
i need an old e1 i wrote turned into a e2 with an added function
here it is

N@vector stalker
I@Lx Ly Lz D
O@Tx Ty Tz MUL

X = extposx()
Y = extposy()
Z = extposz()

Tx=(X - Lx)
Ty=(Y - Ly)
Tz=(Z - Lz)

MUL=(D > 200 & D < 1800000 ? 1:0 )

Lx, Ly, Lz are what i wire to the wire detectors world gps pos |
Tx, Ty, Tz are the thruster outputs |
and mul is the on:off function for thruster |

this was my e1 stalker that used vector thrusters and i want it in an e2 format but i still want the x y z outputs and i need it to have a target finder function(one with x y z and distance outputs like a real one)
and mabye throw in a keep upright function too?

can ne 1 plz convert it into e2 with the added functions listed

ps want info on the server lemme know ^.^

Expression 2 resources:

Differences between E1 and E2
Expression 2 Tutorial list
Expression 2 Documentation

A direct conversion of what you have, without anything added:

@name Vector Stalker
@inputs Lx Ly Lz D
@outputs Tx Ty Tz MUL
@persist X Y Z D

X = extposx()
Y = extposy()
Z = extposz()

Tx = (X - Lx)
Ty = (Y - Ly)
Tz = (Z - Lz)

#Hm, I'm not familliar with the E1 syntax, so I'll convert this the best I can
#ACTUALLY, I don't think this needs to be converted... 
#Here goes...
MUL = (D > 200 & D < 1800000 ? 1:0 )

#Divran, if you see this, I hope you're familliar with E1.

What’s “extposx/y/z()”?
I’ve not used E1 that much. Is that the position of the E1 chip?

Anyway, here’s a shorter conversion:

@name Vector Stalker
@inputs Lx Ly Lz D
@outputs Vec:vector Mul X Y Z
Vec = vec(Lx,Ly,Lz) - entity():pos()
X = Vec:x()
Y = Vec:y()
Z = Vec:z()
Mul = (D > 200 & D < 1800000 ? 1 : 0)

I made it output both a Vector and XYZ, since vector thrusters can accept vectors but you said you still wanted XYZ outputted.

Here’s one with a built in target finder that finds the closest player. I also made it fly on its own, so no wiring at all needed. Just spawn the E2 on a prop and watch it fly.

@name Stalker
@persist E:entity Target:entity
if (findCanQuery()) {
    Target = findClosest(E:massCenter())
if (!E) {E = entity():isWeldedTo()} elseif (E & Target) {


And here’s my E2 Thread in case you want to take a look there as well. http://www.facepunch.com/showthread.php?p=17811841
I will post the second of these two E2s on that thread.