Jump to content


Ditto8353's Content

There have been 136 items by Ditto8353 (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#44710 [LUA][ERROR]

Posted by Ditto8353 on 26 October 2012 - 08:22 PM in Ask a Pro

Yeah, I wouldn't worry about it too much.
It's just usually best to avoid 'break' when you can. It helps with debugging and just makes code easier to read.
Imagine chasing someone through a building. It's harder to find them if the room has two exits instead of one.



#44708 [LUA][ERROR]

Posted by Ditto8353 on 26 October 2012 - 08:16 PM in Ask a Pro

Hmm... Strange... It should work the same as you explained your previous code works, but it should not require the 'break' statement.
change
command = io.read()
to
local command = io.read()
That could possibly be effecting it. However, only do this if you do not need to use that input outside of the loop.
local variables declared inside of loops are destroyed at the end of the loop.



#44704 [LUA][ERROR]

Posted by Ditto8353 on 26 October 2012 - 08:03 PM in Ask a Pro

Yes, 'break' immediately exits the 'while' loop, effectively ending the program. I just wanted to make sure that it was doing what you wanted it to do.
However, I would like to offer an alternative approach.
repeat
   clearscreen()
   print("TreeFarm Control Program")
   print("Please enter engage/disengage command:")
   term.setCursorPos(1,4)
   command = io.read()
   if command == Controlon then
      write("Turning Treefarm on")
      rednet.send(15, "engage")
      sleep(10)
      clearscreen()
   elseif
      command == Controloff then
      write("Turning Treefarm off")
      clearscreen()
      print("Turning Treefarm off")
      rednet.send(TreefarmPC, "disengage")
      sleep(2)
   end
until command == Controlon



#44700 [LUA][ERROR]

Posted by Ditto8353 on 26 October 2012 - 07:54 PM in Ask a Pro

I am also curious about 'break' on line 22. What are you trying to accomplish with this?



#44699 [LUA][ERROR]

Posted by Ditto8353 on 26 October 2012 - 07:52 PM in Ask a Pro

Line 3: Change "15" to 15
(Remove quotes)

Edit: Ninja'd...



#44688 A Few Words

Posted by Ditto8353 on 26 October 2012 - 07:27 PM in Ask a Pro

I don't think Lyqyd was talking about the mistakes that people come here to solve. I believe he was talking about people trying to help even though they do not understand the subject. When someone posts a solution to a User, the User will tend to assume that the solution is correct and well-thought-out. However, if the person posting the solution does not have extensive knowledge on the subject, the solution may not be correct and may in fact cause other problems.

It comes down to being ignorant (the Users looking for help) or irresponsible (posting misinformation in a place where solutions are assumed to come from experienced programmers).

The ignorant should not be stomped, and I have never actually seen that happen here.
The irresponsible should.



#44681 The Dwarfy Dwarf Challenge: Make Dwarf Fortress!

Posted by Ditto8353 on 26 October 2012 - 07:19 PM in General

I will stuff my square opinion into the circular hole until my hands bleed.
Then I may consider shaving off the corners.

I don't actually have any intentions of creating this though. I lack the motivation and free time. I just enjoy throwing out ideas.



#44676 A Few Words

Posted by Ditto8353 on 26 October 2012 - 07:12 PM in Ask a Pro

View PostChunLing, on 26 October 2012 - 07:09 PM, said:

I don't mind, but it does little to help. Stomping may help make others afraid to make the same mistake, but doesn't necessarily tell them exactly what the mistake was.
To be fair, if you ever plan on having a job doing anything, you should probably get used to your mistakes getting stomped on.
It sucks if you have a fragile pride, but you have to learn to deal with it eventually.



#44663 The Dwarfy Dwarf Challenge: Make Dwarf Fortress!

Posted by Ditto8353 on 26 October 2012 - 06:57 PM in General

 billysback, on 26 October 2012 - 06:55 PM, said:

You wouldn't be able to have limitless maps, or maps bigger than the set width/height of the turtles area, without some sort of peripheral (like this http://www.computerc...anel-api-added/), If you had that then creating a 3Dish landscape wouldn't be that hard...
Personally, if I were to attempt a DF recreation it would be with vanilla CC. Maximize accessibility.



#44656 how to repeat comand?

Posted by Ditto8353 on 26 October 2012 - 06:47 PM in Ask a Pro

View PostsIdEkIcK_, on 26 October 2012 - 06:46 PM, said:

Open him up again, and hold Ctrl and T
Correct, yet gross.



#44652 how to repeat comand?

Posted by Ditto8353 on 26 October 2012 - 06:46 PM in Ask a Pro

Seriously, just pick it up with a pickaxe. He'll be ok.



#44648 how to repeat comand?

Posted by Ditto8353 on 26 October 2012 - 06:39 PM in Ask a Pro

Kill it



#44646 The Dwarfy Dwarf Challenge: Make Dwarf Fortress!

Posted by Ditto8353 on 26 October 2012 - 06:38 PM in General

Better yet!
Recreate dwarf fortress, but have all of the in-game actions on screen be mimicked by turtles! Woo!
Good luck mapping out the environment first...



#44643 how to repeat comand?

Posted by Ditto8353 on 26 October 2012 - 06:36 PM in Ask a Pro

while true do
   while turtle.detect() do
      turte.dig()
      turtle.forward()
   end
   while not turtle.detect() do
      turtle.turnLeft()
   end
end



#44636 The Dwarfy Dwarf Challenge: Make Dwarf Fortress!

Posted by Ditto8353 on 26 October 2012 - 06:28 PM in General

 ChunLing, on 26 October 2012 - 06:22 PM, said:

CC doesn't support the full ascii character set yet, though. This may be coming in a future update, but for now you're stuck.
Do you get candy every time you crush my hopes and dreams?



#44632 how to repeat comand?

Posted by Ditto8353 on 26 October 2012 - 06:24 PM in Ask a Pro

If you want a turtle to repeat something 'x' times
for i=1,x do
<code>
end

If you want the turtle to repeat forever
while true do
<code>
end



#44619 [Question][Solved] Working with Red power bundled cable and Item Detectors. A...

Posted by Ditto8353 on 26 October 2012 - 06:05 PM in Ask a Pro

I'm glad I could help, but there may be a more efficient solution, so don't hesitate to get creative.



#44617 how do you a turtle to take items from a chest

Posted by Ditto8353 on 26 October 2012 - 05:59 PM in Ask a Pro

Hmm... I am not sure what is happening here. It sounds a bit like the mod isn't functioning properly. You may want to check that you have the proper verions of Minecraft, Forge, CC, and Java installed.
In addition, if you type in simply
print("Hello")
Do you get any output?
If not, then I would lean towards checking your versions and doing a re-installation of the mod(s), but I do not have a full understanding of what could cause this.



#44611 how do you a turtle to take items from a chest

Posted by Ditto8353 on 26 October 2012 - 05:29 PM in Ask a Pro

Do you get an error message? If so, what is it?
Try doing
print(turtle.suck())
And tell us what the output is.
Is there a chest directly in front of the turtle?
Is there something in the chest?
Does the turtle have room for it?



#44607 how do you a turtle to take items from a chest

Posted by Ditto8353 on 26 October 2012 - 05:21 PM in Ask a Pro

turtle.suck() ?



#44600 The Dwarfy Dwarf Challenge: Make Dwarf Fortress!

Posted by Ditto8353 on 26 October 2012 - 04:57 PM in General

Thank you for this information!
repeat
   face = face + keyboard
until dwarfFortress



#44599 [Question][Solved] Working with Red power bundled cable and Item Detectors. A...

Posted by Ditto8353 on 26 October 2012 - 04:50 PM in Ask a Pro

As for solving it...
You could store the previous state of each wire in your Items table.
initialize all to 0
On redstone event newWireStates = wire states as measured
If newWireState > oldWireState then count it
oldWireStates = newWireStates



#44595 [Question][Solved] Working with Red power bundled cable and Item Detectors. A...

Posted by Ditto8353 on 26 October 2012 - 04:44 PM in Ask a Pro

Using Dirt and Coal for the example:
A Dirt block is counted, causing white to go high.
The program counts the dirt.
Directly afterwards a Coal is counted, causing black to high.
The program goes to count the coal BEFORE white goes low again.
The program double-counts the previous Dirt block.
White goes low, raising a redstone event BEFORE black goes low.
The program double-counts the previous Coal.



#44591 [Lua][Error]Odd error when I try to run program.

Posted by Ditto8353 on 26 October 2012 - 04:37 PM in Ask a Pro

View PostBeardmoresam, on 26 October 2012 - 04:34 PM, said:

The turtle screen is too small to have a line that long on it by the looks of things. I threw a n into the end of the line so that the user can see what they are typing. If that is the only advantage, I might aswell use print() ?
Yes. print vs write should not have any effect on how your program runs.



#44583 [Lua][Error]Odd error when I try to run program.

Posted by Ditto8353 on 26 October 2012 - 04:21 PM in Ask a Pro

When you use 'write()' the user will be typing on the same line as the output, directly after what is written. As far as I know it just looks better and saves screen space.