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

Code not reading touch monitor

Started by thueniken, 16 December 2017 - 02:37 AM
thueniken #1
Posted 16 December 2017 - 03:37 AM
Hello!

I have a bit of a problem. I am trying to create a central computer to control simple things in my base. (Lights, door, power etc.) I am currently trying to make a log in screen for the terminal. (don't want other players controlling my base) but I am having a problem with the code recognizing where I click on the display (2x3). here is the code: https://pastebin.com/P1YtxJMN

Cheers!
-Tristan
Bomb Bloke #2
Posted 16 December 2017 - 09:07 AM
Ok, so what's the question here? Is this code acting differently to how you'd expect it to (in that case, what does it do and how does it differ), or are you simply unsure what you should add to it (in that case, exactly what behaviour do you want that additional code to produce)?
Lupus590 #3
Posted 16 December 2017 - 10:32 AM
http://www.computercraft.info/forums2/index.php?/topic/28833-writing-a-good-ask-a-pro-post/
thueniken #4
Posted 16 December 2017 - 01:31 PM
Hi. the problem seems to be that I am pulling a event from the monitor at a specific area (Like a button on screen) and I believe my code is correct but the code seems to not recognize the event.
Bomb Bloke #5
Posted 17 December 2017 - 11:24 AM
How are you testing that?

Read as written, your code will assign the click co-ords to mouseWidth and mouseHeight: but that's all that you're asking it to do.

You've got a block of code bundled away in a checkClickPosition() function which would print a message if mouseWidth and mouseHeight have certain values when you call it, but at no point is that function ever called.

It sounds like all you need to do is either move that code out of there and into your "if event=="monitor_touch" then" conditional block, or add a "checkClickPosition()" line to the bottom of that block.