38 lines
No EOL
857 B
JavaScript
38 lines
No EOL
857 B
JavaScript
var locations = ["room1", "room2", "room3", "room4", "room5"];
|
|
|
|
var curr = Settings.getValue("groupTPCurr", 0);
|
|
|
|
var channelOut = "GROUPTPCHAN";
|
|
|
|
function init() {
|
|
Controller.keyPressEvent.connect(keyPressEvent);
|
|
}
|
|
|
|
function keyPressEvent(event) {
|
|
event.text = event.text.toLowerCase();
|
|
if (event.text == "]") {
|
|
print("detected");
|
|
curr++;
|
|
if (locations.length - 1 < curr) {
|
|
curr = 0;
|
|
}
|
|
tp(locations[curr]);
|
|
}
|
|
if (event.text == "[") {
|
|
print("detected");
|
|
curr--;
|
|
if (curr < 0) {
|
|
curr = locations.length - 1;
|
|
}
|
|
tp(locations[curr]);
|
|
}
|
|
}
|
|
|
|
function tp(loc){
|
|
print("tp to: "+loc);
|
|
Settings.setValue("groupTPCurr", curr);
|
|
Menu.triggerOption(":"+loc);
|
|
Messages.sendMessage(channelOut,loc);
|
|
}
|
|
|
|
init(); |