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

Touch screen problem. I can't click ! ( Advanced Monitors )

Started by SheepWithNoWool, 03 March 2013 - 03:22 AM
SheepWithNoWool #1
Posted 03 March 2013 - 04:22 AM
Title: Touch screen problem. I can't click ! ( Advanced Monitors )

Hello !
I'm using the FTB betapack A (v12).

I begin with lua but I'm trying to make a numpad door with a door ( obviously ), an advanced computer, an advanced monitor and noteblocks.

Here's my program : http://pastebin.com/1pFaWjjd

But I have a problem because I can't click on the monitor. I already tried left click, right click and a lot of keyboard keys. I was thinking that my program doesn't work so I tried others programs using touchscreens monitors. They don't working too.

I searched on the web but I didn't find an answer.

- What's the key to click on a monitor ?
- Need I turn on/off something in the config ? ( I'm the owner of the server )
- Is there another reason ?

Thanks
darkrising #2
Posted 03 March 2013 - 07:17 AM
Well for a start your 'sleeps' between the redstone lines is set extreemly low, try 1 second instead of 0.01
Bubba #3
Posted 03 March 2013 - 08:32 AM
Well for a start your 'sleeps' between the redstone lines is set extreemly low, try 1 second instead of 0.01

I may be wrong about this, but I believe that the lowest possible sleep time is 0.05 because that is the rate of a tick.

I noticed in your program that you wait for clicks at x=1, y=4, which corresponds to a blank space. Did you mean to write 4,1 instead?
SheepWithNoWool #4
Posted 03 March 2013 - 11:21 AM
Well for a start your 'sleeps' between the redstone lines is set extreemly low, try 1 second instead of 0.01

I may be wrong about this, but I believe that the lowest possible sleep time is 0.05 because that is the rate of a tick.

I noticed in your program that you wait for clicks at x=1, y=4, which corresponds to a blank space. Did you mean to write 4,1 instead?

Yes thank, I inversed X and Y but I can't click too. I imported an other program which work on others servers but I can't interact with the monitor. Which key must I use ?
Bubba #5
Posted 03 March 2013 - 12:18 PM
Well for a start your 'sleeps' between the redstone lines is set extreemly low, try 1 second instead of 0.01

I may be wrong about this, but I believe that the lowest possible sleep time is 0.05 because that is the rate of a tick.

I noticed in your program that you wait for clicks at x=1, y=4, which corresponds to a blank space. Did you mean to write 4,1 instead?

Yes thank, I inversed X and Y but I can't click too. I imported an other program which work on others servers but I can't interact with the monitor. Which key must I use ?

You should be right clicking on the monitor.
Senmori #6
Posted 03 March 2013 - 02:39 PM
The way you've set up where you click is on exactly one pixel.

	  if x1 == X and y1 == Y then
That says that 'bip()' will only occur if those exact coordinates are activated.

You're better off putting a set of coordinates inside the 'key' function.
Like so:

function key1(x1, x2, y1, y2)
event, side, X, Y = os.pullEventRaw()
  if event == "monitor_touch" then
	  if (x1 <= X and x2 >= X and y1 <= Y and y2 >= Y) then
		bip()
	  else
		bop()
	  end
  else

  end
end
--Other code here
while true do
  key1(2, 6, 1, 3)
end
SheepWithNoWool #7
Posted 04 March 2013 - 02:39 AM
The way you've set up where you click is on exactly one pixel.

	  if x1 == X and y1 == Y then
That says that 'bip()' will only occur if those exact coordinates are activated.

You're better off putting a set of coordinates inside the 'key' function.
Like so:

function key1(x1, x2, y1, y2)
event, side, X, Y = os.pullEventRaw()
  if event == "monitor_touch" then
	  if (x1 <= X and x2 >= X and y1 <= Y and y2 >= Y) then
		bip()
	  else
		bop()
	  end
  else

  end
end
--Other code here
while true do
  key1(2, 6, 1, 3)
end

Okay thank you I'll try and I'll say you the results !
tesla1889 #8
Posted 04 March 2013 - 08:55 PM
just so you all know, sleep can be called with any number

the time the computer actually yields will be at least that number

you can even call sleep with negative numbers

so, if the minimum time in a tick is 0.05, calling sleep with 0.01 will be the same as calling sleep with 0.05

if you dont believe me, ive been running a

while true do
sleep(-1)
end
loop the entire time i was writing this post