+ Reply to Thread
Results 1 to 6 of 6

Thread: Help with Expressions.

  1. #1
    Banned isdevilis's Avatar
    Join Date
    Sep 2008
    Posts
    11

    Question Help with Expressions.

    Even though I know that the Bi-accumulator basically does this, I would like to figure out what is wrong with this expression. When I tryed to validate it, it said unexpected symbol at line one ; . Plus I would like to know what -> means anyway, becuase garrysmod.com's wiki did not explain that symbol. Thank you.
    INPUT A B
    OUTPUT Z

    A==1 -> Z=1
    B==1 -> Z=-1

  2. #2
    Wire Noob Acknar's Avatar
    Join Date
    Oct 2008
    Posts
    4

    Default Re: Help with Expressions.

    It is expecting a semicolon at the end of both of those line, because they are If statements. Which answers your second question, the -> indicates to E1 If A==1 then (->) Z=1

    So...

    A==1 -> Z=1;
    B==1 -> Z=-1;

    That should validate.

  3. #3
    Banned isdevilis's Avatar
    Join Date
    Sep 2008
    Posts
    11

    Default Re: Help with Expressions.

    Well it works but I'm trying to get hoverballs to go up and down based upon the output of a adv. pod controller wired to an or any gate and another with a negate gate. In this instance
    INPUT A B
    OUTPUT Z

    A==1 -> Z=1
    B==1 -> Z=-1
    it malfunctioned and when I used W it went up and didnt stop even when i let go of W. So I rewrote it so it looked like this.
    INPUT A B
    OUTPUT Z

    A==1 -> Z=1;
    B==1 -> Z=-1;
    A==0 -> Z=0;
    B==0 -> Z=0;
    When I used this, it allowed me to validate it, but the hoverballs didnt move at all when i pressed W or S. Any suggestions?

  4. #4
    Spucatum Tauri Bull's Avatar
    Join Date
    Jun 2008
    Location
    Finland
    Posts
    6,009

    Default Re: Help with Expressions.

    A==1 -> Z=1;
    B==1 -> Z=-1;
    A==0 -> Z=0;
    B==0 -> Z=0;
    When you push A , B is still 0. So B==0->Z=0; Resets it to 0 again.

    A==1 -> Z=1;
    B==1 -> Z=-1;
    !A&!B->Z=0;

    That will work.
    It says in human; If A is NOT pressed AND B is NOT pressed THEN Z=0

    Ps. Thanks for adjusting your write-style. Highly appreciated.
    My signature has a point.
    Quote Originally Posted by Squeakyneb View Post
    when l3ulletje says do it, do it.
    That

    Quote Originally Posted by Anticept View Post
    By the way, Bull is in charge.

  5. #5
    Wire Sofaking Asphid's Avatar
    Join Date
    Oct 2008
    Location
    In a house.
    Posts
    1,023

    Default Re: Help with Expressions.

    Personally, what I do for something like that is:

    Code:
    Inputs:  A B
    Output: Z
    
    Z = (A -B)
    Where A and B are the two keys on the controller, and Z is wired to the first input of the hoverball.

    That way, if nothing is hit, or both are hit, you get Z = 0. If you hit A it outputs 1, B outputs -1.


    And yes, mad props on the improvement.
    <Anticept>Will sex for food.
    <Beer>peanus, I like that
    <nath2008uk>I must play with black peanus
    <Jat Goodwin>i like the underage one
    <Black Phoenix>He's a good pedo

  6. #6
    Banned isdevilis's Avatar
    Join Date
    Sep 2008
    Posts
    11

    Default Re: Help with Expressions.

    O lord I'm an idiot guys. I figured out what the problem was, it works perfectly now, but thanks for all the help and support.

+ Reply to Thread

Similar Threads

  1. Help with expressions
    By flametank952 in forum Expression 2 Discussion & Help
    Replies: 2
    Last Post: 01-06-2009, 04:48 PM
  2. Need some help with expressions
    By Matt in forum Installation and Malfunctions Support
    Replies: 3
    Last Post: 01-11-2008, 09:52 AM
  3. Expressions for everything
    By anescient in forum Ideas & Suggestions
    Replies: 2
    Last Post: 06-27-2007, 08:52 PM
  4. Expressions
    By NIR_Fluff in forum Ideas & Suggestions
    Replies: 5
    Last Post: 05-29-2007, 02:27 PM

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