I'm a script newbie but had great fun writing a script to beep when the mobster was available for pickpocketing.
Now I've got that UO I was wondering about how to script to pick up the UO on shoplifting - I'm assuming it's possible to scan for the star that indicates the UO is available - but I can't test for what I'm searching for as I can't see any stars, and whereas the last script searched for a string on the rendered page this one will have to search the page source for the correct string to match...
Does anybody have any pointers - this is the script I used for the mobster BTW:
const keyword = "Mobster"; // Replace with the word you want to track
// Function to play a beep sound
function playBeep() {
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
const oscillator = audioContext.createOscillator();
oscillator.type = "sine"; // Type of sound wave (sine, square, etc.)
oscillator.frequency.setValueAtTime(440, audioContext.currentTime); // Frequency in Hz (440 Hz = "A" note)
oscillator.connect(audioContext.destination);
oscillator.start();
oscillator.stop(audioContext.currentTime + 0.2); // Play the sound for 0.2 seconds
}
// Check for the keyword on the page
setInterval(() => {
if (document.body.innerText.includes(keyword)) {
playBeep(); // Play beep sound
//alert(`Keyword "${keyword}" detected!`); // Optional: Show an alert box
}
}, 5000); // Check every 5 seconds