Jump to content




Code not reading touch monitor

peripheral help lua

4 replies to this topic

#1 thueniken

  • New Members
  • 2 posts

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

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

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)?

#3 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 16 December 2017 - 10:32 AM

http://www.computerc...ask-a-pro-post/

#4 thueniken

  • New Members
  • 2 posts

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.

#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users