#1
Posted 17 May 2015 - 04:25 PM
this is my first ever post! i just need a program/help on a program that would allow me to send 5 redstone signal in a certain time in minecraft.
it would be helpful if you guys post a program that did this .
#2
Posted 17 May 2015 - 04:40 PM
Check out the wiki page on the redstone API to see how you can set redstone outputs on and off. Also look into the sleep function to see how you can set how long the redstone will be on or off for.
#3
Posted 17 May 2015 - 07:58 PM
Regardless, Here's An Example :
rs.setOutput("right", true) --Sets Output On The Right Side to True
OR, If You Wanted To Have Your Code Be More Interactive
term.write("Which Side?: ") --Prints "Which Side?: " While Allowing You To Type On the Same Line side = read() tostring(side) Dont Think This Is Needed term.write("On Or Off?: ") on = read() tostring(on) --Again, Dont Think This Is Needed, But Ive Drawn Errors Before By Not Using It if on == "on" or on == "On" then --This Says That If The Users Types In "on" OR "On" Then Do The Following on = true --Sets On To True elseif on == "off" or "Off" --Same Thing As The Above Code "If on == on" Code, Only This Time Uses Off on == false --Sets On To False else print("I Don't Understand") shell.run(program) --This Will Run Your Program Again (Program Here Meaning Whatever You Typed In To Edit This Program(I.E.: edit startup)) end rs.setOutput(side, on) --Runs Program
That Is Untested, But Should Work. Happy Coding
#4
Posted 17 May 2015 - 08:33 PM
Why do some people start every single word with a capital letter? Are there some languages in which you're supposed to do that? Or am I missing something super obvious here?
Edited by flaghacker, 17 May 2015 - 08:34 PM.
#5
Posted 17 May 2015 - 11:18 PM
flaghacker, on 17 May 2015 - 08:33 PM, said:
Why do some people start every single word with a capital letter? Are there some languages in which you're supposed to do that? Or am I missing something super obvious here?
They speak a language where they capitalize differently, not starting every word with a capital, but they don't grasp the correct capitalization for English and capitalize everything. Just in case someone wants to learn, captialization rules.
#6
Posted 18 May 2015 - 06:10 PM
Edited by drunkjugernout, 18 May 2015 - 09:19 PM.
#7
Posted 18 May 2015 - 10:00 PM
KingofGamesYami, on 17 May 2015 - 11:18 PM, said:
flaghacker, on 17 May 2015 - 08:33 PM, said:
Why do some people start every single word with a capital letter? Are there some languages in which you're supposed to do that? Or am I missing something super obvious here?
They speak a language where they capitalize differently, not starting every word with a capital, but they don't grasp the correct capitalization for English and capitalize everything. Just in case someone wants to learn, captialization rules.
I Fully Grasp The English Language, Its My First Language And I Speak It Fluently (Lol). I Just Capitalize Out Of Habit Because I Did When I Was Younger Haha
#8
Posted 18 May 2015 - 10:10 PM
drunkjugernout, on 18 May 2015 - 06:10 PM, said:
Which Directions? I Can Whip Up A Code If You Need, Otherwise Check Out This Redstone API Wiki Page
#9
Posted 18 May 2015 - 10:21 PM
theMCcm, on 18 May 2015 - 10:00 PM, said:
Hmm.. It's really irritating (no offence). I was simply stating what I know to be true (it might not apply to you, but other posters who do the same thing).
#10
Posted 19 May 2015 - 12:50 AM
theMCcm, on 18 May 2015 - 10:10 PM, said:
drunkjugernout, on 18 May 2015 - 06:10 PM, said:
Which Directions? I Can Whip Up A Code If You Need, Otherwise Check Out This Redstone API Wiki Page
yes please, i need to send he signals left and right at the same time for 5 times at morning and at dusk send 5 redstone signals behind in minecraft with a delay per signal and have a delay of 4 seconds per signal. btw i want this run automatically and daily (srry about this complex request im use to a different coding program and i have exams coming up)
#11
Posted 19 May 2015 - 10:01 PM
drunkjugernout, on 19 May 2015 - 12:50 AM, said:
theMCcm, on 18 May 2015 - 10:10 PM, said:
drunkjugernout, on 18 May 2015 - 06:10 PM, said:
Which Directions? I Can Whip Up A Code If You Need, Otherwise Check Out This Redstone API Wiki Page
yes please, i need to send he signals left and right at the same time for 5 times at morning and at dusk send 5 redstone signals behind in minecraft with a delay per signal and have a delay of 4 seconds per signal. btw i want this run automatically and daily (srry about this complex request im use to a different coding program and i have exams coming up)
No Problem At All : D Besides, Not That Complicated
Here's The Code, Need Anything Else Just Ask
function pulse() for i = 1, 5 do rs.setOutput("right", true) rs.setOutput("left", true) sleep(4) rs.setOutput("right", false) rs.setOutput("left", false) sleep(4) end end local alarm = os.setAlarm(0) local alarm2 = os.setAlarm(12500) while true do local evt, arg = os.pullEvent("alarm") if arg == alarm or arg == alarm2 then pulse() end end\
Again, Untested, But That Above Should Work. Happy Coding : D
Edited by theMCcm, 20 May 2015 - 09:48 PM.
#12
Posted 19 May 2015 - 11:33 PM
theMCcm, on 19 May 2015 - 10:01 PM, said:
drunkjugernout, on 19 May 2015 - 12:50 AM, said:
theMCcm, on 18 May 2015 - 10:10 PM, said:
drunkjugernout, on 18 May 2015 - 06:10 PM, said:
Which Directions? I Can Whip Up A Code If You Need, Otherwise Check Out This Redstone API Wiki Page
yes please, i need to send he signals left and right at the same time for 5 times at morning and at dusk send 5 redstone signals behind in minecraft with a delay per signal and have a delay of 4 seconds per signal. btw i want this run automatically and daily (srry about this complex request im use to a different coding program and i have exams coming up)
No Problem At All : D Besides, Not That Complicated
Here's The Code, Need Anything Else Just Ask
function pulse() for i = 1, 5 do rs.setOutput("right", true) rs.setOutput("left", true) sleep(4) end end local alarm = os.setAlarm(0) while true do local evt, arg = os.pullEvent("alarm") if arg == alarm then pulse() end end\
Again, Untested, But That Above Should Work. Happy Coding : D
can a prograom run a program?
#13
Posted 20 May 2015 - 02:46 AM
drunkjugernout, on 19 May 2015 - 11:33 PM, said:
Yep, use the shell API
shell.run("filepath") --# Note that it should be a string
This would run the program 'filepath' as if you had typed the name into the computer's shell.
To add arguments:
shell.run("filepath","arg1","arg2")
#14
Posted 20 May 2015 - 05:09 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users