This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
EarthGuardian's profile picture

need some help with a pice of code

Started by EarthGuardian, 28 July 2012 - 11:24 AM
EarthGuardian #1
Posted 28 July 2012 - 01:24 PM
been working 2 hours on 1 pice of code.
and i still cant get it to work


i whant to use the repeat code.
but i can seem to break it anny way


repeat
while true do
Unit1aan()
event, param1, param2 = os.pullEvent()
end
until event == "key" and param1 == 45
os.shutdown()

it surpose to shut down when x is pressed
but i tryd about every combination. and i looked at the tutorial i cant get it to work for me
ie does nothing just repeating the stuff i put under unit1aan()

when i press anny letter nothing happens

please help ?
Teraminer #2
Posted 28 July 2012 - 03:43 PM
try not using "while true do"
and what is Unitlaan() ?
EarthGuardian #3
Posted 28 July 2012 - 03:49 PM
i toght i was clear?

i said i tryd to use eveyr single option.

abd uinit1aan() is 1 of the functions.
im now aware the sleep() function denies me the part to press x ..
so i need an computercraft counter.
to make it work.
becouse i uses sleep(10) to have 1 fuction outputed for 10 sec and then turned off
but when i use sleep it denies me the part when i press x.

and when i remove sleep()
is dusnt denie me that part
so i need a counter.
Tiin57 #4
Posted 28 July 2012 - 03:57 PM
Repair your grammar before your code. No one can help if they don't understand what you're saying. At least make a semblance of normal speech, instead of having 10 spelling errors (Major at that) and so many grammar screw-ups I'm afraid to count them. Please, for the love of all that is holy, don't post like that again! (Just my personal opinion; this is not (as far as I know) the official stance of the forums or Dan200)
EarthGuardian #5
Posted 28 July 2012 - 05:34 PM
again with this grammar

i know my english is realy bad. and im alredy using grammar stuff on google.
and btw code is code .. Unit1aan() is not bad grammar its a word i use in my own language and lua wil use it
anny way i solved a great part of my code.

im using a redstone singnal to count for me, thats more use full and faster then making a counter on cc.
MysticT #6
Posted 28 July 2012 - 08:18 PM
The answer was already posted:
try not using "while true do"
remove the while loop, cause you have a loop inside a loop, and the while loop while never end.
It should be:

repeat
  -- do whatever you want here
  local evt, key = os.pullEvent("key")
until key == 45
Tiin57 #7
Posted 28 July 2012 - 08:35 PM
again with this grammar
It irks me to see people expecting able help when they do not give a half-decent description of their issue. Nothing against you personally.
Lyqyd #8
Posted 29 July 2012 - 01:38 AM
again with this grammar
It irks me to see people expecting able help when they do not give a half-decent description of their issue. Nothing against you personally.

Not everyone's first language is English. There is a difference between zero-effort grammar and second-language grammar. No need to be harsh on the latter.
Tiin57 #9
Posted 29 July 2012 - 05:23 AM
It's not just the grammar, which is something I can understand. It's the obvious lack of accurate typing, as anyone with that kind of spelling wouldn't know that level of grammar. I should have clarified when I originally replied.