StDoodle's safe_logout.ash

StDoodle

Minion
This is a simple logout script for the paranoid speeder who wants to make sure they've consumed to full and maximized their +adv at rollover gear before calling it a day.

A few settings can be changed by editing the script in your favorite text-editor; everything should be explained therein.

EDIT: Fixed per corrections by Grotfang & lostcalpolydude (thanks!)

EDIT 2: See first edit, but like, even more. Of said help. Yeah.
 

Attachments

  • safe_logout.ash
    2.5 KB · Views: 80
Last edited:

Grotfang

Developer
Correct me if I'm wrong, but shouldn't

Code:
cli_execute("maximize adv -familiar");

read

Code:
if( equip_rollover )
    cli_execute("maximize adv -familiar");
 

lostcalpolydude

Developer
Staff member
It doesn't complain if you didn't overdrink. Probably
Code:
if ((my_inebriety() < inebriety_limit()) && check_drinking) {
should be
Code:
if ((my_inebriety() < (inebriety_limit() + 1)) && check_drinking) {
 

Grotfang

Developer
Also, interesting fact, but user_confirm() can be used as a standalone function.

Interesting, given in that instance the pop up box is being used as exactly that, a pop up box (as opposed to a way to select one of two options...). Anyhoos, it's a REALLY minor point, but the line that reads:

Code:
ready = user_confirm(...);

Would be equally valid left as:

Code:
user_confirm(...);

Especially given you don't have any use for the return value.

EDIT:

In fact, you can cut out a fair few lines by not worrying about your boolean ready at all.

The line that currently reads:

Code:
if (! ready) {

Could read:

Code:
if( contains_text( alert , "." ) ) {

And you could then eliminate all of your ready references to the boolean. Sorry about the nitpicking. It's late and this is probably way too pedantic. It's a useful script, certainly. Thanks for posting!
 
Last edited:

lostcalpolydude

Developer
Staff member
I guess my previous suggestion doesn't quite work, because if my_inebriety() returns 0 it will tell you to drink when you can't. So it would need more logic for checking for 0 vs. 14 or 19.
 

StDoodle

Minion
Also, interesting fact, but user_confirm() can be used as a standalone function...

Yeah, I used to do something with the return value beyond that line of code, back when I thought it was possible to abort the logout. Not necessary anymore, but "meh"; this is just a tossed-together script to keep the feature-request monkeys off my back. :p

I guess my previous suggestion doesn't quite work, because if my_inebriety() returns 0 it will tell you to drink when you can't. So it would need more logic for checking for 0 vs. 14 or 19.

Dang it, more work! :p

Edit to add (didn't want to clutter the OP):

Added a check in the inebriety part to ignore if inebriety_limit is 0; got rid of the boolean "ready" and just checked that alert != ""

More edit:

Also, I was unaware until recently that ash didn't require { } for single-line if statements (er, after the "if"... you know what I mean), but I'm going to keep using such anyway; otherwise, I just know I'll go to add in an extra line of code somewhere, at some point, and end up breaking things. ;)
 
Last edited:

Grotfang

Developer
Also, I was unaware until recently that ash didn't require { } for single-line if statements (er, after the "if"... you know what I mean), but I'm going to keep using such anyway; otherwise, I just know I'll go to add in an extra line of code somewhere, at some point, and end up breaking things. ;)

Yeah... I do that a LOT :rolleyes:
 
Top