Arrent you supposed to... like use arrays? I suck at thoose. But I think theres some pretty good examples in the E2 wiki example part
i have created an applyForce E2 chip that floats above my head, but am trying to devlop it into somethign that will applyAngForce when i tell it to via chat (Eg. i say: 1,0,0 and the entity will applyAngForce to 100,0,0)... any help?
here is my chip so far:
@name apply force test
@persist V:vector Gyro:angle
interval(10)
entity():isWeldedTo()
#floaty bit
V=owner()os()-(entity()
os()-vec(0,0,120))
applyForce($V*10+V)
Chip = entity()
Chip:applyAngForce(Gyro + $Gyro*5)
#when owner says P,Y,R value, apply 100 force to P,Y,R - doesnt work D:
owner:lastSaid("1,0,0") Chip:applyAngForce(ang(100,0,0))
owner:lastSaid("0,1,0") Chip:applyAngForce(ang(0,100,0))
owner:lastSaid("0,0,1") Chip:applyAngForce(ang(0,0,100))
owner:lastSaid("1,1,0") Chip:applyAngForce(ang(100,100,0))
owner:lastSaid("1,0,1") Chip:applyAngForce(ang(100,0,100))
owner:lastSaid("0,1,1") Chip:applyAngForce(ang(0,100,100))
owner:lastSaid("1,1,1") Chip:applyAngForce(ang(100,100,100))
Arrent you supposed to... like use arrays? I suck at thoose. But I think theres some pretty good examples in the E2 wiki example part
Please use code tags:
[highlight=e2]
@name apply force test
@persist V:vector Gyro:angle
interval(10)
entity():isWeldedTo()
#floaty bit
V=owner()os()-(entity()
os()-vec(0,0,120))
applyForce($V*10+V)
Chip = entity()
Chip:applyAngForce(Gyro + $Gyro*5)
#when owner says P,Y,R value, apply 100 force to P,Y,R - doesnt work D:
owner:lastSaid("1,0,0") Chip:applyAngForce(ang(100,0,0))
owner:lastSaid("0,1,0") Chip:applyAngForce(ang(0,100,0))
owner:lastSaid("0,0,1") Chip:applyAngForce(ang(0,0,100))
owner:lastSaid("1,1,0") Chip:applyAngForce(ang(100,100,0))
owner:lastSaid("1,0,1") Chip:applyAngForce(ang(100,0,100))
owner:lastSaid("0,1,1") Chip:applyAngForce(ang(0,100,100))
owner:lastSaid("1,1,1") Chip:applyAngForce(ang(100,100,100))
[/highlight]
I don't totally understand what you are trying to do, but for the final part, why not try this:
[highlight=e2]
@persist P Y R
runOnChat(1)
P=owner():lastSaid():explode(","):string(1):toNumb er()*100
Y=owner():lastSaid():explode(","):string(2):toNumb er()*100
R=owner():lastSaid():explode(","):string(3):toNumb er()*100
Chip:applyAngForce(ang(P, Y, R))
[/highlight]
This way it isn't limited to combinations of 1s and 0s, you can use negative forces, and you don't have to type each one out.
EDIT:just re-read your code and realized that you don't have if/then statements for the applyAngForce, on each execution it applies force at each of those angles, regardless of whether the owner told it to or not.
OP lacked ifs
"It's easy to win forgiveness for being wrong; being right is what gets you into real trouble." - Bjarne Stroustrup
Lífið læðist lúmskt áfram
Bookmarks