35 posts
Posted 10 April 2014 - 06:52 PM
Can u help me pls
here is ma code:
term.clear()
dock = paintutils.loadImage ("dock")
paintutils.drawImage (dock, 1, 1)
term.setCursorPos (1,1)
print ("randomtexthere")
term.setCursorPos (43,1)
local time = os.time()
time = textutils.formatTime (time, false)
print (""..time) —yea i know it works with that
while true do —-LINE 14
local event, button, X, Y = os.pullEvent ("mouse_click")
XY = X..","..Y
if XY == "1,1" and button == 1 then
—-This section is work in progress and only has print ("WIP") happening 5 times
break
end
that code gives me this error
bios:366: [string 'desktop"]:25: 'end' expected (to close 'while' at line 14)
if anyone really cares,I was trying to make so when i click on the osname a menu appears where there is shutdown and restart with that stuff
(yea osname is on 1,1 on the dock which is on 1,1)
Edited on 10 April 2014 - 04:59 PM
571 posts
Location
Some Fish Bowl in Ohio.
Posted 10 April 2014 - 07:06 PM
You need ends to close while loops.
Edited on 10 April 2014 - 05:08 PM
35 posts
Posted 10 April 2014 - 07:33 PM
Oh,Anyways,Can i have a code that when i click 1,1 it does paintutils stuff,I just dont get the tutorials at all
All i want to happen is when i click 1,1 with left button that
this commands execute
menu1 = paintutils.loadImage ("menu")
paintutils.drawImage (menu1, 1, 1)
pls anyone (idk how to program the on click thnigs)
1281 posts
Posted 10 April 2014 - 07:41 PM
You've already done it. What you posted, even though its a strange way of doing it, should work if you fix the end error and add in the paintutils stuff.
1852 posts
Location
Sweden
Posted 10 April 2014 - 08:02 PM
As said by CometWolf you have already done it and it's kinda a strange way of doing it
Here's a way of doing it
while true do
local event, p1, mX, mY = os.pullEvent( "mouse_click" )
if p1 == 1 then -- Check if it was a left click
if mX == 1 and mY == 1 then -- Check if the positions are 1,1
-- Your code here when it have been clicked
end
end
end
35 posts
Posted 11 April 2014 - 12:40 PM
oh tnx all.I tried this and,it works! (modified code a bit cus im too lazy to write mX instead of X
:D/> if u care.MY OS developtment stage is desktop and clickable buttons
event, button, x, y = os.pullEvent(“mouse_click”)
if button == 1 and x == 1 and y == 1 then
menu = paintutils.loadImage ("system/images/menu")
paintutils.drawImage (menu, 1, 1)
end
event, button, x, y = os.pullEvent(“mouse_click”)
if button == 1 and x == 1 and y == 3 then
window-s = paintutils.loadImage ("system/images/smallwindow.sys)
paintutils.drawImage (window-s, 23, 6)
term.setCursorPos (23,8)
print ("Shutdown commencing in 5 seconds")
sleep (5)
os.shutdown()
end
Edited on 11 April 2014 - 10:42 AM
571 posts
Location
Some Fish Bowl in Ohio.
Posted 11 April 2014 - 01:52 PM
Kinda necroing, but the error:
bios:366: [string 'desktop"]:25: 'end' expected (to close 'while' at line 14)
Is pretty straight forward.
3790 posts
Location
Lincoln, Nebraska
Posted 11 April 2014 - 03:42 PM
Hate to be THAT guy…but I think we'd all appreciate if you use proper(ish) grammar and spelling in your posts. You're not garnering much support when you type as if you're too lazy to take the time to fill out your sentences.
More people are willing to help you if you're taking the time to at least use full words and sentences. Obviously we're understandable with minor spelling/grammar mistakes, but do at least try to type like you know some of the English language please.
7508 posts
Location
Australia
Posted 11 April 2014 - 03:59 PM
More people are willing to help you if you're taking the time to at least use full words and sentences.
I believe I have a very fitting quote in my signature for this ;)/>