Ambidextrous Completion of Rotflmfao

QSquared

New member
I didn't care too much about this until they made the change over for needing to feed items to the adding machine to generate a gate scroll to complete the bridge the orc chasm quest.

But now that it's required, I need to find out how to specifically tell KOL Mafia what the 2nd item to use should be.

Before now I was content to use spices twice and then use shark tooth twice, though a bit miffed that I had to use two 8 balls :-/

But now I am directly unable to complete a quest in a scripted manner due to my ambidextrosity (I am a word-smith)I

I'd always figured I'd find out how to specify the second item later, since it's hinted at int he combat script user guide. However, I can't seem to figure out how to do it. I tried numbering the lines the same, and using "AND" and "&&" to do this, but I can't seem to figure out the proper syntax. and the topic I found here was someone who wanted to use the same Item twice so, yeah, not so helpful, since thats what I'm trying to avoid.

So I figured I'd just start my own topic, I'm sure I'm asking something silly and obvious, so I didn't really want to bother anyone with a post about it till I at least tried to figure it out on my own.

~Q
 

QSquared

New member
I can't see where that is referenced int his script, maybe I'm missing how it feeds the adding machine while using ambidextrous funkslinging
 

holatuwol

Developer
[quote author=QSquared link=topic=1032.msg5188#msg5188 date=1185045190]
But now I am directly unable to complete a quest in a scripted manner due to my ambidextrosity (I am a word-smith)
[/quote]
You need to use consult scripts which, as mentioned on the custom combat page, I don't feel like documenting.
 

QSquared

New member
I haven't been able to even attempt this because of how much I have been working lately. However I looked up the consult scripts through the searchyness, and I see how to call them. Would my script be something like this?

[Begin Consult Script Pseudo code]


If variable != "Done"

If Inventory(334 scroll)>1 AND Inventory(668 scroll)<1
use 334 scroll (this implicitly uses two like in combat scripts, correct?)

else if Inventory(64067 scroll)>1 AND Inventory(30669 scroll)<1 AND Inventory(33398 scroll)<1
use 30669 scroll AND use 33398 scroll (How do I execute this statement??)

else if Inventory(64735 scroll scroll)>1 AND Inventory(668 scroll)<1 AND Inventory(64067 scroll )<1
use 668 scroll AND use 64067 scroll (How do I execute this statement??)
Set Variable = "done"
end if

else
Attack with weapon (or whatever)
end if

[End Consult Script Pseudo Code]
 

holatuwol

Developer
Actually, for the next release, there will be automated scroll building, so this script isn't necessary. :)
 

KiraCatgirl

New member
Bummer, I go through the trouble of making a script like this for myself and now find out it's going to be obsolete. xD

Either way, the function you want(ed) was string throw_items( item tothrow1, item tothrow2 )

Anyways, you can have my script, if you want it before the next version releases, it works for both with and without Funkslinging. At least it should, I only used it without. *attached*
 

Attachments

  • addmac.ash
    2.2 KB · Views: 94

QSquared

New member
I fixed all the missing parentheses and such and ran the script, and I have good news and bad,

The good news: The script works when run by hand against the adding machine! (Hurray!)

The Bad News: The consult command generated an error in KOL Mafia when I try to run the script there (Booo!)

since this is an error with the way I am calling a consult script (or with KOL Mafia's handling of calling th consult script???) I am posting back for some help.

When the adding machine comes up I get "Unexpected Error" over and over again in the CLI until I abort:
Unexpected error, debug log printed. Unexpected error, debug log printed. Unexpected error, debug log printed. Unexpected error, debug log printed. KoLmafia declares world peace. You're on your own, partner.

and the error log is full of error entries (which I will email one of them to you Holatwol since thats what the entries suggest would be more appropriate then placing them here)
 

QSquared

New member
I have attached the fixed script, sorry I didn't do that before; the errors were all silly things like missed parens, as in '(' with no ')' I think they weren't found previously only because he doesn't have Funk Slinging to test with, which is why I didn't post.

Calling this script on the adventure itself through the script menu works perfectly, however I cannot get the consult function to call the script durring combat, instead it just writes the error message above


For reference here is my custoim combat script as stands:
Code:
[ default ]
1: attack with weapon
2: item spices
3: attack with weapon
10: item goodfella contract

[ rampaging adding machine ]
1: consult ROTFLMFAO.ash
 

Attachments

  • ROTFLMFAO.ash
    2.1 KB · Views: 87

holatuwol

Developer
The main method for consult scripts must accept three parameters. See the other consult scripts in this forum to see what they are.
 

QSquared

New member
Alright, I found an example ASH (Fight Optimizer) and pulled the definition of the main function from it:

Code:
void main(string roundString, string encounterString, string pageString){

Now my main function looks like the following:

Code:
void main(string roundString, string encounterString, string pageString) {
  if (have_skill($skill[Ambidextrous Funkslinging])) double_scroll();
  else single_scroll();
  return;
}

However the error is still being thrown.

I looked at another example consult script (The stasis script) and it uses the following:

Code:
void main(int iRound, monster enemy, string sText)
{

From that it seems that the three variables expected can be any type, so does it even matter what what type they are? ???
 

holatuwol

Developer
It's main(int,monster,string). However, if the monster isn't in KoLmafia's database, then the second parameter becomes $monster[none], and if you want your script to handle monsters KoLmafia doesn't know about, you need to use main(int,string,string). Anything casts to string, so main(string,string,string) works as well.
 

QSquared

New member
[quote author=holatuwol link=topic=1032.msg5534#msg5534 date=1187192915]
It's main(int,monster,string). However, if the monster isn't in KoLmafia's database, then the second parameter becomes $monster[none], and if you want your script to handle monsters KoLmafia doesn't know about, you need to use main(int,string,string). Anything casts to string, so main(string,string,string) works as well.
[/quote]

Okay, thats pretty straightforward, but then, if I stole this line and used it:
Code:
void main(string roundString, string encounterString, string pageString) {
why doesn't that work, I'm obviously declaring three string variables in the definition of main by using it, must these variables actually be used in the function, or is there some other part I'm missing thats causing the errors I sent you to be thrown?

Also I have two suggestions (they may already be implemented and then I guess my suggestions just become questions:

an 'on error abort' type functionality

and set the debug log to output to a debug directory, one file per day that a debug error is thrown.

My debug log was 40 MB at this point, heh, I have truncated it by adding the date to the existing log file name and so 'Mafia should build a new one. If 'Mafia could do that on it's own it'd probably help w/ debugging etc.
 

QSquared

New member
Call me Confused, but does KOL Mafia check it's local directory for a copy of the script, and then, only if the script doesn't exist there, check the scripts directory??

I had an older copy of the script in the same directory as 'Mafia, and when I removed it the script started working with consult like a charm. Does KOL Mafia consider it's local directory an over-ride to the scripting directory then?

Also can I calla script from a sub directory of the script directory using the consult script or must it be in the KOL Mafia director or the scripting directory only?

~Q
 

holatuwol

Developer
[quote author=QSquared link=topic=1032.msg5542#msg5542 date=1187240805]
Does KOL Mafia consider it's local directory an over-ride to the scripting directory then?
[/quote]

Yes.


[quote author=QSquared link=topic=1032.msg5542#msg5542 date=1187240805]
Also can I calla  script from a sub directory of the script directory using the consult script ...
[/quote]

Yes.
 
Top