Sounds and Alerts in ASH Scripts and CLI

Saklad5

Member
Is there a way to trigger a beep or other feedback in scripts? I’m thinking along the lines of
Code:
tput bel
in ncurses. It would be very helpful to know when a script finishes or needs my attention.

I know there is a setting to make KoLmafia beep when you receive a message in chat. This is the same sort of thing.
 

Pazleysox

Member
Is there a way to trigger a beep or other feedback in scripts? I’m thinking along the lines of
Code:
tput bel
in ncurses. It would be very helpful to know when a script finishes or needs my attention.

I know there is a setting to make KoLmafia beep when you receive a message in chat. This is the same sort of thing.

If you can make chat beep, why not just send yourself a private message?
 

Saklad5

Member
I suppose that is possible, but that would be a really crude way of doing it. Is there really no other option?
 

Crowther

Active member
Write it yourself and submit a patch or convince someone that this is interesting enough to them to get them to implement it.

If there was a patch to allow scripts to make an audible bell, I would quickly disable it on my local compile.
 

Saklad5

Member
Certain scripts take a while to run, and it is inconvenient to have to check it repeatedly to see if everything is done. It’d be even better if it could send HTTP packets or run a user-defined program (the way you can currently set a text editor and a web browser) so I could have proper alerts, but that seems well beyond the scope of KoLmafia.

I see no reason that this sort of behavior would have to be enabled by default, by the way. I propose implementing it as an ASH function that returns a boolean: true if the beep was successful, false if such behavior is disabled.
 

fronobulax

Developer
Staff member
inconvenient

That word is coming perilously close to "annoying" as a word that signals a sense of entitlement that is going get me to ignore a request.

You have a means of getting what you want which you have dismissed as "too crude".

Write it yourself and submit a patch or convince someone that this is interesting enough to them to get them to implement it.

That still seems like the best advice since you have not convinced me it is worth my time and no other dev has seen fit to comment.

Since I don't speak ncurses, what exactly are you looking for? An ash command that causes a single beep? A KoLmafia preference that detects when a script stops running and emits a beep? Something else?
 

ckb

Minion
Staff member
Certain scripts take a while to run, and it is inconvenient to have to check it repeatedly to see if everything is done. It’d be even better if it could send HTTP packets or run a user-defined program

perhaps a clever use of visit_url() will get you what you want?
 

Saklad5

Member
I tried that almost immediately, but it seems like it operates under the assumption that the URL is (URL pointing to KoLmafia relay local server)/(input). I might have misunderstood the documentation, though: I’ll revisit it and see if I can get Pushover notifications working. I think a command to produce a beep would still be welcome, though.

Edit:

OK, I managed to get that working, (thanks for the advice that prompted me to check again) which is quite useful for my own purposes. Not everyone is familiar with using APIs like that, however.
 
Last edited:

Saklad5

Member
“tput bel” is a command included with practically every UNIX-like OS, and it simply makes the terminal produce a bell noise. I actually had to look up what it is from, since I am not familiar with ncurses either.

As for your comment about “inconvenient”, that’s actually the opposite of what I am trying to say when I use the word. I’m trying to make it clear that I do not consider this an essential feature, and I do not expect it to be treated as such. Sorry for the miscommunication.

There’s nothing wrong with rejecting a request, by the way. I am suggesting it because I would like to see it, I feel it is within the scope of the project, and no one else has suggested it. This is a request, not a demand. If you do reject this, the project is better for it having been proposed: it will prevent others from suggesting this in the future, since it has already been discussed.

As for being worth a dev’s time, I could still write a patch once it is clear it would be accepted. It would just be time-consuming for me to test this on multiple systems (as opposed to multiple people testing it on their own systems), so I’d rather not commit to that before debating its merits.

And yes, I feel that generating a substantial queue of unread messages from myself to myself is not an ideal solution. I might try it, but it would be better to have a specific command. Especially for those that do not want chat messages to beep.
 
Last edited:

ckb

Minion
Staff member
I tried that almost immediately, but it seems like it operates under the assumption that the URL is (URL pointing to KoLmafia relay local server)/(input). I might have misunderstood the documentation, though: I’ll revisit it and see if I can get Pushover notifications working. I think a command to produce a beep would still be welcome, though.

This worked for me
Code:
ash visit_url("http://kolmafia.us/showthread.php?22775-Sounds-and-Alerts-in-ASH-Scripts-and-CLI")
 
Top