Jump to content




[openPeripheral]CommandRedstone-use a command to turn on redstone!


  • You cannot reply to this topic
12 replies to this topic

#1 Jappards

  • Validating
  • 116 posts
  • LocationHolland

Posted 15 June 2013 - 09:14 AM

when the openperipheral terminal glasses came out i created a test program, but then i maked it my main program and then i decided to release it for other people.

this program triggers redstone on top of it if one of the following commands are typed
Spoiler
it also displays the state of the redstone

how to use:
Spoiler

code:
http://pastebin.com/9sWKnPS0

pastebin get 9sWKnPS0 CommandRedstone

Note:this program requires openPeripheral:http://www.computerc...711#entry120711

suggestions: if you have any suggestions please post them below.

updater:
pastebin get r3WdEVUm CR updater

code:
http://pastebin.com/r3WdEVUm

credit:
Mikeemoo for openPeripheral
theoriginalbit for fixing some bugs

authors:
Xiretza
Jappards

#2 superaxander

  • Members
  • 609 posts
  • LocationHolland

Posted 15 June 2013 - 09:21 AM

Nice and simple. Well done!

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 15 June 2013 - 09:30 AM

nice and simple.

one code improvement though that jumped straight out at me.
this:
if command == "toggle" then
  if redstoneState == false then
   rs.setOutput("top",true)
   redstoneState = true
  else
   rs.setOutput("top",false)
   redstoneState = false
  end
end
can become
if command == "toggle" then
  redstoneState = not redstoneState --# this line toggles the boolean variable, see quote below for more info
  rs.setOutput("top", redstoneState)
end
this is how the not operator works

Quote

not true = false
not false = true


#4 Jappards

  • Validating
  • 116 posts
  • LocationHolland

Posted 15 June 2013 - 10:00 AM

thanks!

View Posttheoriginalbit, on 15 June 2013 - 09:30 AM, said:

Spoiler
thanks for noticing it me, the thread code is already updated, i will now be updating the pastebin.

Edit: pastebin updated, if you have any suggestions, please post it below

#5 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 15 June 2013 - 10:03 AM

View PostJappards, on 15 June 2013 - 10:00 AM, said:

thanks for noticing it me, the thread code is already updated, i will now be updating the pastebin.
No problems. You could use a similar method for the pulse command too
if command == "pulse" then
  rs.setOutput("top", not redstoneState)
  sleep(4)
  rs.setOutput("top", redstoneState)
end


#6 Jappards

  • Validating
  • 116 posts
  • LocationHolland

Posted 15 June 2013 - 10:16 AM

i already updated it on this thread and pastebin

#7 Xiretza

  • Members
  • 24 posts
  • LocationSomewhere behind the moon

Posted 15 June 2013 - 11:39 AM

Ok, made a little better (I hope :P) version, changed some things... http://pastebin.com/GkTuNmwS
Changes:
1. You can now tell the program where the RS output and the glassesbridge is
2. LOTS of changes in the background, just have a look at it :P

#8 Jappards

  • Validating
  • 116 posts
  • LocationHolland

Posted 15 June 2013 - 12:03 PM

thanks, i will update it, it does miss the clear command thought, but i can just add that to your version

#9 Xiretza

  • Members
  • 24 posts
  • LocationSomewhere behind the moon

Posted 15 June 2013 - 12:14 PM

View PostJappards, on 15 June 2013 - 12:03 PM, said:

it does miss the clear command thought
Why should it clear? The redstone signal is either on or off, you don't have to clear anything... And on startup it clears automatically.

#10 Jappards

  • Validating
  • 116 posts
  • LocationHolland

Posted 15 June 2013 - 12:21 PM

well, in case bugs mess the screen up

#11 Xiretza

  • Members
  • 24 posts
  • LocationSomewhere behind the moon

Posted 15 June 2013 - 12:47 PM

View PostJappards, on 15 June 2013 - 12:21 PM, said:

well, in case bugs mess the screen up
Bugs?! In my programs are no bugs :D

#12 Xiretza

  • Members
  • 24 posts
  • LocationSomewhere behind the moon

Posted 15 June 2013 - 08:23 PM

Sorry, but I had to do that. New termglassRS: http://pastebin.com/UGTKZhLP New updater: http://pastebin.com/JyYgs2Ys
Made it so you only have to run the updater, it detects what the name of the program was previously and replaces it (And if it fails, it has a save copy called "[filename]_old"). Had to add a bunch off stuff, but I think it's worth it.

#13 Jappards

  • Validating
  • 116 posts
  • LocationHolland

Posted 16 June 2013 - 02:35 AM

no problem, but i have a problem connecting to pastebin.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users