I am an extra-life charity team member and we have been trying for several years to be able to track our donations similar to other resources available. it seems this year the xsplit users have finally gotten this to work, but the function does not appear to be available in obs, yet.
it seem you can add custom scripting to a remote url in the xsplit text editor. here is the code the folks are using to snag the donation data. Can this be quickly added to existing resources or could someone make a new one? the Extra-Life OBS user community would LOVE IT!!!!!
it seem you can add custom scripting to a remote url in the xsplit text editor. here is the code the folks are using to snag the donation data. Can this be quickly added to existing resources or could someone make a new one? the Extra-Life OBS user community would LOVE IT!!!!!
Code:
/*
The script will check the local file for any changes in text every [UPDATEINTERVAL] milliseconds
which will automatically update the text within the stage.
Setting it to 0 or lower disables auto-update.
*/
/**
* @name URLTOLOAD
* @label Participant ID
* @type text
* @description The numbers at the end of your extra-life donation page
*/
var URLTOLOAD = "91438";
/**
* @name DISPLAYLASTDONOR
* @label Display Previous Donor
* @type boolean
* @description Optional. Will attempt to display the previous donor and what they donated.
*/
var DISPLAYLASTDONOR = true;
/*Do not modify anything below*/
// ^---this person is not the boss of you.
var oldResponse;
var thanksText;
var thanksCount = 1;
var exclamatories = ["WOW!", "AWESOME!", "SWEET!", "OMG!", "THANKS!", "COOL!", "ROCK ON!"];
var DELIMETER_1 = "actualAmount=";
var DELIMETER_2 = "&goal";
var DELIMETER_3 = "<strong class=\"block\">";
var DELIMETER_4 = "</strong>";
var UPDATEINTERVAL = 30;
function GetTextFromRemote() {
$.ajax({
url: "http://www.extra-life.org/index.cfm?fuseaction=donorDrive.participantDonations&participantID=" + URLTOLOAD,
type: "GET",
dataType: "text",
complete: function () {
if (UPDATEINTERVAL > 0)
smlTitleTimeouts = setTimeout(function () { GetTextFromRemote(); }, UPDATEINTERVAL * 1000);
},
success: function (response) {
var responseCleaned = response.replace(/(\r\n|\n|\r)/gm, " ");
var totalDollars = "";
var lastDonor = "";
var currentResponse = "";
if (DELIMETER_1 != "" && DELIMETER_2 != "") {
totalDollars = "$" + getDesiredString(responseCleaned, DELIMETER_1, DELIMETER_2);
}
if (DISPLAYLASTDONOR && DELIMETER_3 != "" && DELIMETER_4 != "") {
lastDonor = getDesiredString(responseCleaned, DELIMETER_3, DELIMETER_4) + "!";
}
//now that data has been parsed from the response, let's format the text to display based on the user's settings.
if (!DISPLAYLASTDONOR) {
currentResponse = totalDollars;
}
if (DISPLAYLASTDONOR) {
currentResponse = totalDollars + " raised so far! " + exclamatories[thanksCount] + " " + lastDonor;
}
if (oldResponse != currentResponse) {
thanksCount++;
if (thanksCount == exclamatories.length) {
thanksCount = 0;
}
SetText(currentResponse.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), "Remote URL: " + URLTOLOAD);
}
oldResponse = currentResponse;
}
});
}
//this function takes the entire page, the string that leads up to the string you want, and the string that comes after the string you want.
function getDesiredString(text, startString, endString) {
var responseCleanedLength = text.length;
var indexOfDelim1 = text.indexOf(startString) > -1 ? (text.indexOf(startString) + startString.length) : 0;
var substringResponseCleaned = text.substring(indexOfDelim1);
var substringResponseCleanedLength = substringResponseCleaned.length;
var initialIndexOfDelim2 = substringResponseCleaned.indexOf(endString) > -1 ? substringResponseCleaned.indexOf(endString) : responseCleanedLength;
var indexOfDelim2 = responseCleanedLength;
if (initialIndexOfDelim2 != responseCleanedLength) {
indexOfDelim2 = initialIndexOfDelim2 + (responseCleanedLength - substringResponseCleanedLength);
}
if (indexOfDelim2 <= indexOfDelim1)
indexOfDelim2 = text.length - 1;
return text.substring(indexOfDelim1, indexOfDelim2).trim().replace(" ", " ");
}
GetTextFromRemote();