This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Luanny's profile picture

open modular turret

Started by Luanny, 17 January 2017 - 11:20 PM
Luanny #1
Posted 18 January 2017 - 12:20 AM
so this mod has computercraft support but i have no clue how to write scripts but it has a trusted player list and i'd just like to be able to hook up the turret to a computer program and edit the trusted players rather than going from turret to turret to do it manually is there anyone that might be able to help me out with this?
Bomb Bloke #2
Posted 18 January 2017 - 12:59 AM
Assuming you mean this mod, with no online documentation it's difficult to comment on what you can or can't do with it. Perhaps if you copied out whatever the IGW has to say…?
KingofGamesYami #3
Posted 18 January 2017 - 01:00 AM
This sounds like a problem that could be solved reading my tutorial over using peripherals from other mods.
SquidDev #4
Posted 18 January 2017 - 12:09 PM
Looking at the code for the peripheral, you probably want to use addTrustedPlayer. This takes the player name and some additional boolean values (whether they can open the GUI, can change settings and are an admin). There is a similar method to remove players from the list (removeTrustedPlayer). So you could do something like:


-- Loop through all peripherals
local names = peripheral.getNames()
for i = 1, #names do
  local name  = names[i]
  -- If it is a turret then
  if peripheral.getType(name) == "OMTBase" then
    peripheral.call(name, "addTrustedPlayer", "Kevin") -- You can always use peripheral.wrap instead
  end
end
Do note, this isn't actually tested. If you need more help with peripherals, I recommend you check out the tutorial KingOfGamesYami posted.