+ Reply to Thread
Results 1 to 4 of 4

Thread: confused on inputs and outputs for stools or entities

  1. #1
    Wire Amateur cokacola's Avatar
    Join Date
    Dec 2009
    Posts
    75

    Default confused on inputs and outputs for stools or entities

    Hello, could someone show me a simple example of a stool that spawns a box with the input of something like "A" and an output of X,Y,Z and X,Y,Z are only set when A is above 0?
    Its not that I really want to use it, but rather so I can actually understand the wire input and output functions for lua, as I am overly confused.
    If not, can you at least point me in the right direction?

    Off topic: what happened to the wiremod.com wiki?(wiremod.com/wiki)?
    Earth ? God -∞ - 2012
    Kittens ? God -∞ - 2010
    ------------------------

  2. #2
    billywitchdoctor.com Schilcote's Avatar
    Join Date
    Jan 2009
    Location
    There.
    Posts
    2,006

    Default Re: confused on inputs and outputs for stools or entities

    The Wiremod wiki merged with the Gmod wiki.


    [19:16:47]Client "rcdraco" spawned in server
    [19:17:10]rcdraco: hamburgertime
    [19:18:04]rcdraco was killed by worldspawn
    [19:21:50]Dropped "rcdraco" from server

  3. #3
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: confused on inputs and outputs for stools or entities

    This is just part of the code needed to get this entity working (Remember you need more stuff in initialize like PhysicsInit and whatever)

    Code:
    function ENT:Initialize()
        self.Inputs = Wire_CreateInputs( self.Entity, {"A"} )
        self.Outputs = Wire_CreateOutputs( self.Entity, {"X", "Y", "Z", "XYZ [VECTOR]"} )
        self.AllowChange = false
    end
    
    function ENT:TriggerInput( inputname, value )
        if (inputname == "A") then
            if (value == 0) then
                self.AllowChange = false
            else
                self.AllowChange = true
            end
        end
    end
    
    function ENT:Think()
        if (self.AllowChange) then
            local pos = self:GetPos()
            Wire_TriggerOutput( self.Entity, "XYZ", pos )
            Wire_TriggerOutput( self.Entity, "X", pos.x )
            Wire_TriggerOutput( self.Entity, "Y", pos.y )
            Wire_TriggerOutput( self.Entity, "Z", pos.z )
        end
    end
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  4. #4
    Wire Amateur cokacola's Avatar
    Join Date
    Dec 2009
    Posts
    75

    Default Re: confused on inputs and outputs for stools or entities

    Ahh, thank you
    that was very helpful, and I think if I look at some code, I should get the idea of everything else an entity needs
    Earth ? God -∞ - 2012
    Kittens ? God -∞ - 2010
    ------------------------

+ Reply to 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