+ Reply to Thread
Results 1 to 4 of 4

Thread: [REQ] Custom Thruster Expression

  1. #1
    Wire Noob Phoenix T'ril is on a distinguished road Phoenix T'ril's Avatar
    Join Date
    Oct 2008
    Posts
    2

    Default [REQ] Custom Thruster Expression

    Hey, guys. I've been trying to make a particular ship using wire thrusters.

    I've got the expression for turning and forward back, and I've even got an expression that mimics an advanced input for controlling hoverballs. I'm looking for a way to control forward / back, turn left / turn right, move up / move down, and strafe left / strafe right all with an advanced pod controller's keys. So far, I've got all of that controlled just fine, except for strafe left / strafe right.

    WASD are for turning and forward / back, and Space, R and Alt are devoted to controlling hoverballs. So there's no keys left for strafe left & right!

    What I'd like to do is make an expression where, when I hold down shift (or some other key), A and D control strafe left and right for as long as the key is held, and then go back to being turning keys when the key is released. But I haven't the faintest idea how to code that. Here's the expression so far;

    Code:
    N@BasicThrust
    I@W A S D
    O@Thrust Turn
    Thrust=W-S
    Turn=-D+A
    
    There's not much to it, of course. And it works fine. But I miss having strafe, I have it on my vanilla-thruster controlled ships. I'm just getting into learning how to make ships that use wire thrusters and stuff. I even made a vector-thruster ship the other day. But I'd like to upgrade a simple ship I've been using that can hover without miles of expressions and wiring. Can anyone help me out?

  2. #2
    Wire Amateur smkdeath is on a distinguished road smkdeath's Avatar
    Join Date
    Jun 2007
    Posts
    45

    Default Re: [REQ] Custom Thruster Expression

    Code:
    N@Movement
    I@W A S D SM
    O@FB LR ST
    
    FB = W - S
    
    Left = 0, If !SM & A -> Left = 1;
    Right = 0, If !SM & D -> Right = 1;
    LR = Right - Left
    
    # !SM & A is checking if Shift is NOT being pressed and A Is
    
    SL = 0, If SM & A -> SL = 1;
    SR = 0, If SM & D -> SR = 1;
    ST = SR - SL
    
    # SM & A is checking if Shift and A are both being pressed
    
    Hope this helps

  3. #3
    Expressionism 2.0

    Syranide has disabled reputation Syranide's Avatar
    Join Date
    Mar 2007
    Location
    Sweden
    Posts
    4,179

    Default Re: [REQ] Custom Thruster Expression

    Quote Originally Posted by smkdeath View Post
    Code:
    N@Movement
    I@W A S D SM
    O@FB LR ST
     
    FB = W - S
     
    Left = 0, If !SM & A -> Left = 1;
    Right = 0, If !SM & D -> Right = 1;
    LR = Right - Left
     
    # !SM & A is checking if Shift is NOT being pressed and A Is
     
    SL = 0, If SM & A -> SL = 1;
    SR = 0, If SM & D -> SR = 1;
    ST = SR - SL
     
    # SM & A is checking if Shift and A are both being pressed
    
    Hope this helps
    [quote=smkdeath;64886]
    Code:
    N@Movement
    I@W A S D SM
    O@FB LR ST
     
    FB = W - S
     
    Left = !SM & A
    Right = !SM & D
    LR = Right - Left
     
    # !SM & A is checking if Shift is NOT being pressed and A Is
     
    SL = SM & A
    SR = SM & D
    ST = SR - SL
     
    # SM & A is checking if Shift and A are both being pressed
    
    Shortened, there is no point in using "->" if you only do conditional value assignment, it is better done by just using the condition directly or by using (cond ? truevalue : falsevalue) if you need special values.

  4. #4
    Wire Noob Phoenix T'ril is on a distinguished road Phoenix T'ril's Avatar
    Join Date
    Oct 2008
    Posts
    2

    Default Re: [REQ] Custom Thruster Expression

    That's terrific guys, thanks for your help.

+ Reply to Thread

Similar Threads

  1. E2 custom extension help
    By phreak314 in forum Wiremod Lua Coding
    Replies: 8
    Last Post: 01-30-2010, 05:34 PM
  2. Thruster Only Expression
    By CrasySkillz in forum Contraptions & Saves
    Replies: 1
    Last Post: 02-04-2009, 12:20 PM
  3. Custom values ?
    By prut96 in forum Custom & Advanced Gates
    Replies: 3
    Last Post: 08-09-2008, 06:33 AM
  4. thruster expression for wizardsbane and others
    By Bernie in forum Contraptions & Saves
    Replies: 0
    Last Post: 03-16-2008, 04:27 PM
  5. Expression Gate to Vector Thruster
    By PochoTao in forum Help & Support
    Replies: 1
    Last Post: 09-03-2007, 10:38 AM

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