+ Reply to Thread
Page 2 of 40 FirstFirst 1 2 3 4 12 ... LastLast
Results 11 to 20 of 399

Thread: Expression Gate Documentation

  1. #11
    Expressionism 2.0

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

    Default

    Everybody look at the Wiki page. http://www.garrysmod.com/wiki/?title...xpression_Gate
    I'm working on a wiki page for the expression gate. As you can see I am writing a guide to the gate. Please help improving![/b]
    Ah, that looks terrific!
    (Especially "Syranide = God" )

    Basically, I would hook it up to a pulser to simulate a frequency variable. It would check if the frequency was true, so if I had a ticktime of .001, it would have a frequency of 1000.

    That's the reason I wanted to see if Input1 == 1 -> Input2 == 1 -> Out = 1; would work. So I can make something like

    ~Frequency ->
    *rest of the Expression code*

    To simulate the Frequency variable on the CPU.

    Nevermind...[/b]
    Yes, the expression gate is clocked using an external pulser instead of an internal as is the case with the CPU.
    The way I do is like you describe there, although Frequency is slighty misleading because it implies a value... but anyway, yes that's how you do it if you would like it to run 1000 times per second, just know that the it is not possible to do it because the wirelib does not support it, I think you can do something like 50 per second at most (and there would be no reason to do otherwise either because no other component can work faster), a simple way of setting it up is using a timer instead as clock, as it would then update as fast as possible I believe.

    And doing ~Clock would only update it when the clock has updated meaning that it won't speed up if the other inputs are changed.

  2. #12
    Inactive CBBP is on a distinguished road CBBP's Avatar
    Join Date
    Apr 2007
    Posts
    201

    Default

    How would you do a value range? like.. the value can only be between -1 and 1

  3. #13
    Expressionism 2.0

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

    Default

    How would you do a value range? like.. the value can only be between -1 and 1 [/b]
    Code:
    Value < -1 -> Value = -1;
    Value > 1 -> Value = 1;
    
    or even simpler

    Code:
    Value = clamp(Value, -1, 1)
    
    which is the same as

    Code:
    Value = max(-1, min(1, Value))
    
    I suggest the second, the others as just given as examples.
    Cheers!

  4. #14
    Inactive Qjet is on a distinguished road Qjet's Avatar
    Join Date
    Mar 2007
    Location
    Canada
    Posts
    320

    Default

    I have found a VERY useful tool if you guys like to use the expression gate for formulas

    Currently im using it to tweak the power stroke of a racing machine.
    [attachment=381:MathGVgraph.png]

    heres a link:

    [attachment=382:mgv3_1.zip]
    Attached Images
    Attached Files

  5. #15
    Inactive SkAzZ is on a distinguished road SkAzZ's Avatar
    Join Date
    Mar 2007
    Posts
    7

    Default

    Hi, is there an code that negates a value?

    Also, how do I do a greater than / less than gate?

    Thanks!

  6. #16
    Expressionism 2.0

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

    Default

    Hi, is there an code that negates a value?

    Also, how do I do a greater than / less than gate?

    Thanks![/b]
    Negate: (Simple arithmetic)
    Code:
    A = -A
    
    Greater than: (C will be 1 if A is greater than and 0 otherwise)
    Code:
    C = A > B
    
    In terms of a the code for creating an actual greater than gate it would be
    Code:
    Inputs: A B
    Outputs: Out
    Out = A > B
    
    Hope it helps, just ask if you have any more questions!

  7. #17
    Inactive SkAzZ is on a distinguished road SkAzZ's Avatar
    Join Date
    Mar 2007
    Posts
    7

    Default

    Thank you very much, so simple now Iv seen it.

    But about The greater than gate, I just want something with a Value Range but outputs 1 if its between it and 0 if its not in the value range.

    Cheers

  8. #18
    Wire Dev - Lazy
    tomb332 has a spectacular aura about tomb332 has a spectacular aura about tomb332's Avatar
    Join Date
    Mar 2007
    Location
    Birmigham,UK
    Posts
    1,384

    Default

    thats an is in range(inclusive) gate (exists under comparison)
    and would be
    Code:
    Inputs:Min Max Value
    Outputs: Out
    Out = ((Value < Max && Value > Min) ? 1:0)
    
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

    Super Easy Wire Download

  9. #19
    Expressionism 2.0

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

    Default

    Aha!
    Hmm perhaps I should add this to the available functions, anyway, I don't want to be picky, but I want to show people how you can do it in the "intended way", that is now using (B ? 1 : 0) which is the same as just writing B (and yours is exclusive ):

    inclusive in-range gate (minimal version)
    Code:
    Inputs:Min Max Value
    Outputs: Out
    Out = Value => Min && Value <= Max
    

  10. #20
    Foxy Wirererer

    -=Fox=- will become famous soon enough -=Fox=- will become famous soon enough -=Fox=-'s Avatar
    Join Date
    Feb 2007
    Location
    Somewhere in my Mind...
    Posts
    1,851
    Blog Entries
    2

    Default

    Yah and a very Simple Delta is this:

    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-spacere;overflow:auto'>
    N@Simple Delta
    I@A
    O@O
    O = $A
    </div>
    http://tiny.cc/OMFGWTFBBQ

    Best People On Wiremod!

    Black Phoenix, Azrael, Jat Goodwin, Magos Mechanicus, ITSBTH, Fizyk, g33v3s,tuusita, InfectiousFight, ief015

    Pointless things that are pointless, are pointlessly pointless, therefore pointlessness is pointless.
    So pointlessly pointing out the pointlessness of this pointless signature is utterly pointless.
    My IQ is 123

+ Reply to Thread
Page 2 of 40 FirstFirst 1 2 3 4 12 ... LastLast

Similar Threads

  1. ZGPU Documentation
    By Black Phoenix in forum CPU, GPU, and Hi-speed
    Replies: 26
    Last Post: 07-27-2010, 09:43 PM
  2. Documentation of hi-speed devices
    By Black Phoenix in forum CPU, GPU, and Hi-speed
    Replies: 97
    Last Post: 07-12-2010, 04:38 AM
  3. ZCPU Documentation
    By Black Phoenix in forum CPU, GPU, and Hi-speed
    Replies: 142
    Last Post: 08-31-2009, 11:40 AM
  4. Moongate Documentation
    By BlackNecro in forum Wiremod Addons
    Replies: 24
    Last Post: 04-22-2009, 12:32 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
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots