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

[LUA] Program "missing out" one elseif

Started by abouttabs, 17 May 2013 - 12:53 AM
abouttabs #1
Posted 17 May 2013 - 02:53 AM
Title: [LUA] Program "missing out" one elseif

Hello,
I am having problem with my program (http://pastebin.com/WS70r8YM). I am using advanced computer and 2 columns of 3 monitors as touchscreen. My program is working fine and doing all I wanted until the very last bit where I added piece of code with button after the main program. It seems that computer doesn`t take the piece of code at all. I was trying to change ends and positioning for quite a while without any luck and I son`t see where the issue could be. If someone would be so kind to look at my code I would be really gratefull.
Sincerely
Abouttabs

Edit

Managed to sort it out. Got rid of loops in loops as advised, cleaned up and found out I misplaced end.
Thank you guys for help
LordIkol #2
Posted 17 May 2013 - 10:10 AM
Woah you should not watch so much "inception"

Run an infinite Loop inside an infinite loop inside an infinite Loop and then try to run an infinite loop outide of the infinite loop loop but still in the first inifinte loop….
you dont need to run while true do so often one is fairly enought.

you should first fix this i think then your programm will work as intended.

greets
Loki
abouttabs #3
Posted 17 May 2013 - 10:48 AM
Thank you I will try that, but the looping is just a precausion if they misclicked… it would be disaster to have wither loose in my base :-)
Again thank you for your time and effort, I will try that tonight.
sincerely
Abouttabs
LordIkol #4
Posted 17 May 2013 - 10:55 AM
You just Need One while true do and One os.pullEvent to catch every Input. Just define an if elseif Statement for all possible Options and an Else Statement for what should happen if The user is missing sth.
abouttabs #5
Posted 17 May 2013 - 05:42 PM
well I was trying to enable some buttons just when previous was pushed to prevent skipping of steps.. But thank you for your advice.
Sincerely
Abouttabs
LordIkol #6
Posted 18 May 2013 - 05:02 AM
Hi Buddy,

I am currently at work so i could not test it but i moved the while true loops from your code and added a function you could use to make sure button is only active after another button was clicked.
Absolutely untested for now but i will check it when im home

http://pastebin.com/bau5HQzq

Greets Loki
abouttabs #7
Posted 18 May 2013 - 05:05 PM
Thank you sir, I solved problem also, I put edit in the post, but forgot to reply which I am sorry for. Thank you for your time and wilingness to share your knowledge.
Your code is clearer and I will try to go through it and see how you do stuff and hopefully lern something new. Thank you sir
Sincerely
Abouttabs