Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Electro56

player program to set off firework machine

Question

im new to open computers and I need this for a convention limbocon

fuction:

set off firework machine if we get 500 players

description:

ok so heres what I need I need a program which uses this command getplayers()table and link it to a variable x.

so I need it to be like this if redstone signal is false do nothing if true run the getplayers()table command tie it to x and make a rule if x>500 (over 500) then send redstone signal and power off machine

if x <500 do nothing

deadline:

preferably today/tomorrow in time for the event

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
local component = require("component")
local sides = require("sides")
 
local rs = component.redstone
local dbg = component.debug
local computer = component.computer
 
local x = 0
local input = sides.left
local output = sides.right
 
while true do
  if rs.getInput(input) > 0 then
    x = #dbg.getPlayers()
    print("Players Updated!")
  end
  if x >= 500 then
    rs.setOutput(output, 15)
    os.sleep(5)
    computer.beep()
    computer.stop()
  end
  print(x)
  os.sleep(0.1)
end

Requires a redstone card and a debug card.

Feel free to change the definitions of the sides input and output.

Download from pastebin with this command:

pastebin get suXkJWnw fireworks.lua

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.