Jump to content




Click between lines


  • You cannot reply to this topic
13 replies to this topic

#1 svdragster

  • Members
  • 222 posts
  • LocationGermany

Posted 14 April 2013 - 08:06 AM

local done = false
while not done do
	local event, x, y = os.pullEvent("mouse_click")
	if (x >= 14) and (x <= 20) and ((y <= 2) and (y >= 4)) then
	 play()
	 done = true
	end
end

Doesn't work. What now?

#2 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 14 April 2013 - 08:28 AM

Done is false. You are using a double negative, the loop never occurs..

#3 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 14 April 2013 - 08:30 AM

Well...
y = 4 
Your if statement of the y values is saying this:
If y is 2 or LESS AND y is 4 or MORE then continue

Which isn't possible :P
If you wanted it to be if y is 3, use and y == 3.

Also brackets aren't required for that if :)Edit: wow when I type the y parts of his if statement not the full thing comes out. I'm getting so annoyed with this -_-Edited it like 6 times with no success

#4 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 14 April 2013 - 08:33 AM

You also miss the button arg for mouse_click so x will always be -1 or 1

local event, button,x,y = os.pullEvent("mouse_click")

#5 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 14 April 2013 - 08:38 AM

View PostSuicidalSTDz, on 14 April 2013 - 08:28 AM, said:

Done is false. You are using a double negative, the loop never occurs..

No.
While not done do
Is the same as
While done == false do

And yeah you missed the button argument :]

#6 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 14 April 2013 - 08:41 AM

View PostremiX, on 14 April 2013 - 08:38 AM, said:

View PostSuicidalSTDz, on 14 April 2013 - 08:28 AM, said:

Done is false. You are using a double negative, the loop never occurs..

No.
Ok, I didn't see the not part. *stupid phone*

#7 svdragster

  • Members
  • 222 posts
  • LocationGermany

Posted 14 April 2013 - 08:45 AM

Posted ImageSo how else can I make a huge clickable button? ^^
Btw I'm using the brackets just to read it better

#8 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 14 April 2013 - 08:46 AM

View PostSuicidalSTDz, on 14 April 2013 - 08:41 AM, said:

View PostremiX, on 14 April 2013 - 08:38 AM, said:

View PostSuicidalSTDz, on 14 April 2013 - 08:28 AM, said:

Done is false. You are using a double negative, the loop never occurs..

No.
Ok, I didn't see the not part. *stupid phone*

O_o then where did you get the double negative explanation from?Yeah phones on these forums are a pain!

Edit: try changing the signs of where your y values to the oppisite. < To > and > to < and it should work for the first button

#9 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 14 April 2013 - 08:49 AM

View Postsvdragster, on 14 April 2013 - 08:45 AM, said:

Spoiler
So how else can I make a huge clickable button? ^^
Btw I'm using the brackets just to read it better

I have made a tutorial on this: http://www.computerc...-buttons-in-cc/

I love legal advertisement :P

#10 SuicidalSTDz

    Permutator of Strings

  • Members
  • 1,308 posts
  • LocationPennsylvania

Posted 14 April 2013 - 08:49 AM

View PostremiX, on 14 April 2013 - 08:46 AM, said:

View PostSuicidalSTDz, on 14 April 2013 - 08:41 AM, said:

View PostremiX, on 14 April 2013 - 08:38 AM, said:

View PostSuicidalSTDz, on 14 April 2013 - 08:28 AM, said:

Done is false. You are using a double negative, the loop never occurs..

No.
Ok, I didn't see the not part. *stupid phone*

O_o then where did you get the double negative explanation from?Yeah phones on these forums are a pain!
hmm, I guess it wouldn't be a double negative. What would the opposite be? :P

#11 svdragster

  • Members
  • 222 posts
  • LocationGermany

Posted 14 April 2013 - 08:56 AM

(y <= 2) and (y >= 4)

Finally understood that .... I always mix them


Correct one:
(y >= 2) and (y <= 4)

God dangit

#12 svdragster

  • Members
  • 222 posts
  • LocationGermany

Posted 14 April 2013 - 08:57 AM

View PostEngineer, on 14 April 2013 - 08:49 AM, said:

View Postsvdragster, on 14 April 2013 - 08:45 AM, said:

Spoiler
So how else can I make a huge clickable button? ^^
Btw I'm using the brackets just to read it better

I have made a tutorial on this: http://www.computerc...-buttons-in-cc/

I love legal advertisement :P

Guess where I always look stuff like this up :P
I used a tutorial like yours, but it didn't work so I posted it here >.<

#13 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 14 April 2013 - 09:03 AM

I see what you did wrong! :o
But I see remiX have answered it already:

View PostremiX, on 14 April 2013 - 08:46 AM, said:

Edit: try changing the signs of where your y values to the oppisite. < To > and > to < and it should work for the first button

That is the solution :P

#14 svdragster

  • Members
  • 222 posts
  • LocationGermany

Posted 14 April 2013 - 09:10 AM

Yep :P
But I just understood it right now xD





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users