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

Menues dont seem to work for me

Started by Nakopa, 18 December 2015 - 06:42 PM
Nakopa #1
Posted 18 December 2015 - 07:42 PM
Im trying to somehow get a Menue working for me, but i simply cannot figure out why my submenue jokes around with me all the time. Its labeled function subMenue(). For better understanding i recommend you to load it into your minecraft and just run it. http://pastebin.com/UMMWbexx
Hydrotronics #2
Posted 20 December 2015 - 03:25 PM
quick question, what is this menu supposed to do?
also, when I took a look through the program, I noticed that you were looking for a hover event rather than a click event, was this meant to happen? And for painting the button, it looks fine to me! If I could get what it does, i may be able to then figure out what is wrong with the code

Edit: One more thing, where does the value "me" come from, i noticed on line 44 in the checkfor function you tell it to print "me".
Edited on 20 December 2015 - 02:30 PM
KingofGamesYami #3
Posted 20 December 2015 - 03:39 PM
Where did you find a hover event? I only found mouse_click… Which is correct

me is a global variable set in the drawButton function.
Hydrotronics #4
Posted 20 December 2015 - 03:46 PM
oh, lol i didn't see me being declared. and the mouse hover is happening somewhere as when i ran the code, i could tell it had changed when i hovered rather than clicked :/ i dunno where it is getting it from. But yeah, i still can't see why it remains black
KingofGamesYami #5
Posted 20 December 2015 - 04:50 PM
oh, lol i didn't see me being declared. and the mouse hover is happening somewhere as when i ran the code, i could tell it had changed when i hovered rather than clicked :/ i dunno where it is getting it from. But yeah, i still can't see why it remains black

That's very interesting. Especially since mouse_hover isn't even supported by computercraft. In fact, I'd love to make programs with mouse_hover events…
Nakopa #6
Posted 21 December 2015 - 09:09 AM
I can tell you why it remains black until you click once: getdata() is infront of the drawButton() function. So it is waiting for a clickevent to happen thus stopping the function. I may set the getData() function beneath each draw button so it gets the data everytime.
Nakopa #7
Posted 21 December 2015 - 12:24 PM
Guys i found the solution: the mistake was that the term.clear() in subMenue()repeated itself, thus clearing the buttons. The reason why the buttons remain when i press the location of exit is becuase the loop ends and stops it from clearing.