Jump to content




Botania/ComputerCraft Automation


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

#1 MihaMi

  • Members
  • 6 posts

Posted 04 April 2015 - 08:33 PM

I want to get the code for automating this. I have a Item Dropper which has 1 of Mana Pearl, Mana Diamond and Manasteel Ingot, which makes Terrasteel. I have set up a system and I want code like this: When i receive a redstone with high signal from behind, Emit 3 quick pulses for each of items.

I would appreciate some help. :D

So, I know the most basic stuff from CC, but I am not the best coder in the world.

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 April 2015 - 08:45 PM

Please post the code you have written so far and explain what you're having issues with.

#3 MihaMi

  • Members
  • 6 posts

Posted 05 April 2015 - 11:39 AM

I haven't got the code yet, I was asking for someone to explain how to make a pulser, when redstone signal of 15 comes to the computer. I know, this might be simple but i spent all night to figure out how to do it, still no progress.

#4 agowa338

  • Members
  • 23 posts

Posted 06 April 2015 - 11:37 PM

Look here Redstone API.
You can use "redstone.getAnalogInput(15)" for looking at the input and probably "redstone.setOutput(string side, boolean value)" for setting your output.
But I have to admit, that I don't really understand what you exactly mean by "make a pulser".

#5 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 07 April 2015 - 01:08 AM

He wants something that'll 'pulse' redstone, similar to a redstone clock.

That's pretty simple, do something like this:

for i = 1, 3 do --#pulse 3 times
  rs.setOutput( "left", true ) --#turn on redstone to the left
  sleep( 0.05 ) --#wait 1 block update
  rs.setOutput( "left", false ) --#turn off redstone to the left
end

Also, redstone.getAnalogInput( 15 ) would not work, it requires a side, not a strength

if rs.getAnalogInput( "right" ) == 15 then --#if the input on the right is level 15
  --#do something
end

Edited by KingofGamesYami, 08 April 2015 - 12:16 AM.


#6 MihaMi

  • Members
  • 6 posts

Posted 07 April 2015 - 12:29 PM

@KingOfGamesYami That will do, but does that pulse out 3 times, when it receives redstone signal?
@agowa338 When does the computer receive a redstone signal, he pulses 3 times, basically.

#7 agowa338

  • Members
  • 23 posts

Posted 07 April 2015 - 11:50 PM

I'll give you a short summary, what you could do to accomplish your goal.

1. Create an endless loop
while true do

  sleep(1)
end

2. Check if the computer receives a redstone signal of strength 15 on the right side
if rs.getAnalogInput( "right" ) == 15 then

end

Now when the computer receives the signal it jumps into this if block, so you have to put that what should happen in here
3. Set redstone output to true and after one block update to false for one pulse
rs.setOutput( "left", true )
sleep( 0.05 )
rs.setOutput( "left", false )

4. And because you want 3 pulses you have to put a count-controlled loop around it (that counts from 1 to 3)
for i = 1, 3 do


end


#8 MihaMi

  • Members
  • 6 posts

Posted 13 April 2015 - 02:01 PM

Okay, wrote it, tested and it has one problem, it doesn't pulse out.
Here is the code: http://pastebin.com/hGbcQS9S
Don't know what is the problem.
Previously, I had a problem "too long without yielding".

Edited by MihaMi, 13 April 2015 - 02:49 PM.


#9 Cing

  • Members
  • 72 posts

Posted 13 April 2015 - 05:18 PM

I don't get why it say "too long without yielding" because you have a 'sleep in your program.
But the pulser probably doesn't work because the redstone signal is to low try to put it on 14 not 15.

EDIT: I have tested it and what i said above isn't correct
but "rs.getAnalogInput("left")" means that the computer checks your left when you'r facing the computer not the left of the computer it self.

Edited by Cing, 13 April 2015 - 05:36 PM.


#10 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 13 April 2015 - 05:25 PM

Did you give it a redstone current of the power 15 to the left side for at least 1 second? Because that sleep(1) might be active when you applied the current.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users