You can make your entity have wire inputs by using the following code in ENT:Initialize
[lua]
self.Inputs = Wire_CreateInputs(self.Entity, {“NameOfFirstInput”, “NameOfSecondInput”, “NameOfThirdInput”})
[/lua]
You can have any number of inputs, this is just an example with three.
Then you need an ENT:TriggerInput function:
[lua]
function ENT:TriggerInput(name, value)
if name == “NameOfFirstInput” then
– do stuff with value
elseif name == “NameOfSecondInput” then
– do stuff with value
elseif name == “NameOfThirdInput” then
– do stuff with value
end
end
[/lua]
Note that Wiremod will only call that function when the input changes. If you need to access the input more often than that you can use something like:
[lua]
– in ENT:Initialize
self.FirstInput = 0
– in ENT:TriggerInput
if name == “NameOfFirstInput” then
self.FirstInput = value
end
– somewhere else
Msg("The value of the input is " … tostring(self.FirstInput) … "
")
[/lua]