Relay Script Complications

StDoodle

Minion
Ok folks, I'll admit my scripts are a bit "weird" in their architecture. I have a set of clan management scripts that start off with the relay script that is basically just a template, and clicking various tab links from it calls other (non-relay) scripts that are in charge of the rest of the output.

However, the latest builds don't seem to work anymore; the sub-scripts no longer appear to be called, or at least they no longer write to the relay browser.

I haven't kept up on the latest changes recently due to real-life stuff, so does anyone have an idea of where I can look or what I could do? I'm in a fairly desperate position, as 1) HCN has come to depend on these scripts for managing the Slime Tube but 2) I don't have the real-life time for any massive re-writes.

Help me KoLmafia forum-folks, you're my only hope!
 

Veracity

Developer
Staff member
clicking various tab links from it calls other (non-relay) scripts that are in charge of the rest of the output.
How do they "call" these scripts? What ASH command?

However, the latest builds don't seem to work anymore; the sub-scripts no longer appear to be called, or at least they no longer write to the relay browser.
It would be the latter. Scripts run in their own Interpreter, and the output buffer is now associated with an interpreter, rather than being globally available.

That was an important bug fix, and it will not be reverted. However, running sub-scripts from within a relay script and writing to the same output buffer seems reasonable and I can probably figure out how to make that happen - once I figure out how you are invoking subscripts. Let's see some code. :)
 

StDoodle

Minion
Master / Template script: St. Doodle's Clan Management

Example plugin script: stash_log.ash

Function from the Clan Management script that calls sub-scripts:
PHP:
void tab_GENERIC(string script, string parameter) {
    tab_Header();
    write_hidden(TAB, "current_tab");
    fields["current_tab"] = TAB;
    if (parameter == "") {
        cli_execute("call " + script);
    } else {
        cli_execute("call " + script + " " + parameter);
    }
    tab_Footer();
}

tl;dr Yup, I use "call" ;)

Edit to add:

I'm completely open to a different way of approaching this: the issue is that some of the called scripts are rather complex, and some are very simple, so I'd like to have some code separation going on. One of my major design goals was to set things up such that if, down the road, another clan plugin script was desired, it could be written without having to know much about how the template / master script handled things. E.g. I wanted it to be easy for someone else to write a plugin. (Some of the bigger clans have high burnout rates for administrators, in my experience, and I'd hate for a clan to rely on a script package that could only be sanely maintained by one person. Especially if I'm that person. ;))
 
Last edited:

Veracity

Developer
Staff member
Actually, the ASH function you use is "cli_execute". The CLI command is "call".
Pondering.
 

StDoodle

Minion
Well, I meant "I use 'call' as invoked from a cli_execute() function." The extra info was in my head and totally implied.

Yeah, it pisses my wife off to no end when I do that, too. :p
 

Veracity

Developer
Staff member
The answer to my question really was cli_execute(), not "call". You could just as well have used cli_execute( "foo.ash" ) and skipped the "call".
 

StDoodle

Minion
Just to be clear, I totally understand that and agree you're completely right: I'm just trying to point out that in my head, I had the full and correct answer*, why couldn't you read my mind and know that's what I meant? (Meant totally as a joke, as referenced by the "pisses my wife off" comment, 'cause I do this all the time. Sorry.)

* But then actually wrote the shortened version, using the incorrect part ("call" vs. cli_execute()) which is totally confusing and my apologies.
 
Top