
-----------------------------------
RahulPatel23
Fri May 17, 2013 9:39 am

Keeping the lights on/off
-----------------------------------
What is it you are trying to achieve?
I have to simulate a program that would allow you to remotely turn on/off lights for my Computer Engineering culminating assignment.

This is my first semester coding so I apologize in advance for any stupid mistakes i make  :oops: 

Thanks in advance  :D 
What is the problem you are having?
Whenever I click to turn the lights on  they immediately reset to "off" 

Describe what you have tried to solve this problem
Tried removing various loops and cls's but thats about it.

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




for decreasing x : 5 .. 1 %puts in intro text
    locate (12, 25)
    put "Welcome to the Light Switcher."
    locate (13, 10)
    put "Click on the green or red areas to turn the lights on or off."
    locate (14,15)
    put "Click the yellow box to toggle the master power."
    locate (15, 17)
    put "Click on the red 'X' to quit the program."
    locate (16, 30)
    put "Please wait... ", x
    delay (1000)
    cls
end for

View.Set ("offscreenonly")
loop
    var x, y, button : int
    x := 0
    y := 0
    var livingcolour, bedcolour : int
    livingcolour := 118
    bedcolour := 113
    Mouse.Where (x, y, button)
    if x >= 50 and x = 30 and y = 300 and x = 30 and y = 560 and x = 130 and y = 560 and x = 30 and y = 50 and x = 30 and y = 50 and x = 30 and y = 300 and x = 30 and y = 300 and x = 30 and y = 560 and x = 130 and y = 560 and x = 130 and y = 560 and x = 130 and y = 560 and x = 130 and y = 560 and x = 30 and y 