+ Reply to Thread
Results 1 to 4 of 4

Thread: E2 applyAngForce and chat problems

  1. #1
    Wire Noob salad force's Avatar
    Join Date
    Sep 2009
    Posts
    1

    Default E2 applyAngForce and chat problems

    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))

  2. #2
    Banned Glenni's Avatar
    Join Date
    May 2009
    Posts
    236

    Default Re: E2 applyAngForce and chat problems

    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

  3. #3
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Location
    Born Bostonian
    Posts
    2,652

    Default Re: E2 applyAngForce and chat problems

    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.

  4. #4
    Bug Buster TomyLobo's Avatar
    Join Date
    Feb 2009
    Posts
    2,796

    Default Re: E2 applyAngForce and chat problems

    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

+ Reply to Thread

Similar Threads

  1. applyAngForce() help
    By alfie275 in forum Expression 2 Discussion & Help
    Replies: 1
    Last Post: 07-14-2009, 06:53 PM
  2. ApplyAngForce is mad
    By DolToX in forum Installation and Malfunctions Support
    Replies: 2
    Last Post: 06-18-2009, 03:33 PM
  3. ApplyAngForce Help :/
    By Zanik in forum Installation and Malfunctions Support
    Replies: 1
    Last Post: 05-05-2009, 06:24 PM
  4. Advanced duplicator problems and some other problems
    By burak575 in forum Installation and Malfunctions Support
    Replies: 2
    Last Post: 01-15-2008, 11:51 AM
  5. Advanced Duplicator problems, and CPU problems
    By Moduliz0r in forum Bug Reports Archive
    Replies: 5
    Last Post: 11-04-2007, 02:51 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots