Bug - Not A Bug adventure() filter must be top-level code?

heeheehee

Developer
Staff member
A simple script like
PHP:
void main() {
    string s(int round, string opp, string text) {
        return "skill fearful fettucini";
    }
    adventure(1,$location[library],"s");
}
returns "Unable to invoke s", and does some funky stuff with the fight (For some reason, it uses two ovoid leather things, even though I don't have that anywhere in my CCS.)

Just moving the filter function outside of the main function works just fine, though.

(Also, I'm not sure this is the place to put it, but "skill #" gets converted into "attack with weapon" in practice. Also a bug?)
 

Bale

Minion
(Also, I'm not sure this is the place to put it, but "skill #" gets converted into "attack with weapon" in practice. Also a bug?)
That's not a bug, or surprising to me. In a CCS anything that it cannot parse gets converted into "attack with weapon". "skill #" shouldn't be an exception, or do I miss the meaning of that phrase?
 

heeheehee

Developer
Staff member
"skill #" is supposed to be "skill [skill number]". Like "skill 3019". Sorry, thought that was obvious.
 

Bale

Minion
Then you shouldn't have used quotes. Those indicated to me that you meant #.

/em pouts.
 

slyz

Developer
If you do use quotes in your CCS, Mafia will add the line as-is in your KoL Combat Macro, where it will be correctly parsed:
Code:
[ default ]
"skill 3019"
 
Last edited:

heeheehee

Developer
Staff member
So return "\"skill 3019\""; would be the proper filter line?

Nonetheless, I think we're getting a bit sidetracked. The original point was that adventure() only works with a filter if the filter's top-level.
 

StDoodle

Minion
Is this an in-combat consulting function? The line:
Code:
[COLOR=#000000][COLOR=#0000bb] string s[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]int round[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]string opp[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]string text[/COLOR][COLOR=#007700]) { [/COLOR][/COLOR]


leads me to believe it is. If so, doesn't the passing of parameters need to occur in main()? Or is this a regular script, and you've excised the part where those are declared? Or am I missing something altogether?
 

heeheehee

Developer
Staff member
This is a regular script that uses a filter for adventure(). As mentioned, it works just fine if I move that function outside of the main function.
 

jasonharper

Developer
The requirement that the filter function be at top level is unavoidable: it's being called from outside of ASH, so only global names are accessible.

The use of ovoid leather things is the typical symptom of a botched filter function - a failed function call returns void, and as a string "void" matches that particular item.

CCS "skill" commands have never accepted skill numbers, use the actual name!
 

heeheehee

Developer
Staff member
Gotcha on all three calls. Just wanted to make sure that this wasn't a bug before adding this piece of information to the Mafia wiki.
 
Top