Last active
June 16, 2021 17:01
-
-
Save Teqqles/6145c6e3b0f63947ca54881a094439a2 to your computer and use it in GitHub Desktop.
Custom SimHub serial device script for IR controlled flag lights. Written primarily for ACC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// property table | |
var propsFlagAssociation = [ | |
// property, flag short code | |
['GameRawData.Graphics.globalWhite', 'W'], | |
['Flag_White', 'W'], | |
['Flag_Green', 'G'], | |
['Flag_Orange', 'O'], | |
['Flag_Blue', 'B'], | |
['GameRawData.Graphics.globalYellow', 'Y'], | |
['Flag_Yellow', 'Y'], | |
['GameRawData.Graphics.globalRed', 'R'], | |
]; | |
var currentFlag = 'X'; // default to no flag | |
function currentFlagUpdater(flagAssociation) { | |
var flagPropName = flagAssociation[0], | |
flagCode = flagAssociation[1]; | |
if ($prop(flagPropName) > 0) { | |
currentFlag = flagCode; | |
} | |
} | |
for(var i=0; i<propsFlagAssociation.length; i++){ | |
currentFlagUpdater(propsFlagAssociation[i]); | |
} | |
return '{"flag":"' + currentFlag +'"}' + "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment