CatchEvent OnLapperStart() GlobalVar $LightIndex; GlobalVar $LightIndentifier; GlobalVar $LightAction; GlobalVar $LightColor; GlobalVar $StartLights; GlobalVar $LightID; $LightIndex = 149; $LightIndentifier = 0; $LightAction = 5; EndCatchEvent CatchEvent OnMSO( $userName, $text ) # Player event $idxOfFirtsSpace = indexOf( $text, " "); IF( $idxOfFirtsSpace == -1 ) THEN $command = $text; $argv = ""; ELSE $command = subStr( $text,0,$idxOfFirtsSpace ); $argv = trim( subStr( $text,$idxOfFirtsSpace ) ); ENDIF SWITCH( $command ) CASE "!slid": #Set State LightID StartLightsControl($userName); BREAK: CASE "!clid": #Check State LightID IF ($argv != "") THEN $LightID = $argv; IF ($StartLights[ToNum($LightID)] != "") THEN privmsg("Current State of LightID [^7".$LightID. "^8] = ".$StartLights[ToNum($LightID)]); ELSE privmsg("LightID ^3" .$argv. " ^8is not set"); ENDIF ELSE privmsg("^1ERROR: ^7Enter LightID"); ENDIF BREAK: ENDSWITCH EndCatchEvent Sub StartLightsControl($userName) openPrivButton( "l1",140,80,10,5,5,-1,16, "^0Index:"); openPrivButton( "l2",150,80,13,5,5,-1,16, "^0Indentifier:"); openPrivButton( "l3",163,80,16,5,5,-1,16, "^0Set/Reset:"); openPrivButton( "l4",179,80,21,5,5,-1,16, "^0Set Light:"); openPrivButton( "lclose",140,90,59,5,5,-1,16, "^1CLOSE",CloseBar); openPrivTextButton( "l11",140,85,10,5,10,16,"^7Set Index ( 149 or 240 )","^0Set (".$LightIndex.")",3,SetIndex); openPrivTextButton( "l21",150,85,13,5,10,16,"^7Set Indentifier (0 to 63 or 255 = all) ","^0Set (".$LightIndentifier.")",3,SetIndentifier); openPrivTextButton( "l31",163,85,16,5,10,16,"^74 = Reset / 5 = Set / 6 = Unset ","^0Set/Reset (".$LightAction.")",1,SetAction); openPrivButton( "l40",179,85,5,5,5,-1,16, "^0 OFF",SetLightOFF); openPrivButton( "l41",184,85,5,5,5,-1,16, "^1^H ¢g¢g¢g",SetRedLight); openPrivButton( "l42",189,85,5,5,5,-1,16, "^3^H ¢g¢g¢g",SetAmberLight); openPrivButton( "l43",194,85,5,5,5,-1,16, "^2^H ¢g¢g¢g",SetGreenLight); EndSub Sub SetIndex( $id, $argv ) $LightIndex = $argv; StartLightsControl($userName); EndSub Sub SetIndentifier( $id, $argv ) $LightIndentifier = $argv; StartLightsControl($userName); EndSub Sub SetAction( $id, $argv ) $LightAction = $argv; StartLightsControl($userName); EndSub Sub SetLightOFF($KeyFlags,$id ) #Turn Off LightID $LightID = $LightIndentifier; $StartLights[ToNum($LightID)] = "^0OFF"; startlightcontrol($LightAction,$LightIndex,$LightIndentifier,0); EndSub Sub SetRedLight($KeyFlags,$id ) #Set LightID to RedLight $LightID = $LightIndentifier; $StartLights[ToNum($LightID)] = "^1Red"; startlightcontrol($LightAction,$LightIndex,$LightIndentifier,1); EndSub Sub SetAmberLight($KeyFlags,$id )#Set LightID to AmberLight $LightID = $LightIndentifier; $StartLights[ToNum($LightID)] = "^3Amber"; startlightcontrol($LightAction,$LightIndex,$LightIndentifier,2); EndSub Sub SetGreenLight($KeyFlags,$id )#Set LightID to GreenLight $LightID = $LightIndentifier; $StartLights[ToNum($LightID)] = "^2Green"; startlightcontrol($LightAction,$LightIndex,$LightIndentifier,8); EndSub Sub CloseBar($KeyFlags,$id ) ClosePrivButton("l1&l2&l3&l4&lclose&l11&l21&l31&l40&l41&l42&l43"); EndSub