Jump to content




Why can't click on shutdown [SOLVED!]

api utility computer

9 replies to this topic

#1 danielsv03

  • Members
  • 66 posts
  • LocationMinecraft world

Posted 12 June 2017 - 07:30 PM

Hello so i'm trying to make my os better by including tables but i came across a problem i couldn't fix
so what it loads everything prints normally but restart button is the only thing that works when i click shutdown it dosen't do anything when it should shutdown


code
function dropmenu1()
local menu1= {
["----------"] = {tcol = "green"; x = 1; xx = 11; y = 18; cmd = function() end};
[" Restart  "] = {tcol = "green"; x = 1; xx = 11; y = 15; cmd = function() os.reboot() end};
[" Shutdown "] = {tcol = "green"; x = 1; xx = 11; y = 16; cmd = function() os.shutdown() end};
--[" Restart  "] = {tcol = "green"; x = 1; xx = 11; y = 15; cmd = function() os.reboot() end};
["----------"] = {tcol = "green"; x = 1; xx = 11; y = 14};
[" Start	"] = {tcol = "green"; x = 1; xx = 11; y = 13};
}
for v,k in pairs(menu1) do
  term.setCursorPos(k.x, k.y)
  print(v)
end
  for k,v in pairs(menu1) do
   e = {os.pullEvent()}
				if e[1] == "mouse_click" then
						if e[2] == 1 then
								if e[3] >= v.x and e[3] <= v.xx and e[4] == v.y then
										v.cmd()
										else slc = 1
										 --drawdesk()
								end
						end
				end
		end

end
dropmenu1()

can any one see anything wrong with it?
Thx

Edited by danielsv03, 14 June 2017 - 05:53 AM.


#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 12 June 2017 - 09:19 PM

I copy-pasted that code into CC and both buttons work. So I'm a bit confused.

#3 danielsv03

  • Members
  • 66 posts
  • LocationMinecraft world

Posted 13 June 2017 - 02:51 PM

View PostKingofGamesYami, on 12 June 2017 - 09:19 PM, said:

I copy-pasted that code into CC and both buttons work. So I'm a bit confused.

Wow well shutdown dosen't work for me

Ohh well nvm i know why now its because i have to click outside shutdown.. idk why

Do any one know why i have to click outside the text?

#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 13 June 2017 - 03:02 PM

Are you running this on a monitor? There is a bug which may be the culprit.

#5 danielsv03

  • Members
  • 66 posts
  • LocationMinecraft world

Posted 13 June 2017 - 03:10 PM

No i'm not i'm using the normal terminal btw can you click directly on the text for me i have too click outside of it

View PostKingofGamesYami, on 13 June 2017 - 03:02 PM, said:

Are you running this on a monitor? There is a bug which may be the culprit.

View Postdanielsv03, on 13 June 2017 - 03:10 PM, said:

No i'm not i'm using the normal terminal btw can you click directly on the text for me i have too click outside of it


#6 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 13 June 2017 - 04:22 PM

I was actually able to reproduce the problem just now. It seems resizing the minecraft window does something screwey. I'm using the latest version of CC so that may be the problem.

It's not a problem with your script though. This is a computercraft bug which you have no control over.

#7 danielsv03

  • Members
  • 66 posts
  • LocationMinecraft world

Posted 13 June 2017 - 04:24 PM

View PostKingofGamesYami, on 13 June 2017 - 04:22 PM, said:

I was actually able to reproduce the problem just now. It seems resizing the minecraft window does something screwey. I'm using the latest version of CC so that may be the problem.

It's not a problem with your script though. This is a computercraft bug which you have no control over.

ohh well that weird. Because i tried another script that works just the same and it works fine

#8 danielsv03

  • Members
  • 66 posts
  • LocationMinecraft world

Posted 13 June 2017 - 05:27 PM

and if so is there an solution?

View PostKingofGamesYami, on 13 June 2017 - 04:22 PM, said:

I was actually able to reproduce the problem just now. It seems resizing the minecraft window does something screwey. I'm using the latest version of CC so that may be the problem.

It's not a problem with your script though. This is a computercraft bug which you have no control over.


#9 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 13 June 2017 - 08:21 PM

Move the event pulling out of the for loop. I completely missed that it was in there because your indentation is screwy, sorry.

#10 danielsv03

  • Members
  • 66 posts
  • LocationMinecraft world

Posted 14 June 2017 - 05:53 AM

View PostKingofGamesYami, on 13 June 2017 - 08:21 PM, said:

Move the event pulling out of the for loop. I completely missed that it was in there because your indentation is screwy, sorry.

Thank you so much!! it works now!
:D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users