SHOW:
|
|
- or go back to the newest paste.
| 1 | --mMultiOS | |
| 2 | --<~t<true>marcelOS<info<0||name<0|explorer>version<1|0.2>changePrint<2|false>eventfilter<0|internet|mouse_click|window_resize|window_fullscreen>EventManager<3|true>Debug<3|true>>code<0|print("Hello, explorer run under marcelOS")>>other<info<0||name<0|explorer>version<2|0.2>>code<0|~i<23>print("Unknown OS ...")>>>
| |
| 3 | Application.window = windows.CreateWindow( "LightSystem" , Application , true) | |
| 4 | Application.window:SetSize(100,49) | |
| 5 | Application.window:FindSpace(111) | |
| 6 | -- denk drann beim Server in der 2ten Zeile beim eventfilter "internet" drinnen zu haben, andernfalls bekommt er keine internet events... | |
| 7 | ||
| 8 | function Rahmen() | |
| 9 | local streifen = string.rep("-",Application.window.width)
| |
| 10 | function Legende() | |
| 11 | Application.window:writePos(1,1,"Room") | |
| 12 | Application.window:writePos(15,1,"Light 1") | |
| 13 | Application.window:writePos(25,1,"Light 2") | |
| 14 | Application.window:writePos(35,1,"Door 1") | |
| 15 | Application.window:writePos(51,1,"Door 2") | |
| 16 | ||
| 17 | end | |
| 18 | ||
| 19 | function ComputerraumRahmen() | |
| 20 | Application.window:writePos(1,3,"Computerraum:") | |
| 21 | ||
| 22 | Application.window:writePos(15,3,"On",colors.white,colors.green) | |
| 23 | Application.window:writePos(19,3,"Off",colors.white,colors.red) | |
| 24 | ||
| 25 | Application.window:writePos(25,3,"On",colors.white,colors.green) | |
| 26 | Application.window:writePos(29,3,"Off",colors.white,colors.red) | |
| 27 | ||
| 28 | Application.window:writePos(35,3,"Open",colors.white,colors.green) | |
| 29 | Application.window:writePos(40,3,"Close",colors.white,colors.red) | |
| 30 | Application.window:writePos(46,3,"Go",colors.black,colors.yellow) | |
| 31 | ||
| 32 | Application.window:writePos(51,3,"Open",colors.white,colors.green) | |
| 33 | Application.window:writePos(56,3,"Close",colors.white,colors.red) | |
| 34 | Application.window:writePos(62,3,"Go",colors.black,colors.yellow) | |
| 35 | end | |
| 36 | ||
| 37 | function ServerraumRahmen() | |
| 38 | Application.window:writePos(1,5,"Serverraum:") | |
| 39 | ||
| 40 | Application.window:writePos(15,5,"On",colors.white,colors.green) | |
| 41 | Application.window:writePos(19,5,"Off",colors.white,colors.red) | |
| 42 | ||
| 43 | Application.window:writePos(25,5,"On",colors.white,colors.green) | |
| 44 | Application.window:writePos(29,5,"Off",colors.white,colors.red) | |
| 45 | ||
| 46 | Application.window:writePos(35,5,"Open",colors.white,colors.green) | |
| 47 | Application.window:writePos(40,5,"Close",colors.white,colors.red) | |
| 48 | Application.window:writePos(46,5,"Go",colors.black,colors.yellow) | |
| 49 | ||
| 50 | Application.window:writePos(51,5,"Open",colors.white,colors.green) | |
| 51 | Application.window:writePos(56,5,"Close",colors.white,colors.red) | |
| 52 | Application.window:writePos(62,5,"Go",colors.black,colors.yellow) | |
| 53 | end | |
| 54 | ||
| 55 | function TekkitraumRahmen() | |
| 56 | Application.window:writePos(1,7,"Tekkitraum:") | |
| 57 | ||
| 58 | Application.window:writePos(15,7,"On",colors.white,colors.green) | |
| 59 | Application.window:writePos(19,7,"Off",colors.white,colors.red) | |
| 60 | ||
| 61 | Application.window:writePos(25,7,"On",colors.white,colors.green) | |
| 62 | Application.window:writePos(29,7,"Off",colors.white,colors.red) | |
| 63 | ||
| 64 | Application.window:writePos(35,7,"Open",colors.white,colors.green) | |
| 65 | Application.window:writePos(40,7,"Close",colors.white,colors.red) | |
| 66 | Application.window:writePos(46,7,"Go",colors.black,colors.yellow) | |
| 67 | ||
| 68 | Application.window:writePos(51,7,"Open",colors.white,colors.green) | |
| 69 | Application.window:writePos(56,7,"Close",colors.white,colors.red) | |
| 70 | Application.window:writePos(62,7,"Go",colors.black,colors.yellow) | |
| 71 | end | |
| 72 | ||
| 73 | function LagerraumRahmen() | |
| 74 | Application.window:writePos(1,9,"Lagerraum:") | |
| 75 | ||
| 76 | Application.window:writePos(15,9,"On",colors.white,colors.green) | |
| 77 | Application.window:writePos(19,9,"Off",colors.white,colors.red) | |
| 78 | ||
| 79 | Application.window:writePos(25,9,"On",colors.white,colors.green) | |
| 80 | Application.window:writePos(29,9,"Off",colors.white,colors.red) | |
| 81 | ||
| 82 | Application.window:writePos(35,9,"Open",colors.white,colors.green) | |
| 83 | Application.window:writePos(40,9,"Close",colors.white,colors.red) | |
| 84 | Application.window:writePos(46,9,"Go",colors.black,colors.yellow) | |
| 85 | ||
| 86 | Application.window:writePos(51,9,"Open",colors.white,colors.green) | |
| 87 | Application.window:writePos(56,9,"Close",colors.white,colors.red) | |
| 88 | Application.window:writePos(62,9,"Go",colors.black,colors.yellow) | |
| 89 | end | |
| 90 | ||
| 91 | function Streifen() | |
| 92 | Application.window:writePos(1,2,streifen) | |
| 93 | Application.window:writePos(1,4,streifen) | |
| 94 | Application.window:writePos(1,6,streifen) | |
| 95 | Application.window:writePos(1,8,streifen) | |
| 96 | Application.window:writePos(1,10,streifen) | |
| 97 | Application.window:writePos(1,12,streifen) | |
| 98 | Application.window:writePos(1,14,streifen) | |
| 99 | Application.window:writePos(1,16,streifen) | |
| 100 | Application.window:writePos(1,18,streifen) | |
| 101 | Application.window:writePos(1,20,streifen) | |
| 102 | Application.window:writePos(1,22,streifen) | |
| 103 | Application.window:writePos(1,24,streifen) | |
| 104 | Application.window:writePos(1,26,streifen) | |
| 105 | Application.window:writePos(1,28,streifen) | |
| 106 | Application.window:writePos(1,30,streifen) | |
| 107 | Application.window:writePos(1,32,streifen) | |
| 108 | Application.window:writePos(1,34,streifen) | |
| 109 | Application.window:writePos(1,36,streifen) | |
| 110 | Application.window:writePos(1,38,streifen) | |
| 111 | Application.window:writePos(1,40,streifen) | |
| 112 | Application.window:writePos(1,42,streifen) | |
| 113 | Application.window:writePos(1,44,streifen) | |
| 114 | Application.window:writePos(1,46,streifen) | |
| 115 | Application.window:writePos(1,47,streifen) | |
| 116 | end | |
| 117 | ||
| 118 | Legende() | |
| 119 | Streifen() | |
| 120 | ComputerraumRahmen() | |
| 121 | ServerraumRahmen() | |
| 122 | TekkitraumRahmen() | |
| 123 | LagerraumRahmen() | |
| 124 | ||
| 125 | end | |
| 126 | ||
| 127 | ||
| 128 | ||
| 129 | ||
| 130 | function Eingabe() | |
| 131 | local event,side,x,y = os.pullEvent() | |
| 132 | ||
| 133 | Debug(event,tostring(side) .. " " .. tostring(x) .. " " .. tostring(y)) | |
| 134 | ||
| 135 | if event == "mouse_click" then | |
| 136 | ||
| 137 | --mouse_click ist bisher nur für Light 1 vorhanden | |
| 138 | ||
| 139 | ---ComputerraumStart | |
| 140 | if ((x == 15) and (y == 3)) or ((x == 16) and (y == 3)) then -- 1 = ID des Servers | |
| 141 | ip.SendMessage( nil, 1, nil, 100, nil , "ComputerraumLightOn" ) -- "ComputerraumLightOn" = die Message | |
| 142 | - | Eingabe() -- rednet.send(1, "ComputerraumLightOn") --Zahl= Id des Server |
| 142 | + | -- rednet.send(1, "ComputerraumLightOn") --Zahl= Id des Server |
| 143 | elseif ((x == 20) and (y == 3)) or ((x == 21) and (y == 3)) or ((x == 22) and (y == 3)) then -- 100 = Port des Servers, falls mehrere Programme gleichzeitig senden... | |
| 144 | ip.SendMessage( nil, 1, nil, 100, nil , "ComputerraumLightOff" ) | |
| 145 | ||
| 146 | --ComputerraumEnd | |
| 147 | ||
| 148 | ||
| 149 | ---ServerraumStart | |
| 150 | elseif ((x == 15) and (y == 5)) or ((x == 16) and (y == 5)) then | |
| 151 | ip.SendMessage( nil, 1, nil, 100, nil , "ServerraumLightOn" ) | |
| 152 | - | Eingabe() |
| 152 | + | |
| 153 | elseif ((x == 20) and (y == 5)) or ((x == 21) and (y == 5)) or ((x == 22) and (y == 3)) then | |
| 154 | ip.SendMessage( nil, 1, nil, 100, nil , "ServerraumLightOff" ) | |
| 155 | ||
| 156 | --ServerraumEnd | |
| 157 | ||
| 158 | ||
| 159 | ---TekkitraumStart | |
| 160 | elseif ((x == 15) and (y == 7)) or ((x == 16) and (y == 7)) then | |
| 161 | ip.SendMessage( nil, 1, nil, 100, nil , "TekkitraumLightOn" ) | |
| 162 | - | Eingabe() |
| 162 | + | |
| 163 | elseif ((x == 20) and (y == 7)) or ((x == 21) and (y == 7)) or ((x == 22) and (y == 7)) then | |
| 164 | ip.SendMessage( nil, 1, nil, 100, nil , "TekkitraumLightOff" ) | |
| 165 | ||
| 166 | --TekkitraumEnd | |
| 167 | ||
| 168 | ||
| 169 | ---LagerraumStart | |
| 170 | elseif ((x == 15) and (y == 9)) or ((x == 16) and (y == 9)) then | |
| 171 | ip.SendMessage( nil, 1, nil, 100, nil , "LagerraumLightOn" ) | |
| 172 | - | Eingabe() |
| 172 | + | |
| 173 | elseif ((x == 20) and (y == 9)) or ((x == 21) and (y == 9)) or ((x == 22) and (y == 9)) then | |
| 174 | ip.SendMessage( nil, 1, nil, 100, nil , "LagerraumLightOff" ) | |
| 175 | ||
| 176 | --LagerraumEnd | |
| 177 | ||
| 178 | end | |
| 179 | ||
| 180 | end | |
| 181 | end | |
| 182 | ||
| 183 | while true do | |
| 184 | Rahmen() | |
| 185 | - | Eingabe() |
| 185 | + | |
| 186 | Application.window:Paint() | |
| 187 | mTask.sleepEvent(Application,1) | |
| 188 | - | EventHandle() |
| 188 | + |