28 posts
Posted 28 April 2014 - 07:33 PM
Hi, at the beginning sorry for my English (it isn't my first language…), and hello ;)/>
I've got little problems with my code. You can check it here:
http://pastebin.com/BmvfqQtCProgram was writed in Polish variable names, but i think it's not a problem to read it ;)/>
Program correctly reads mouse position, but i think problem is in statement here:
if myszY == j and myszX <= textW then
opcje_wybr[j] = not opcje_wybr[j]
print("Wybrana opcja to opcja nr: "..j)
end
It's always false… It checks if mouse height is equals to option height, and if mouse width is smaller then option's name width. I think it's correct but it's always false… Why? Can you help me? If you don't understand something just ask :)/>
1281 posts
Posted 28 April 2014 - 08:39 PM
From what i can tell, you're defining myszY as 0 at the start
myszX = 0
myszY = 0
Then attempt to compare it to the loop counter for a 1-6 loop.
I can only guess you forgot to actually pass the mouse Y coord to this variable, since you don't appear to be doing so.
while true do
Rysuj()
event, p1, p2, p3 = os.pullEvent()
if event == "monitor_touch" then
mouseX = p2
mouseY = p3
print("X: "..mouseX.." Y: "..mouseY)
SprawdzOpcje()
end
end
28 posts
Posted 28 April 2014 - 08:52 PM
Oh… Little mistake in variables' names… Thanks for your help ;)/>
28 posts
Posted 29 April 2014 - 05:14 PM
Hi, it's me again ;)/> I've got lilttle problems with my code. I created some functions, one of them have to check monitor, draw text, and allow to change options, second have to apply settings to the reactor IN THE SAME TIME. And that is my problem. I add on the end of code line with parallel, but when i run a program it says: parallel :22: peripheral :62: Too long without yealding. Pls help!
8543 posts
Posted 29 April 2014 - 05:48 PM
We can't help you without seeing the code. Please post the full code.
28 posts
Posted 29 April 2014 - 06:09 PM
Huh -.-, i forget about it :D/> I upload it to pastebin but not wrote here :D/> Pastebin: mGEvdWs7 pP208Jqi <- little changes ;)/>
Edited on 29 April 2014 - 04:25 PM
1281 posts
Posted 29 April 2014 - 06:36 PM
It's because your reaktor function dosen't yield. Essentially it needs to use coroutine.yield somewhere. The most common way is to add a sleep at the top of the loop. Also note that parallel functions do not run simoultaneously, like you seem to believe.
Edited on 29 April 2014 - 04:36 PM
28 posts
Posted 29 April 2014 - 06:44 PM
It's because your reaktor function dosen't yield. Essentially it needs to use coroutine.yield somewhere. The most common way is to add a sleep at the top of the loop. Also note that parallel functions do not run simoultaneously, like you seem to believe.
I know it doesn't. As you can see i add a while true do loop at the beginning of these functions ;)/> I'm going to check reaktor function as you write. See you, and thanks for help :D/>
THX! It works ;)/>
Edited on 29 April 2014 - 04:46 PM
28 posts
Posted 29 April 2014 - 07:25 PM
Never mind, there weren't braces… getEnergyStorage()
And sorry about the threads :)/> I thought it will be better to seperate them. See you ;)/>
Edited on 29 April 2014 - 05:32 PM
8543 posts
Posted 29 April 2014 - 07:29 PM
Threads merged. Please stick to one topic for all questions about a given program. It makes it easier for those helping you to follow along. Feel free to change the title of the thread as you ask new questions, or change it to something general like, "Oczkosx's reactor control questions thread".
28 posts
Posted 29 April 2014 - 08:31 PM
Okay, thank you all. I split this program to my previous one. You can check it here:
http://pastebin.com/fhjFnBWUOne monitor is showing general infos about reactor, second is a config monitor. I'm pretty sure you don't understand it but i hope it will help somebody ;)/>
Please change thread title to: OczkoSX's Big Reactors troubles, and a ready Control Panel. Thanks fo all, See you :)/>