@name Console Touch Screen
@inputs CS:wirelink
@outputs CSE:entity [CSB Corn1 Corn2 Corn3 We We2]:vector Dist1 Dist2 As X As2 Y
@persist 
@trigger 

interval(10)

if(first())
{
    CS[2041] = 1
    CS[2042] = 9
    
    CSE = CS:entity()
    CSB = CSE:boxSize()
    
    Corn1 = CSE:pos() - CSE:forward() * (CSB:y() / 2) + CSE:right() * (CSB:x() / 2)
    Corn1 = Corn1 + (CSE:forward() * 3.2)
    Corn2 = CSE:pos() - CSE:forward() * (CSB:y() / 2) - CSE:right() * (CSB:x() / 2)
    Corn2 = Corn2+(CSE:forward() * 3.2)
    Corn3 = CSE:pos() + CSE:forward() * (CSB:y() / 2) + CSE:right() * (CSB:x() / 2)
    Corn3 = Corn3 - (CSE:forward() * 3.2) 
    Dist1 = Corn2:distance(Corn1)
    Dist2 = Corn3:distance(Corn1)
}

CSE = CS:entity()


if(owner():aimEntity() == CSE)
{
    We = (owner():aimPos() - Corn1) * CSE:right()
    As = abs(We:x() + We:y() + We:z())
    X = floor((As / Dist1) * 30)
    We2 = (owner():aimPos() - Corn1) * CSE:forward()
    As2 = abs(We2:x() + We2:y() + We2:z())
    Y = floor((As2 / Dist2) * 17)
    if(owner():keyUse())
    {
        CS[2041] = 1
    }
}
else
{
    
} 
CS:writeString(" ",X,Y,90,90)
