Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- //Alezia Kurdis, July 2018.
- var APP_NAME = "DOM NAV";
- var APP_URL = "http://mpassets.highfidelity.com/7aa9e823-1f3a-4001-b36a-8a51081f7990-v1/dom_nav.html";
- var APP_ICON = "http://mpassets.highfidelity.com/7aa9e823-1f3a-4001-b36a-8a51081f7990-v1/dom_nav_icon.png";
- var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
- var button = tablet.addButton({
- text: APP_NAME,
- icon: APP_ICON
- });
- function clicked(){
- var AvatarPosition = MyAvatar.position;
- tablet.gotoWebScreen(APP_URL + "?x=" + Math.round(AvatarPosition.x) + "&y=" + Math.round(AvatarPosition.y) + "&z=" + Math.round(AvatarPosition.z));
- }
- button.clicked.connect(clicked);
- function onWebEventReceivedz(eventz){
- if(typeof eventz === "string"){
- eventzget = JSON.parse(eventz);
- if(eventzget.type === "give_tp_coor"){
- //print("X: " + eventzget.x);
- //print("Y: " + eventzget.y);
- //print("Z: " + eventzget.z);
- var myVec = {
- x: parseFloat(eventzget.x),
- y: parseFloat(eventzget.y),
- z: parseFloat(eventzget.z)
- };
- MyAvatar.goToLocation(myVec, false);
- }
- if(eventzget.type === "look_to_north"){
- //print("Look at North!")
- MyAvatar.goToLocation(MyAvatar.position, true,{ x: 0, y: 0, z: 0, w:1 },false);
- }
- if(eventzget.type === "look_to_south"){
- //print("Look at South!")
- MyAvatar.goToLocation(MyAvatar.position, true,{ x: 0, y: 1, z: 0, w:0 },false);
- }
- if(eventzget.type === "look_to_west"){
- //print("Look at West!")
- MyAvatar.goToLocation(MyAvatar.position, true,{ x: 0, y: 0.7071068, z: 0, w:0.7071068 },false);
- }
- if(eventzget.type === "look_to_east"){
- //print("Look at East!")
- MyAvatar.goToLocation(MyAvatar.position, true,{ x: 0, y: 0.7071068, z: 0, w:-0.7071068 },false);
- }
- }
- }
- tablet.webEventReceived.connect(onWebEventReceivedz);
- function cleanup() {
- tablet.removeButton(button);
- }
- Script.scriptEnding.connect(cleanup);
- }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement