Last active
December 28, 2018 18:32
-
-
Save PhilipRosedale/aa66fd7e71485bd052a4eb74584773ab to your computer and use it in GitHub Desktop.
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
// | |
// tipJar.js | |
// | |
// Users can click on the entity attached to this script to pay | |
// a user 10 HFC. | |
// | |
// Copyright 2018 High Fidelity, Inc. | |
// | |
// Distributed under the Apache License, Version 2.0. | |
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html | |
// | |
(function() { | |
// This is the username that the user will send money to. | |
// Be sure to change this to your desired username! | |
var DESTINATION_USERNAME = "philip"; | |
// The amount of HFC that the user will send. | |
var HFC_AMOUNT = 42; | |
// The message displayed to the user when they click the entity. | |
var MONEY_MESSAGE = "Help me build a humble place for myself in the metaverse."; | |
var TipJar = function() { | |
}; | |
// This function will open a user's tablet and prompt them to pay for VIP status. | |
var promptToTip = function doTip() { | |
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); | |
tablet.loadQMLSource("hifi/commerce/common/sendAsset/SendAsset.qml"); | |
tablet.sendToQml({method: 'updateSendAssetQML', | |
assetCertID: "", | |
amount: HFC_AMOUNT, | |
username: DESTINATION_USERNAME, | |
message: MONEY_MESSAGE | |
}); | |
} | |
TipJar.prototype = { | |
clickDownOnEntity: function(entityID, mouseEvent) { | |
// When the user running this script clicks the attached entity with their mouse, | |
// call this function. | |
promptToTip(); | |
}, | |
startFarTrigger: function() { | |
// When the user running this script clicks the attached entity with | |
// their hand controller lasers, call this function. | |
promptToTip(); | |
} | |
}; | |
return new TipJar(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment