Working with numberology in scripts

Rax

New member
There's already excellent handling for numberology in the CLI, which I am trying to work it into my daily scripts as follows:

Code:
while (to_int(get_property("_universeCalculated")) < x)        {
        cli_execute("numberology yy");
        if (to_int(get_property("_universeCalculated")) < x)
            adv1($location[whereever], -1, "");                }

This may be a bit crude, but the intention is call numberology yy repeatedly for the number of calculate uses I have if yy is available, and otherwise to continue adventuring until yy becomes available. Currently, if yy is not available, mafia aborts the script so it cannot progress to the adventuring part. Is there either: 1) a way to handle the error in mafia so it can continue the loop or 2) access the CLI "numberology ?" output so that I can have the script check whether yy is available before it tries to execute it?

This is currently tripping me up as I don't have a lot of RL time to intervene if the script fails, nor do I want to waste the numberology resource because I can't figure out how to automate it. Can anyone help?
 
Last edited:

ckb

Minion
Staff member
You can use reverse_numberology() to check if your goal yy is available. I put my numberology function in an after-adventure script, then it uses it whenever it can.

Code:
void calcu(int yy) {
    if (to_int(get_property("_universeCalculated"))<to_int(get_property("skillLevel144"))) {
        foreach ii,ss in reverse_numberology(0,0) {
            if (ii==yy) { cli_execute("numberology "+yy); }
        }
    }
}
 

Rax

New member
I wish I had known reverse_numberology() existed. I remember now that ashref is a thing to be checked when facing problems like this.

I can see the benefit of doing this via an after-adventure script, but I'm also happy with where it sits in my daily script since I'll be adventuring in the target location anyway. For sake of reference, this is how I've corrected what I was trying to do:

Code:
while (to_int(get_property("_universeCalculated")) < numberologyUses)    {
    foreach i in reverse_numberology()                      {
        if (i == yy)                                   {
            while (to_int(get_property("_universeCalculated")) < numberologyUses)
                cli_execute("numberology " + yy);      }    
                                                            }
        if (to_int(get_property("_universeCalculated")) < numberologyUses)
            adv1($location[example location], -1, "");                    }

The value of "numberologyUses" is an int set manually, and yy is an int set to the desired outcome based on various conditions in the script. The loop checks if yy is available in reverse_numberology(), expends all numberology uses if so, and if not adventures until yy appears.

Thanks ckb.
 
Top